Re: Multi-CPU on Mac Not Exploited?
On Tue, Jan 27, 2009 at 3:04 AM, Keith Bennett keithrbenn...@gmail.com wrote: All - I tried testing the code at http://clojure.org/Refs to see what the benefit of multicore processing would be. To my surprise, the my-pmap function took *more* time, not less, than the map function. Whereas the times listed in the article were approximately 3.1 and 1.7 seconds, on my MacBookPro 2.33 GHz Intel Core 2 Duo laptop, my times were 14.9 and 15.1 seconds. What is the correct interpretation of these results? Does one need more than 2 CPU's to see a benefit? Or is the Mac JVM only using one CPU instead of two? Or...? ...and is there something wrong with my setup that both took so long? It might simply mean that the raw single-thread performance of your CPU in this case is cheaper than the cost of the bookkeeping involved in the parallelization of the algorithm. You might see better results if you try playing with the size of the invocations to (partial ack 3), maybe something like; (time (reduce + (my-pmap (partial ack 5) (replicate 1000 10 I kept blowing my stack when trying higher numbers like this so I'm not sure if you'll see this or not. On my system I did see that the parallel version was faster for the invocation shown on the http://clojure.org/Refs page, however if I reduced the size of the computation then the single-thread map began to win: user= (time (reduce + (map (partial ack 1) (replicate 1000 2 Elapsed time: 1.419 msecs 4000 user= (time (reduce + (my-pmap (partial ack 1) (replicate 1000 2 Elapsed time: 35.599 msecs 4000 /mike. --~--~-~--~~~---~--~~ 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 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 -~--~~~~--~~--~--~---
Re: Multi-CPU on Mac Not Exploited?
java -server is not the default on Macs. It makes a huge difference for Clojure. % java -jar clojure.jar Clojure user= (time (reduce #(+ %1 %2 (if (odd? %1) -1 0)) (range 1000))) Elapsed time: 11793.18 msecs 499001 % java -server -jar clojure.jar Clojure user= (time (reduce #(+ %1 %2 (if (odd? %1) -1 0)) (range 1000))) Elapsed time: 6757.651 msecs 499001 The rough rule I've noticed is that the more complicated the Clojure code, the bigger the advantage -client has over -server. On Jan 27, 3:04 am, Keith Bennett keithrbenn...@gmail.com wrote: All - I tried testing the code athttp://clojure.org/Refsto see what the benefit of multicore processing would be. To my surprise, the my-pmap function took *more* time, not less, than the map function. Whereas the times listed in the article were approximately 3.1 and 1.7 seconds, on my MacBookPro 2.33 GHz Intel Core 2 Duo laptop, my times were 14.9 and 15.1 seconds. What is the correct interpretation of these results? Does one need more than 2 CPU's to see a benefit? Or is the Mac JVM only using one CPU instead of two? Or...? ...and is there something wrong with my setup that both took so long? Thanks for any enlightenment. - Keith Bennett --~--~-~--~~~---~--~~ 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 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 -~--~~~~--~~--~--~---
Re: Multi-CPU on Mac Not Exploited?
hmm... I'm confused. From the numbers in your example it looks like server has an advantage by a factor of about 2x. But in your text you say that the client version has an advantage with complicated code. What am I missing? Does one JVM have the advantage in one situation and one in others? Hank On Tue, Jan 27, 2009 at 3:20 PM, dreish dresweng...@dreish.org wrote: java -server is not the default on Macs. It makes a huge difference for Clojure. % java -jar clojure.jar Clojure user= (time (reduce #(+ %1 %2 (if (odd? %1) -1 0)) (range 1000))) Elapsed time: 11793.18 msecs 499001 % java -server -jar clojure.jar Clojure user= (time (reduce #(+ %1 %2 (if (odd? %1) -1 0)) (range 1000))) Elapsed time: 6757.651 msecs 499001 The rough rule I've noticed is that the more complicated the Clojure code, the bigger the advantage -client has over -server. On Jan 27, 3:04 am, Keith Bennett keithrbenn...@gmail.com wrote: All - I tried testing the code athttp://clojure.org/Refsto see what the benefit of multicore processing would be. To my surprise, the my-pmap function took *more* time, not less, than the map function. Whereas the times listed in the article were approximately 3.1 and 1.7 seconds, on my MacBookPro 2.33 GHz Intel Core 2 Duo laptop, my times were 14.9 and 15.1 seconds. What is the correct interpretation of these results? Does one need more than 2 CPU's to see a benefit? Or is the Mac JVM only using one CPU instead of two? Or...? ...and is there something wrong with my setup that both took so long? Thanks for any enlightenment. - Keith Bennett -- blog: whydoeseverythingsuck.com --~--~-~--~~~---~--~~ 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 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 -~--~~~~--~~--~--~---
Re: Multi-CPU on Mac Not Exploited?
On Tue, Jan 27, 2009 at 9:34 PM, hank williams hank...@gmail.com wrote: hmm... I'm confused. From the numbers in your example it looks like server has an advantage by a factor of about 2x. But in your text you say that the client version has an advantage with complicated code. What am I missing? Does one JVM have the advantage in one situation and one in others? He most likely had them switched around by mistake in the text. The -server VM is much better at optimizing the assembly it produces, but at the cost of increased memory usage and a longer startup time. Java benchmarks are typically run with the -server VM, though the -client VM is sometimes used when comparing startup times and memory usage with other non-Java VMs. Hank On Tue, Jan 27, 2009 at 3:20 PM, dreish dresweng...@dreish.org wrote: java -server is not the default on Macs. It makes a huge difference for Clojure. % java -jar clojure.jar Clojure user= (time (reduce #(+ %1 %2 (if (odd? %1) -1 0)) (range 1000))) Elapsed time: 11793.18 msecs 499001 % java -server -jar clojure.jar Clojure user= (time (reduce #(+ %1 %2 (if (odd? %1) -1 0)) (range 1000))) Elapsed time: 6757.651 msecs 499001 The rough rule I've noticed is that the more complicated the Clojure code, the bigger the advantage -client has over -server. On Jan 27, 3:04 am, Keith Bennett keithrbenn...@gmail.com wrote: All - I tried testing the code athttp://clojure.org/Refsto see what the benefit of multicore processing would be. To my surprise, the my-pmap function took *more* time, not less, than the map function. Whereas the times listed in the article were approximately 3.1 and 1.7 seconds, on my MacBookPro 2.33 GHz Intel Core 2 Duo laptop, my times were 14.9 and 15.1 seconds. What is the correct interpretation of these results? Does one need more than 2 CPU's to see a benefit? Or is the Mac JVM only using one CPU instead of two? Or...? ...and is there something wrong with my setup that both took so long? Thanks for any enlightenment. - Keith Bennett -- blog: whydoeseverythingsuck.com -- Venlig hilsen / Kind regards, Christian Vest Hansen. --~--~-~--~~~---~--~~ 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 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 -~--~~~~--~~--~--~---