So I got a chance to do some tweaks to the clojure code and run the benchmark. I also used the "approved" (not alternative) version of java code for comparison. I must say I am impressed with the clojure agent performance.
The previous implementation results for 20,000,000 hops was: java: 27.14 sec, 92% cpu scala: 190.78 sec, 183% cpu clojure: 215.26 sec, 134% cpu The new results are: java: 33.56 sec, 94% cpu scala: 191.08 sec, 177% cpu clojure: 77.01 sec, 91% cpu The tweaks to clojure code were minor. Basically, coercing hops to (int hops) and using (neg? hops) instead of =. Detailed Log: http://gist.github.com/125614 Updated Clojure Code: http://gist.github.com/125615 Jave Code: http://shootout.alioth.debian.org/u32q/benchmark.php?test=threadring&lang=java&id=4 Scala Code: http://shootout.alioth.debian.org/u32q/benchmark.php?test=threadring&lang=scala&id=1 Regards, Parth On Jun 6, 2:39 pm, Parth <parth.malwan...@gmail.com> wrote: > On Jun 6, 11:44 am, Sean Devlin <francoisdev...@gmail.com> wrote: > > > This problem came up on the mailing list recently: > > >http://groups.google.com/group/clojure/browse_thread/thread/5e0c078d0... > > > You might want to compare your code to what was done here, but at a > > glance the implementations are similar. > > > You provide relative speed comparisons (Such and such is % > > better...). Would you be able to share absolute times as well? I'm > > just curious at this point. > > > Sean > > For some reason the google spreadsheet link provided in > my original mail requires users to login for viewing. > The same numbers are available in this published > google spreadsheet (hopefully without login). > > http://tinyurl.com/ofhync > > Regards, > Parth > > > > > On Jun 6, 12:41 am, Parth Malwankar <parth.malwan...@gmail.com> wrote: > > > > Hello, > > > > In order to understand the agent model of Clojure > > > better I wrote the alioth shootout threadring benchmark [1]. > > > I ran some tests to compare it with the Java and Scala > > > implementation [2, 3] which I picked from the published > > > benchmarks. > > > > The clojure code can be found here:http://gist.github.com/124688 > > > > The benchmark from my two core 1.7GHz pentium system > > > (ubuntu 9.04) w/ 1GB RAM can be found > > > here:http://spreadsheets.google.com/ccc?key=rQLD6jgTTV5OqXwHdXtrTyg > > > > In summary, scala implementation is 6.34x times slower than > > > java, clojure is 7.8x. Avg CPU consumption is 93.3% for java and > > > 179.2% and 131.34% for scala and clojure respectively. > > > > I thought of sharing this in case others are interested. > > > As this is my first program using clojure agents I would appreciate > > > any > > > comments on improving the Clojure implementation (or in case > > > there are any bugs). > > > > Thanks. > > > Parth > > > PS: For the Java implementation I happen to pick the "interesting > > > alternate programs" (Java 6 -server #5) but it was already quite > > > late in the cycle when I realized that. So the Java numbers are > > > probably better than the other java implementations. > > > > [1]http://shootout.alioth.debian.org/u32q/benchmark.php?test=threadring&... > > > [2]http://shootout.alioth.debian.org/u32q/benchmark.php?test=threadring&... > > > [3]http://shootout.alioth.debian.org/u32q/benchmark.php?test=threadring&... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---