Skip to content

perf-006: digit_value_for_base should be a lookup table #231

Description

@python-processing-unit

Problem

Linear scan of base-64/58 alphabet for every digit in every numeric literal. Called once per digit; dominates lexer/parser numeric path.

Location: \src/parser.c:439-453, \src/builtins.c:680-689, \src/lexer.c:208-219\

Proposed Fix

Replace with 256-byte \uint8_t\ tables (\k_digit64_tbl, \k_digit58_tbl). Single array access, no loop. Consolidate parser and builtins copies into one shared helper.

Status

Baseline still present — \digit_value_for_base\ in \src/parser.c:439-453\ and \src/builtins.c:680-689\ still does linear \strchr-style scan. No lookup tables exist.

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