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): batch write-back in table.sort plain fast path #307
table.sort on plain (metatable-less) tables is 1.44× slower than luerl
at n=100 (46.1µs vs 31.9µs in benchmarks/table_ops.exs).
The plain-table sort fast path (PR #299) reads + sorts efficiently, but the write-back loop still calls Table.put/3 per index, which rebuilds the
seven-field %Table{} struct on every iteration and updates state.tables.
Luerl's array:from_list writes the sorted slice back in a single step
(deps/luerl/src/luerl_lib_table.erl:363-373).
with a single map build and one Table.replace_data/2 call. replace_data
already exists. Sort doesn't touch order/dead-key state, so the simpler
replacement is safe.
Verification
mix test (full suite stays green)
mix test test/lua/vm/stdlib/table_test.exs
mix run benchmarks/table_ops.exs — record new ratio in the PR body
Expected
Closes ~30 % of the 1.44× sort gap. Target: ≤ 1.10× luerl.
Activity