I did not checked the source code but maybe conj has a vector
specific implementation via protocols.

Luc P.


> 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 <fiat.mo...@gmail.com> 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 <esiot...@gmail.com> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > On 25 January 2012 23:30, Bryce <fiat.mo...@gmail.com> 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 <esiot...@gmail.com>
> 
> -- 
> 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
> 
--
Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail!

-- 
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