I'm building a large vector of longs from a lazy seq, and trying to
use vector-of in order to reduce the storage requirements.  Although
there is no reflection warning (and I've turned on *warn-on-
reflection*), in my profiler I see that the majority of the time is
spent invoking clojure.lang.Reflector.getMethods() .  I assume that
behind the scenes, there is a reflection call occurring to verify that
I'm "really" passing in longs.  I've tried converting to a raw Java
array of longs first and type-hinting that with the class string (as
per http://dev.clojure.org/jira/browse/CLJ-851 ), but I still spend
most of my time in getMethods.  Am I right in thinking this is
suboptimal, and any idea of how I fix it?

;All of these spend most of their time in reflection
(apply vector-of :int (range 10000000))
(apply vector-of :int ^"[J>" (range 10000000))
(apply vector-of :int ^"[J>" (long-array (range 10000000)))
(apply vector-of :int ^{:tag 'longs} (long-array (range 10000000)))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to