CPython Makes Python Calls Fast with Vectorcall
Vectorcall replaces the per-call tuple and dict with a plain C array plus a kwnames tuple, and the ARGUMENTS_OFFSET flag makes bound methods allocation-free.
All posts published on this site.
Everything published here, newest first.
Vectorcall replaces the per-call tuple and dict with a plain C array plus a kwnames tuple, and the ARGUMENTS_OFFSET flag makes bound methods allocation-free.
CPython keeps a global table of immortal static strings and a per-interpreter dict of mortal runtime ones, so equal strings can be compared by pointer.
CPython’s pymalloc hands out objects up to 512 bytes from a free list inside a size-class pool, so the fast path is one array lookup, one comparison, and one pop.
Hot bytecode gets rewritten in place behind a version-tag guard: when the type or dict changes, the tag moves and the interpreter falls back to the generic path.