Re: dump html with clojure

2010-05-13 Thread Eric Schulte
Hi Nurullah, Nurullah Akkaya writes: > Yes but AFAIK you only get availableProcessors + 2 threads with pmap That's good to know, is this documented somewhere? > > which is fine when the task is CPU bound but for downloading web pages > most of the time will be lost at waiting for I/O so havin

Re: dump html with clojure

2010-05-13 Thread Michael Gardner
On May 13, 2010, at 7:52 AM, Nurullah Akkaya wrote: > Yes but AFAIK you only get availableProcessors + 2 threads with pmap > which is fine when the task is CPU bound but for downloading web pages > most of the time will be lost at waiting for I/O so having more > threads would speed things up. Se

Re: dump html with clojure

2010-05-13 Thread Nurullah Akkaya
Yes but AFAIK you only get availableProcessors + 2 threads with pmap which is fine when the task is CPU bound but for downloading web pages most of the time will be lost at waiting for I/O so having more threads would speed things up. Regards... -- Nurullah Akkaya http://nakkaya.com On Thu, May

Re: dump html with clojure

2010-05-13 Thread Eric Schulte
Wouldn't this be simpler with pmap, e.g. http://gist.github.com/399269 although to be honest I don't really know how the automatically parallelized clojure functions decide how many threads to use. Is the JVM smart enough to only create as many system-level threads as make sense on my hardware?

Re: dump html with clojure

2010-05-12 Thread Nurullah Akkaya
Since you don't need coordination or keep some sort of state, IMHO future is better suited for this. Following gist is my take, it first reads the file that contains the list of URLs to be downloaded then splits the list into number of thread pieces. Each future object gets a piece of the list and