parralel downloads

castironpi at gmail.com castironpi at gmail.com
Sun Mar 9 20:48:03 EDT 2008


> > That's it.  Far easier than threads.

I'll order a 'easyness' metric from the warehouse.  Of course,
resources are parameters to the metric, such as facility given lots of
time, facility given lots of libraries, facility given hot shots, &c.

> Easier? If you omit all the relevant details, yes, looks easy. For  
>
> def downloadfile(url, fn):
>    s = create socket for url
>    f = open filename for writing
>    shutil.copyfileobj(s.makefile(), f)
>
> for each url, filename to retrieve:
[ threadlist.addandstart( threading.Thread(target=downloadfile,
args=(url,filename)) ) ]
>
[ threadlist.joineach() ]

> Of course, don't try to download a million files at the same time -  
> neither a million sockets nor a million threads would work.

Dammit!  Then what's my million-core machine for?  If architectures
"have reached the point of diminishing returns" ( off py.ideas ), then
what's the PoDR for numbers of threads per core?

Answer: One.  Just write data structures and don't swap context.  But
when do you want it by?  What is the PoDR for amount of effort per
clock cycle saved?  Get a Frank and a Brit and ask them what language
is easiest to speak.

(Answer: Math.  Har *plonk*.)



More information about the Python-list mailing list