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): defer string.format width padding to iolist #310
string.format with width-flagged specifiers is 2.03× slower than luerl
(width-flagged, n=1000: 5.51ms vs 2.71ms in benchmarks/string_format.exs).
The literal-heavy fast path from PR #299 is now winning by 2.6×, so the
remaining work is in per-specifier width padding.
apply_width_flags/3 at lib/lua/vm/stdlib/string.ex:828 builds String.duplicate(pad_char, deficit) and concatenates with <>, producing a
fresh binary per specifier. Luerl returns [Padding, Bin] as iolist
(deps/luerl/src/luerl_lib_string_format.erl:303-319) and lets the final iolist_to_binary materialise everything at once.
Change
lib/lua/vm/stdlib/string.ex:828-859 plus its caller in format_string/3.
apply_width_flags returns iolist ([pad, str] / [str, pad]) instead
of a binary.
Activity
perf(stdlib): defer string.format width padding to iolist