Clojure, Faster
This reads a bit like &quot;why you shouldn&#x27;t use clojure&quot; to me. I&#x27;d expect to leave some performance on the table when writing idiomatic code in a dynamic language with immutable datatypes, but a function that&#x27;s already specialized to arrays, as the name indicates, taking 3 orders of magnitude too much time? 1-10 microseconds to say &quot;get me the length of this java array, and BTW this <i>is</i> a java array&quot;? What on earth is going on there?<p>Edit: So I just ran the author&#x27;s (alength (long-array 5)) (with the indirection to foil type inference) and got 10µs mean execution time in criterium. By contrast here&#x27;s some roughly equivalent python:<p><pre><code>   In [5]: a = array.array(&#x27;l&#x27;, [5])                                                                                                                                                                         
   In [6]: timeit len(a)                                                                                                                                                                                     
   32.9 ns ± 0.105 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
</code></pre>
More or less exactly the same with a plain python list. So clojure&#x27;s type specialized function manages to be 300 times slower than the <i>generic</i> version in freaking *python*. In fairness &quot;count&quot; is better if still terrible (4x slower than python).