[FRPythoneers] Are lists threadsafe?
Alex Martelli
aleaxit at yahoo.com
Tue Mar 9 00:10:56 MST 2004
On 2004 Mar 09, at 02:19, Cameron Laird wrote:
...
> 1. I'm a big proponent of that wisdom: I frequently
> advocate concurrency-through-event-orientation,
> and do indeed claim it both more scalable and
> easier.
Sure, I entirely agree with that. These days I'm developing web
applications on top of Twisted (and nevow) and find yet another total
confirmation of that.
> 2. The quoted package often gets me to giggling. To
> observe that "adding threads ... is often not a
> successful strategy" is, it strikes me, uncharac-
> teristically coy of the *Cookbook*. I'll be expli-
> cit: introduction of threads can sometimes--perhaps
> even frequently--SLOW performance, not just fail to
> improve it.
What you say is true, particularly when threading is "just thrown into
the mix" without careful architecting. However, there is a small but
non-empty "niche" of programs that cannot entirely rely on event-driven
async I/O and can get benefit from a judicious application of
threading. P. 404 in the Nutshell, the very last paragraph of the
chapter on optimization, mentions the general conditions (not
thoroughly enough -- I should have also mentioned multi-processor boxes
and heavy computations performed by C-coded routines that run without
holding the GIL as one of the typical pre-reqs for such rearchitecting
to provide performance enhancements).
Alex
More information about the FRPythoneers
mailing list