I suggest examining the examples in test.benchmark to see how Java numeric
performance can be attained, http://github.com/clojure/test.benchmark

On Monday, March 26, 2012, Sergey Didenko <sergey.dide...@gmail.com> wrote:
> Hi,
>
> I believe I've heard claims that nothing stops Clojure 1.3 code to be
> made very close to Java in terms of execution speed.
>
> However when trying to match the speed of ad-hoc Heapsort
> implementation I have faced essential obstacles.
>
> Setting type hints and coercions was quite easy. A bit harder was to
> realize that "aset" is much faster than "aset-int" and that "(int -1)"
> inside "if" condition can be faster than "-1".
>
> However I'm still far from the Java speed ( 1.5 times slower on a cut
> code - first part of the Heapsort ).
>
> What I can't understand now is why inlining the following function
> makes a noticeable speedup (~20%). Isn't it supposed to be solved in
> 1.3?
>
> (defn move-up! [^long pos]
>  (let [array (ints array)]
>    (loop [pos pos ppos (unchecked-divide-int pos 2)]
>      (if (or (= pos 0)
>              (>= (aget array ppos) (aget array pos)))
>        nil
>        (do ;(swap! array ppos pos)
>          (recur ppos (unchecked-divide-int ppos 2)))))))
>
> I'm attaching the full sources if anyone is interested to measure the
> difference.
>
> Regards, Sergey.
>
> P.S.
>
> java version "1.7.0_02"
> Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
> Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)
>
> --
> 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

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