Some more data points on 1.3 alpha 1 performance:

bit operations appear to be much faster on hinted args.  For example,

  (defn unhinted-shift [n] (bit-shift-left n 1))
  (defn ^:static hinted-shift [^long n] (bit-shift-left n 1))

  user=> (time (doseq [x (range 100000)] (unhinted-shift x)))
  "Elapsed time: 2533.935459 msecs"
  user=> (time (doseq [x (range 100000)] (hinted-shift x)))
  "Elapsed time: 33.889503 msecs"

On the other hand, / seems to be much faster on unhinted args.

  (defn unhinted-divide [n] (/ n 2))
  (defn ^:static hinted-divide [^long n] (/ n 2))

  user=> (time (doseq [x (range 100000)] (unhinted-divide x)))
  "Elapsed time: 37.612043 msecs"
  user=> (time (doseq [x (range 100000)] (hinted-divide x)))
  "Elapsed time: 2687.836862 msecs"

I checked the enhanced operations (+, -, *, inc, dec) and their prime
counterparts (+', -', *', inc', dec').  All 10 perform equally fast
with unhinted and hinted args.

On Sep 30, 12:19 am, Mark Engelberg <mark.engelb...@gmail.com> wrote:
> bitwise-and and bitwise-shift-right and bitwise-shift-left run more
> than 50 times slower in clojure 1.3 alpha 1 versus clojure 1.2.  Could
> the 1.3 gurus please investigate this?
>
> Try something like this to see the difference:
> (time (doseq [x (range 100000)] (bit-shift-left x 1)))
>
> This points to another issue with Clojure 1.3.  I can't figure out how
> to determine what is a primitive and what isn't.  Are the values
> produced by range primitives?  Are the values produced by bitwise
> operations primitive?  How can I determine this?

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