For what it's worth, I eventually figured out a solution: use conj rather than applying the vector-of function itself. The following are all about the same speed and avoid the reflection calls:
(apply conj (vector-of :long) (range 10000000)) (apply conj (vector-of :int) (range 10000000)) (apply conj (vector) (range 10000000)) I'm not totally clear on why conj'ing works and applying vector-of itself does not, but I'm happy it's faster. On Jan 27, 4:17 pm, Bryce <[email protected]> wrote: > Unfortunately with that change I still show ~90% of CPU time being > spent in Reflector.getMethods(). > > On Jan 27, 11:59 am, Michael Wood <[email protected]> wrote: > > > > > > > > > On 25 January 2012 23:30, Bryce <[email protected]> wrote: > > [...] > > > > ;All of these spend most of their time in reflection > > > (applyvector-of:int (range 10000000)) > > > (applyvector-of:int ^"[J>" (range 10000000)) > > > (applyvector-of:int ^"[J>" (long-array (range 10000000))) > > > (applyvector-of:int ^{:tag 'longs} (long-array (range 10000000))) > > > Just a guess. Have you tried the following? > > > (applyvector-of:long ...) > > > -- > > Michael Wood <[email protected]> -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
