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(vm): batch insert for :setlist instead of per-key Table.put #308
Table construction is 1.14× slower than luerl at n=100 (25.5µs vs 22.3µs
in benchmarks/table_ops.exs).
:setlist walks one key at a time through Table.put/3, paying the
seven-field %Table{} struct rebuild on every slot. Luerl's :array:set
amortises this to a single mutation.
Change
lib/lua/vm/dispatcher.ex:1412-1415 — set_list_into_table/6: accumulate {idx, val} pairs and call Table.replace_data/2 once at the end of the
run instead of Table.put/3 per slot.
Mirror the change in the executor's :setlist handler (lib/lua/vm/executor.ex).
Helper Table.replace_data/2 already exists in lib/lua/vm/table.ex.
Verification
mix test (full suite stays green)
mix test test/lua/vm/stdlib/table_test.exs
mix run benchmarks/table_ops.exs
Expected
Closes most of the 1.14× build gap. Target: ≤ 1.05× luerl.
Activity