New submission from Mark Shannon <m...@hotpy.org>:

In https://bugs.python.org/issue44032 we moved most of the data in the frame 
stack, that is the locals, stack, and "specials" (globals, builtins, code etc), 
from the heap allocated stack to a (mostly) contiguous array in memory.
That offered some speed up due to better cache locality, and faster allocation 
of frame objects (they are now fixed size so can use a simple freelist).

However, data is still split between the stack allocated frame and the heap 
allocated frame.

We should move the remaining data to the stack and only allocate heap objects 
lazily when needed for tracebacks and the like. This should improve performance 
further by removing the vast majority of heap frame allocations and further 
improving locality of reference.

Not only does this have immediate performance benefits, it also paves the way 
for even better Python-to-Python calls by allowing stack frames to overlap and 
pass arguments with the minimal amount of copying and INCREF/DECREF pairs.

----------
assignee: Mark.Shannon
components: Interpreter Core
messages: 397196
nosy: Mark.Shannon, gvanrossum, pablogsal
priority: normal
severity: normal
status: open
title: Create frame objects lazily when needed
type: performance
versions: Python 3.11

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44590>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to