On Aug 22, 2010, at 17:48 , Belun wrote: > does clojure take advantage of my multicore processor ? if i write a > program (not using multiple threads) that is going to take 1 day in a > java environment, then will my program run 4 times faster on my 4 core > processor if i build it in clojure ? Hi Belun, the short answer is: no, yes and perhaps.
Now for the details: No: because, if you port the algorithm 1:1 from java to clojure it will take longer then 1 day, clojure still has a slight overhead to pure Java, Yes: If you rewrite your algorithm to clojure logic and leverage the concurrency features it provides it will be faster and clojure will use all your cores as good as it can. Note that the work you need to put into making it work on more cores in clojure is way less then in Java, depending on your case it can be as simple as adding a p to make map pmap. Perhaps: Since this is a very general question it can't really be answered, there are algorithms that can't be paralellized, in that case no language in the world will help you, there are others that are not efficiently paralellized in which case you might only see a slight improvement and then are those where you can perfectly put the work on 4 cores which means you will only need 1/4th of the time and if you're really lucky your clojure code is even more efficient then your Java code but in the end only you can answer your question :) Regards, Heinz -- 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