Skip to content

perf-003: Skip env_get_entry snapshot on non-buffered path #228

Description

@python-processing-unit

Problem

\env_get_entry\ always allocates a thread-local \EnvEntry\ snapshot and copies name + value into it. The snapshot is only needed when
s_buffer_active(). The non-buffered path (single-threaded, REPL, tests) pays \strdup\ + \�alue_copy\ + \�alue_alias\ for no reason.

Location: \src/env.c:720-742\

Proposed Fix

Return \env_get_entry_raw(env, name)\ directly when buffer is inactive. Audit call sites that hold the returned pointer across env mutations.

Status

Baseline still present — \env_entry_snap_alloc()\ is called at line 721 before the buffer check, so the non-buffered path still pays the snapshot cost.

Metadata

Metadata

Labels

interpreterRequires a code change in the interpreter.patchRequires a patch version change.performancePerformance improvement.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions