tag:blogger.com,1999:blog-9162348804594118096.post7617802250722731447..comments2013-02-06T12:02:57.521+01:00Comments on Earthly Powers: Lazy Mandelbrots in ClojurePaul Sandozhttp://www.blogger.com/profile/01376906263497983192noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-9162348804594118096.post-79739490447701611172011-11-03T14:55:29.030+01:002011-11-03T14:55:29.030+01:00@TCP: Thanks for the pointer! I dunno whether Grap...@TCP: Thanks for the pointer! I dunno whether Graphics/2D is thread safe and whether there is some contention when setting the color and rendering the pixel (the plot function is not thread safe). That may explain why you did not get a larger speed up, that and perhaps the coordination overhead of pmap is high.Paul Sandozhttps://www.blogger.com/profile/01376906263497983192noreply@blogger.comtag:blogger.com,1999:blog-9162348804594118096.post-80462270976544569132011-11-03T14:15:09.096+01:002011-11-03T14:15:09.096+01:00You might be interested in this other parallel ver...You might be interested in this other parallel version:<br /><a href="http://clojure.lang.dk/?p=66" rel="nofollow">simple mandelbot</a>Anonymoushttps://www.blogger.com/profile/13075337864712215296noreply@blogger.comtag:blogger.com,1999:blog-9162348804594118096.post-47100448332956191682011-11-03T09:41:11.805+01:002011-11-03T09:41:11.805+01:00@pauldoo: Thanks! i think that explains the timing...@pauldoo: Thanks! i think that explains the timing results. <br /><br /> $ sysctl -a | egrep "\.core_count|\.thread_count" <br />machdep.cpu.core_count: 2<br />machdep.cpu.thread_count: 4<br /><br />The performance increase between 1 and 2 threads is much larger than between 2 and 4 threads.Paul Sandozhttps://www.blogger.com/profile/01376906263497983192noreply@blogger.comtag:blogger.com,1999:blog-9162348804594118096.post-10507063531144234822011-11-03T09:22:18.462+01:002011-11-03T09:22:18.462+01:00Nice intro to Clojure sequences. :)
The 2 versus ...Nice intro to Clojure sequences. :)<br /><br />The 2 versus 4 cpu count will likely be due to HyperThreading. You will likely have two physical cores, each capable of running two threads simultaneously (known on Intel CPUs as HyperThreading). Look for "machdep.cpu.core_count" vs "machdep.cpu.thread_count" in sysctl.<br /><br />For certain tasks running >1 thread per physical core can be beneficial. The idea is that per-thread performance will drop (as now 2 threads are sharing a core), but the aggregate system performance will go up. If you saw the performance plateau (or increase only modestly) once you passed 2 threads, then this could be the explanation.<br /><br />http://en.wikipedia.org/wiki/Hyper-threadingpauldoohttps://www.blogger.com/profile/18033335919472464402noreply@blogger.com