Re: Comparing clojure speed to java speed

2011-03-19 Thread Jarl Haggerty
Ok, I changed the java version to add x to an accumulator and now it runs just a little slower than clojure, probably because of the extra adding. And if you don't mind one more trivial example... Should I be able assign to the members of an object in Clojure just as fast as I could in Java? I h

Re: Comparing clojure speed to java speed

2011-03-18 Thread David Nolen
On Sat, Mar 19, 2011 at 12:26 AM, Jarl Haggerty wrote: > Is there a reason I can't get this clojure program to compare with the > java one? > > The following code: > > for(int q = 0;q < 5;q++){ > Point2D.Float a = new Point2D.Float(1, 2), b = new > Point2D.Float(3, 4); >long start = System

Re: Comparing clojure speed to java speed

2011-03-18 Thread Jarl Haggerty
Is there a reason I can't get this clojure program to compare with the java one? The following code: for(int q = 0;q < 5;q++){ Point2D.Float a = new Point2D.Float(1, 2), b = new Point2D.Float(3, 4); long start = System.currentTimeMillis(); for(int d = 0;d < (int)1e9;d++){ a.ge

Re: Comparing clojure speed to java speed

2011-03-11 Thread Chouser
On Thu, Mar 10, 2011 at 11:26 PM, Jarl Haggerty wrote: > Hmm, I should have thought of that. > > New Clojure: > > (ns hello.test >  (import org.jbox2d.common.Vec2) >  (:gen-class)) > > (defn -main [& args] >  (dotimes [q 5] >    (let [#^Vec2 a (Vec2. 1 2) >          #^Vec2 b (Vec2. 3 4)] >      (t

Re: Comparing clojure speed to java speed

2011-03-10 Thread Jarl Haggerty
Hmm, I should have thought of that. New Clojure: (ns hello.test (import org.jbox2d.common.Vec2) (:gen-class)) (defn -main [& args] (dotimes [q 5] (let [#^Vec2 a (Vec2. 1 2) #^Vec2 b (Vec2. 3 4)] (time (loop [x (int 0)] (when (< x (int 1e9))

Re: Comparing clojure speed to java speed

2011-03-10 Thread David Nolen
On Thu, Mar 10, 2011 at 10:39 PM, Jarl Haggerty wrote: > I've been benchmarking java and clojure programs and wanted to make > sure I was doing this right. I made two fairly similar programs that > manipulated Vec2 objects from the JBox2D library. At first clojure > was performing pretty poorly,

Re: Comparing clojure speed to java speed

2011-03-10 Thread David Nolen
On Thu, Mar 10, 2011 at 10:39 PM, Jarl Haggerty wrote: > I've been benchmarking java and clojure programs and wanted to make > sure I was doing this right. I made two fairly similar programs that > manipulated Vec2 objects from the JBox2D library. At first clojure > was performing pretty poorly,

Re: Comparing clojure speed to java speed

2011-03-10 Thread Mark Engelberg
Try typehinting the a and b in the let. -- 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 unsubscr

Re: Comparing clojure speed to java speed

2011-03-10 Thread Jarl Haggerty
I should readjust my 5x statement, it's more like 2.25x. On Mar 10, 8:39 pm, Jarl Haggerty wrote: > I've been benchmarking java and clojure programs and wanted to make > sure I was doing this right.  I made two fairly similar programs that > manipulated Vec2 objects from the JBox2D library.  At f

Comparing clojure speed to java speed

2011-03-10 Thread Jarl Haggerty
I've been benchmarking java and clojure programs and wanted to make sure I was doing this right. I made two fairly similar programs that manipulated Vec2 objects from the JBox2D library. At first clojure was performing pretty poorly, then I tried compiling my clojure script, and then replacing th