[Python-ideas] Preallocated tuples and dicts for function calls

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Mar 8 20:02:53 EST 2019


Martin Bammer wrote:

> what about the idea that the interpreter preallocates and preinitializes 
> the tuples and dicts for function calls where possible when loading a module?

This would not be thread-safe. Locking would be needed around uses
of the preallocated objects, and that might take away some or all
of the gain. It would also introduce unexpected interactions
between threads.

-- 
Greg


More information about the Python-ideas mailing list