I haven't tried the code, so caveat emptor:

If you convert partition to a macro *AND* use type-hints, I suspect
you'll see a win.  The issue here is the primitive boxing that must
occur when when calling a function.  It's my hope that when a macro is
used with the appropriate type hints, the Clojure compiler won't box
the primitives but I don't know that.

On Aug 4, 6:03 am, Jonas Enlund <jonas.enl...@gmail.com> wrote:
> On Tue, Aug 4, 2009 at 3:55 PM, Albert Cardona<sapri...@gmail.com> wrote:
>
> > Jonas wrote:
> >>  Can you give any hints on how I can make the transient sort faster? I
> >>  would like to get as close as possible to the native Java speed.
>
> > My guess is that you need primitive type hints. For example:
>
> >     (let [pivot-value (v pivot-index)]
>
> > could be:
>
> >    (let [pivot-value (int (v pivot-index))]
>
> > ... and so on.
>
> > Albert
>
> I have tried to add type hints but they don't seem to speed things up.
> For example, if I add type hints to the partition! loop (where I would
> have thought that
> type hints would make the biggest difference) I don't see a speedup at all:
>
> (defn partition! [....]
>    ...
>    (loop [i (int left-index) store-index (int left-index)]
>    ...)- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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