Are we sure that it is the aset-* operation that is causing a slowdown
and not the fact that the aset-* operations are not being inlined,
whereas the regular aset operation is?

If so, the aset-* ops might be faster, and just in need of a small
update!

A lot of the time when something is slower than java in this way,
it is because of boxing/unboxing and going through extra function
calls.

OP might want to try
(.setByte dst (dst-offset (byte sample)))
(.setByte dst ((inc dst-offset) (byte (bit-shift-right sample 8))))
[and see what happens]

In place of the calls to aset...
(For all we know some of the other 'lower level' functions might
suffer from this as well)

I could probably write up a patch to inline the aset-*s...

I feel like adding a warning might fix the symptoms but not the
disease in this case...

On Sep 7, 5:10 am, Nicolas Oury <nicolas.o...@gmail.com> wrote:
> On Sun, 6 Sep 2009 07:54:33 -0700 (PDT)
>
> Andy Fingerhut <andy_finger...@alum.wustl.edu> wrote:
>
> > Is there any reason to keep aset-* functions around in Clojure?  I
> > guess backwards compatibility?
>
> > It definitely seems worth flagging them when *warn-on-reflection* is
> > true, in a similar way to other warnings it enables.  Perhaps that
> > might be overloading the meaning of *warn-on-reflection*, but I think
> > there is definitely value in having _one_ flag you can turn on that
> > gives you as many kinds of performance warnings as we know how to
> > give.
>
> I agree, for the warning. I think it should be also clearer in the 
> documentation that they are slower.
> As it is counter intuitive (more information gives less speed), it should be 
> really over emphasized in the
> doc about performance.
>
> If you want to have a look on for which types there is  aget/aset is 
> optimized, I think the right place is
> clojure/lang/RT.java.
>
> Best regards,
>
> Nicolas.
--~--~---------~--~----~------------~-------~--~----~
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