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 the inner doseq with a loop. But java is
still 5x faster and I hear that clojure should be able to run as fast
as java and I wondered if there's any options in clojure I'm not using
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 the inner doseq with a loop. But java is
still 5x faster and I hear that clojure should be able to run as fast
as java and I wondered if there's any options in clojure I'm not using
I think if you turn on reflection warnings and remove those type
hints, you'll find those hints aren't useful. In which case I'd
recommend leaving them out.
--Chouser
Is there a reason I can't get this clojure program to compare with the
java one?
The following code:
Point2D.Float a = new Point2D.Float(1, 2), b = new
for(int q = 0;q < 5;q++){
Point2D.Float(3, 4);
long start = System.currentTimeMillis();
for(int d = 0;d < (int)1e9;d++){
a.getX();
}
long stop = System.currentTimeMillis();
System.out.println(stop - start);
}
prints this:
7
6
0
0
0