You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(stdlib): parse string.format flags into bitmask, integer specifier #309
string.format per-specifier paths re-scan the flags binary with String.contains? on every specifier site, and dispatch on the conversion
character as a one-byte binary (e.g. \"d\") rather than an integer (e.g. ?d). Luerl precomputes a bitmask and dispatches on \$d
(deps/luerl/src/luerl_lib_string_format.erl:72-156), which is faster under
BEAM pattern matching.
Change
lib/lua/vm/stdlib/string.ex — apply_format_spec/2 at line 413 and the
parser that produces {flags, width, precision, specifier} tuples.
Parse flags into a small tuple of booleans (or single integer mask)
once at parse time.
Store the conversion char as ?d/?f/… (integer) rather than a binary.
Pure internal refactor — observable output unchanged.
Verification
mix test test/lua/vm/stdlib/string_test.exs
Full mix test
mix run benchmarks/string_format.exs
Expected
~10 % of the spec-heavy gap. Stack with T4/T5 for the full close.
Activity