global interpreter lock not working as it should

Martin v. Löwis loewis at informatik.hu-berlin.de
Wed Jul 31 10:59:40 EDT 2002


anton wilson <anton.wilson at camotion.com> writes:

> > Realtime?  Really?  So can you tell me what the upper-bound on the runtime
> > of
> >
> >     >>> x = 3
> >
> > on the hardware you're targeting?
[...]
> Good question. You have any reasons why we should not use python?

I can't comment on why you should or not should use Python, but it is
clear that, without further constraints, the statement above has
unclear performance characteristics. 

Specifically, if x already has a value assigned, that value is
DECREFed. Depending on whether this was the last reference to x (which
may be known not to happen), a deallocation of the old value of x may
happen.

If deallocation happens, time consumption depends on the type of the
old value of x: If it is an instance object with an __del__ (which it
may be guaranteed not to be), then this assignment can invoke
arbitrary byte code.

Furthermore, the assignment is really a dictionary write to some
globals dictionary; the time consumption of this dictionary access
depends on the number of entries in the dictionary so far
(potentially; it usually is only one key compare).

Regards,
Martin



More information about the Python-list mailing list