0%

Value Passing Optimization (ledger grind)

Goal

LEDGER GRIND. PRIMARY early grind alongside S02. Make in-place mutation actually in-place (stop the O(n) make_mut copy on every xs[i]=v when refcount is 1 — the 100_doors hot path) and eliminate remaining avoidable Value::clone() on the call path. Each lever: tune -> micro-bench -> ledger cycle -> repeat. depends_on S01; independent of S02.

Work Items

  • GRIND: in-place xs[i]=v (ori_eval/src/methods/list.rs list_updated / ListData::set / backing.make_mut() — mutate in place when refcount==1, avoid the O(n) copy) -> micro-bench list-index-assign kernel + 100_doors -> ledger cycle -> repeat.
  • GRIND: argument clone elimination (ori_eval/src/exec/call/mod.rs bind_parameters_with_defaults — owned Vec move vs clone for about-to-be-consumed args; primitive Int/Float/Bool clone = memcpy; keep &[Value] borrowed fast paths where the caller retains the slice) -> micro-bench -> ledger cycle -> repeat.
  • GRIND: self-binding shared function handle (ori_eval/src/interpreter/function_call.rs func.clone() on Value::Function -> Arc-boxed FunctionValue metadata so recursive self-binding is O(1) reference clone vs Vec clone of params/can_defaults/capabilities) -> micro-bench recursive -> ledger cycle -> repeat.