Problem
TOKEN_NEWLINE from \n and ; each does safe_strdup(\n) — heap alloc + copy for a constant 1-byte string that is the most numerous token type.
Location: src/lexer.c:293-301
Proposed Fix
Share a static const char g_newline_literal[] = \n across both creation sites. token_free must not free static-owned literals. Coordinate with perf-004 for consistent ownership model.
Status
Baseline still present — src/lexer.c:294,299 still use safe_strdup(\n). No shared literal.
Problem
TOKEN_NEWLINEfrom\nand;each doessafe_strdup(\n)— heap alloc + copy for a constant 1-byte string that is the most numerous token type.Location:
src/lexer.c:293-301Proposed Fix
Share a
static const char g_newline_literal[] = \nacross both creation sites.token_freemust not free static-owned literals. Coordinate with perf-004 for consistent ownership model.Status
Baseline still present —
src/lexer.c:294,299still usesafe_strdup(\n). No shared literal.