Here's a transcript of the behavior. I don't know for sure that reflection is being done, but the performance penalty (about 1300x) suggests it.
One workaround is to use multiple agets.
Cause: The inlined version only applies to arity 2, and otherwise it reflects.
Clojure 1.5.1.
Dependencies: criterium
BTW, why does the docstring for aset says it works only on arrays of reference types? Is this comment outdated? We can fix it it along the way.
Is there a chance to review this for 1.10? Perhaps, the implementation is too complicated and needs more time to consider? I might try to reduce the scope then.
It's complicated, not sure if its worth this or not. Probably won't look at it for 1.10.
Thanks for the answer. In terms of complexity, I can remove the part that "optimizes" reflective calls, which both simplifies the algorithm and makes the reflection sites visible to the compiler (and thus to the user).
Bump – can you consider picking this up again for 1.11? The patch is complete; however, if it seems too complicated, it can be simplified.