Question about Python threads

Delaney, Timothy tdelaney at avaya.com
Mon Aug 26 23:43:25 EDT 2002


> From: Greg Ewing [mailto:see_reply_address at something.invalid]
> 
> Refcounts are by no means the only reason Python has
> a GIL. Even without refcounting, lack of a GIL would
> require locks around many other things, e.g. anything
> which mutates an object (inserting/deleting list
> items, etc.) Also object allocation, which I suspect
> Python does a lot more of than Java, since Java has
> unboxed ints/floats/etc.

Nah Greg - Java tends to do a lot more allocation. I base this on a few
observations:

1. Every time you want to use a collection class, you have to wrap
primitives in objects.

2. CPython interns the most-used integers and strings.

3. Java apps appear to use much more memory for the same task in most cases.

Admittedly, there is no scientific basis to any of the above, but you have
to admit it's compelling ;)

Tim Delaney




More information about the Python-list mailing list