On Thu, 4 Nov 2010 22:28:12 +0100 Pepijn de Vos <pepijnde...@gmail.com> wrote:
> Hi all, > > I have written a Python script to analyze Minecraft levels and render a > graph. Then I did the same with Clojure. It takes Python 10 seconds to > analyze a map, while it takes Clojure over a minute. > > After having tried different options without any significant improvement, I > am lost as to why there is such a huge difference. I wouldn't mind an extra > pair of eyes/brains to look at this. > > I blogged about it in more detail here: > http://pepijndevos.nl/clojure-versus-python > Clojure version: https://github.com/pepijndevos/Clomian/ > Python version: https://github.com/l0b0/mian > > Clojure spends most of its time in the freqs function, here are a couple of > variations: https://gist.github.com/663096 > > If you want to run the code yourself, you'll need a Minecraft level and JNBT, > which is not on Maven. > JNBT: http://jnbt.sourceforge.net/ > The level used in the blogpost: http://dl.dropbox.com/u/10094764/World2.zip Can you check GC activity in the clojure version? I once ran into an issue where Python was running rings around an Eiffel version (compiled down to native code - no VM need apply). This looks similar to what you have, in that I built a large data structure, and then started groveling over it. Turned out that Eiffel was doing a mark-and-sweep GC, which was spending all of it's time marking and sweeping the large static data structure, whereas python doing a reference count GC didn't. Given that I know nothing about Java GCs, this is just a WAG. Come to think of it, how about trying to run the program Jython? That should have the same GC issues. If it's some similar environmental problem, that would show up there as well. <mike -- Mike Meyer <m...@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org -- 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