On 16/09/2020 12:22 pm, Pablo Galindo Salgado wrote:
> Don't we need to do all of this in the _ast module, already? > We already have an AST composed of Python objects
We have AST of Python objects, but the python versions are not used internally, especially in the parser, where they are created. The parser and the compiler currently use exclusively the C versions of the nodes. Changing the parser to use Python versions and especially not to use the arena allocator can complicate the parser substantially, and destroying the resulting tree can be expensive (as destroying a deep tree composed of Python objects currently is).
Would it complicate the parser much to allocate memory using a different allocator? It's just a function call, presumably.
As for performance, we don't know how much difference it will make until we try. Deallocation doesn't have to be recursive.