glaref and (setf glaref) are slow #27

3b opened this Issue May 20, 2011 · 0 comments

1 participant

3b commented May 20, 2011

GLAREF and (SETF GLAREF) pass types to CFFI at runtime, so are mush slower than they should be.

Need to write some benchmarks to figure out how slow, and try to improve it (and test on multiple Lisps).

Possible fixes:

  • dispatch on common types passing constant types to CFFI in each branch
    Much faster than letting CFFI do lookups at runtime, but a bit verbose and probably ends up inlining a bunch of unused code.

  • compile specialized thunks to store in the array types, and call those to read/write the values
    Less dead code, but not sure how expensive the extra function calls will be (probably still much better than runtime CFFI types though)

  • change the API to allow specifying a static type
    Should produce the fastest/smallest code, but not sure if it would be convenient to use. Breaking the existing API would probably be bad too, so would want one of the other solutions for existing code anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment