vector-of is just implemented poorly - with more than four arguments
it calls .cons on the vector it's building up. If the type were known
and type-hinted this would be a slightly faster version of conj, but
lacking the type-hint it's just a much, much slower version of conj.
Adding ^Vec to line 491 of gvec.clj would probably fix it.

On Feb 13, 9:02 am, Bryce <fiat.mo...@gmail.com> wrote:
> 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

Reply via email to