On Thu, Mar 10, 2011 at 10:39 PM, Jarl Haggerty <jarlhagge...@gmail.com>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, 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


Try:

(ns box2d.core
 (import org.jbox2d.common.Vec2)
 (:gen-class))

(defn -main [& args]
  (dotimes [_ 5]
    (let [a (Vec2. 1 2)
          b (Vec2. 3 4)]
      (time (dotimes [x 1e9]
              (.addLocal a b))))))

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