Skip to content

perf-007: Lazy map rehash on deletion #232

Description

@python-processing-unit

Problem

\map_rehash\ is called after every key deletion, allocating a new bucket array and walking all remaining entries. O(k × n) for k deletions.

Location: \src/value.c:645-668\

Proposed Fix

Lazy rehash — only shrink when \count < capacity / 4. Insert side already hashes on threshold; no change needed there.

Status

Baseline still present — \�alue_map_delete\ at \src/value.c:645-668\ unconditionally calls \map_rehash\ at line 666 on every deletion. No lazy threshold check.

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