Re: Clojure performance tests and clojure a little slower than Java

2009-08-13 Thread Daniel
On Thu, Aug 13, 2009 at 10:40 AM, Glen Stampoultzisgst...@gmail.com wrote: There was a good thread on this list some weeks ago which mentioned another JVM flag: -XX:+PrintOptoAssembly The original thread: http://groups.google.com/group/clojure/browse_thread/thread/314952431ec064b7?fwc=1

Re: Clojure performance tests and clojure a little slower than Java

2009-08-12 Thread Bradbev
On Jul 28, 7:47 pm, Andy Fingerhut andy_finger...@alum.wustl.edu wrote: I have added a script that uses the Java version of the benchmark programs to generate the large files that were in the distribution file I gave a link to earlier, so it is much smaller.  I've also published it on github

Re: Clojure performance tests and clojure a little slower than Java

2009-08-12 Thread Mike Hinchey
John, this will speed up to the same as the others if you let the 0. IIRC from looking at the bytecode before, the 0 is an Integer not an int. user (time (let [m (int 1) b (double 4.0) x0 (double -0.2) y0 (double 0.1) t (double 2.0) i0 (int 0)] (loop [x (double 0.0) y

Re: Clojure performance tests and clojure a little slower than Java

2009-08-12 Thread Isak Hansen
On Wed, Aug 12, 2009 at 7:00 AM, John Harropjharrop...@gmail.com wrote: A very straightforward version, and 875.36796ms/1 = 8.7536796ns. This is on a 2.5GHz machine, so that's only about 22 native instructions per iteration. The theoretical minimum is over 1/2 of that: Four fmuls

Re: Clojure performance tests and clojure a little slower than Java

2009-08-12 Thread Daniel
On Wed, Aug 12, 2009 at 12:00 PM, John Harropjharrop...@gmail.com wrote: Note: the expressions should be run three or four times. The first two or three timings will be longer than the later ones. (JIT?) Run until the times are consistent and at least three repetitions have been run in rapid

Re: Clojure performance tests and clojure a little slower than Java

2009-08-12 Thread Glen Stampoultzis
There was a good thread on this list some weeks ago which mentioned another JVM flag: -XX:+PrintOptoAssembly The original thread: http://groups.google.com/group/clojure/browse_thread/thread/314952431ec064b7?fwc=1 There's some more information about it at [1]. It looks like you need a

Re: Clojure performance tests and clojure a little slower than Java

2009-08-11 Thread John Harrop
On Fri, Aug 7, 2009 at 8:14 PM, John Harrop jharrop...@gmail.com wrote: Your core loop seems to be: (loop [zr (double 0.0) zi (double 0.0) zr2 (double 0.0) zi2 (double 0.0) iterations-remaining iterations-remaining] (if (and (not (neg?

Re: Clojure performance tests and clojure a little slower than Java

2009-08-09 Thread Andy Fingerhut
On Aug 8, 2:16 pm, John Harrop jharrop...@gmail.com wrote: On Sat, Aug 8, 2009 at 5:23 AM, Mark Engelberg mark.engelb...@gmail.comwrote: On Fri, Aug 7, 2009 at 5:14 PM, John Harropjharrop...@gmail.com wrote:     (if (and (not (= 0 i)) ( (+ zr2 zi2 limit-square))) I believe that

Re: Clojure performance tests and clojure a little slower than Java

2009-08-09 Thread John Harrop
On Sun, Aug 9, 2009 at 3:06 AM, Andy Fingerhut andy_finger...@alum.wustl.edu wrote: I did two runs for each version, with the only difference between them being replacing the (zero? i) expression in function 'dot' with a different expression, as indicated below. (zero? i) is a clear winner

Re: Clojure performance tests and clojure a little slower than Java

2009-08-08 Thread Mark Engelberg
On Fri, Aug 7, 2009 at 5:14 PM, John Harropjharrop...@gmail.com wrote:     (if (and (not (= 0 i)) ( (+ zr2 zi2 limit-square))) I believe that (zero? i) is faster than (= 0 i). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Clojure performance tests and clojure a little slower than Java

2009-08-08 Thread John Harrop
On Fri, Aug 7, 2009 at 9:19 PM, Andy Fingerhut andy_finger...@alum.wustl.edu wrote: What I suggest is (loop [zr (double 0.0) zi (double 0.0) i (int (inc iterations-remaining))] (let [zr2 (* zr zr) zi2 (* zi zi)] (if (and (not (= 0 i)) ( (+ zr2 zi2

Re: Clojure performance tests and clojure a little slower than Java

2009-08-08 Thread John Harrop
On Sat, Aug 8, 2009 at 5:23 AM, Mark Engelberg mark.engelb...@gmail.comwrote: On Fri, Aug 7, 2009 at 5:14 PM, John Harropjharrop...@gmail.com wrote: (if (and (not (= 0 i)) ( (+ zr2 zi2 limit-square))) I believe that (zero? i) is faster than (= 0 i). On primitive ints? Have you tested

Re: Clojure performance tests and clojure a little slower than Java

2009-08-07 Thread John Harrop
On Thu, Aug 6, 2009 at 6:57 PM, Andy Fingerhut andy_finger...@alum.wustl.edu wrote: You are correct. I've updated that file: http://github.com/jafingerhut/clojure-benchmarks/blob/bb9755bdeeccae84a9b09fbf34e45f6d45d4b627/RESULTS Could you post the Mandelbrot code you use? Because I know

Re: Clojure performance tests and clojure a little slower than Java

2009-08-07 Thread Andy Fingerhut
On Aug 6, 6:49 pm, John Harrop jharrop...@gmail.com wrote: On Thu, Aug 6, 2009 at 6:57 PM, Andy Fingerhut andy_finger...@alum.wustl.edu wrote: You are correct.  I've updated that file: http://github.com/jafingerhut/clojure-benchmarks/blob/bb9755bdeeccae8... Could you post the

Re: Clojure performance tests and clojure a little slower than Java

2009-08-07 Thread John Harrop
Your core loop seems to be: (loop [zr (double 0.0) zi (double 0.0) zr2 (double 0.0) zi2 (double 0.0) iterations-remaining iterations-remaining] (if (and (not (neg? iterations-remaining)) ( (+ zr2 zi2) limit-square)) (let [new-zi (double (+

Re: Clojure performance tests and clojure a little slower than Java

2009-08-07 Thread Andy Fingerhut
On Aug 7, 5:14 pm, John Harrop jharrop...@gmail.com wrote: Your core loop seems to be: (loop [zr (double 0.0)          zi (double 0.0)          zr2 (double 0.0)          zi2 (double 0.0)          iterations-remaining iterations-remaining]     (if (and (not (neg? iterations-remaining))    

Re: Clojure performance tests and clojure a little slower than Java

2009-08-06 Thread André Thieme
On 27 Jul., 23:26, AndyF andy_finger...@alum.wustl.edu wrote: Hello Andy, could you please update the following table?         |  sbcl  |  perl  |   ghc  |  java |   clj - mand-   | wrong  | out of |  32.7  |  28.6  | 340.4 elbrot  |

Re: Clojure performance tests and clojure a little slower than Java

2009-08-06 Thread Andy Fingerhut
On Aug 6, 3:28 pm, André Thieme splendidl...@googlemail.com wrote: On 27 Jul., 23:26, AndyF andy_finger...@alum.wustl.edu wrote: Hello Andy, could you please update the following table?         |  sbcl  |  perl  |   ghc  |  java |   clj

Re: Clojure performance tests and clojure a little slower than Java

2009-07-29 Thread Andy Fingerhut
I have added a script that uses the Java version of the benchmark programs to generate the large files that were in the distribution file I gave a link to earlier, so it is much smaller. I've also published it on github and added a COPYING file that makes the licenses more explicit (revised BSD

Re: Clojure performance tests and clojure a little slower than Java

2009-07-28 Thread Berlin Brown
Thanks AndyF, do you mind if I use some of your examples and put my own spin on them. I was curious and want to run my own tests and see if I get similar output? On Jul 28, 12:03 am, ataggart alex.tagg...@gmail.com wrote: On Jul 27, 10:06 am, BerlinBrown berlin.br...@gmail.com wrote: So

Re: Clojure performance tests and clojure a little slower than Java

2009-07-28 Thread AndyF
Anybody is welcome to take the Clojure sources and do what they will with them -- publish the original or modified code under their own license, sell it, etc. For the Perl, Common Lisp, Haskell, etc. sources, those are published under this license. It isn't my code.

Re: Clojure performance tests and clojure a little slower than Java

2009-07-28 Thread fft1976
Thanks, AndyF for writing the code! I'm glad someone's done a comparison of idiomatic code instead of making unsubstantiated claims. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: Clojure performance tests and clojure a little slower than Java

2009-07-28 Thread fft1976
On Jul 28, 8:26 pm, Berlin Brown berlin.br...@gmail.com wrote: On Jul 28, 2:37 pm, fft1976 fft1...@gmail.com wrote: Thanks, AndyF for writing the code! I'm glad someone's done a comparison of idiomatic code instead of making unsubstantiated claims. Are you implying that my claims are

Clojure performance tests and clojure a little slower than Java

2009-07-27 Thread BerlinBrown
I was coming up with some performance tests for Clojure, going back and forth between different JVM languages (JRuby, Scala) and mainly looking at pure Java code. So far I have found that clojure is about 5-10 times as slow as comparable code in Clojure. Of course this is before any

Re: Clojure performance tests and clojure a little slower than Java

2009-07-27 Thread Aaron Cohen
One thing you need to do is define what you mean exactly when you say Java vs Clojure. In your example you are comparing clojure code vs java code but you are also comparing clojure data structures (PersistentMap) with traditional Java data structures (HashMap). I'm not sure you meant to conflate

Re: Clojure performance tests and clojure a little slower than Java

2009-07-27 Thread Berlin Brown
One thing you need to do is define what you mean exactly when you say Java vs Clojure. Like I said, I didn't want to get too focused on this particular example. Is there code where I could run in Clojure and where I could run in Java that would end up with the same result. And then I could

Re: Clojure performance tests and clojure a little slower than Java

2009-07-27 Thread Berlin Brown
On Jul 27, 1:57 pm, Berlin Brown berlin.br...@gmail.com wrote: One thing you need to do is define what you mean exactly when you say Java vs Clojure. Like I said, I didn't want to get too focused on this particular example. Is there code where I could run in Clojure and where I could

Re: Clojure performance tests and clojure a little slower than Java

2009-07-27 Thread Aaron Cohen
http://groups.google.com/group/clojure/browse_thread/thread/7ab7c1e62c468d7c/37678e50ca75be06?q=group:clojure+performance+rich#37678e50ca75be06 http://groups.google.com/group/clojure/browse_thread/thread/7ab7c1e62c468d7c/37678e50ca75be06?q=group:clojure+performance+rich#37678e50ca75be06

Re: Clojure performance tests and clojure a little slower than Java

2009-07-27 Thread Berlin Brown
On Jul 27, 2:15 pm, Aaron Cohen remled...@gmail.com wrote: http://groups.google.com/group/clojure/browse_thread/thread/7ab7c1e62... http://groups.google.com/group/clojure/browse_thread/thread/7ab7c1e62...http://groups.google.com/group/clojure/browse_thread/thread/6cd78dea8...

Re: Clojure performance tests and clojure a little slower than Java

2009-07-27 Thread AndyF
Berlin: I've got a start at programs for solving two of the problems solved in many other languages on The Computer Language Benchmarks Game web site: http://shootout.alioth.debian.org In particular, the k-nucleotide problem has as a significant part of its computation time a similar task to

Re: Clojure performance tests and clojure a little slower than Java

2009-07-27 Thread Isaac Gouy
On Jul 27, 2:26 pm, AndyF andy_finger...@alum.wustl.edu wrote: -snip- I thought it was interesting that even the Haskell entry to the k- nucleotide benchmark uses a *mutable* hash table (at least, I think they are from the discussion on the Wiki page linked below -- my Haskell knowledge

Re: Clojure performance tests and clojure a little slower than Java

2009-07-27 Thread ataggart
On Jul 27, 10:06 am, BerlinBrown berlin.br...@gmail.com wrote: So far I have found that clojure is about 5-10 times as slow as comparable code in Clojure. I infer you mean clojure execution times are about 5-10 times longer than in java. It depends on what you're doing, but that sounds