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
map: no in-place append — merge + to_owned makes an array accumulated over a loop O(n²) #374
There is no way to append to an array in place. The idiom is a map mapping {"path": "data.log", "logic": {"merge": [{"var": "data.log"}, [ … ]]}}, and that is O(n) twice over per append: merge builds the whole new array in the arena, then the mapping result is deep-cloned with to_owned() (dataflow-rs 3.14.0 functions/map.rs:366) and the old array dropped. An array accumulated over a 1000-sweep loop is O(n²).
The same shape shows up inside a single evaluation: reduce with merge(accumulator, [x]) copies the accumulator every step, and merge is charged one op, so ops_budget does not see the quadratic cost.
Workarounds today
Batching (append to a small buffer, fold into the log every K sweeps) cuts the merge cost by K but not the O(n) arena copy the log costs every step (#371).
Proposal
A write mode on map mappings: {"path": "data.log", "append": <logic>} (or "mode": "append"), pushing the evaluated value (or extending with an array) onto the existing array in place, with no to_owned of the whole.
Fixed on branch fix/issues-369-377 (not yet pushed; it lands after PR #368) via dataflow-rs 3.15 (GoPlasmatic/dataflow-rs#69): a mapping takes "mode": "append" or "extend" and pushes onto the array in place, copying only the entry. Upstream measured a 1000-sweep log loop at 77 ms with merge vs 16 ms with append. Orion documents it on the map reference, and the clippy analysis treats an appending mapping as reading its target so the overwrite rules don't misfire. The ops_budget half (merge charged one op) is fixed by datalogic-rs 5.7 (GoPlasmatic/datalogic-rs#77).
Activity
codetiger commentedon Oct 1, 2026
Fixed on branch
fix/issues-369-377(not yet pushed; it lands after PR #368) via dataflow-rs 3.15 (GoPlasmatic/dataflow-rs#69): a mapping takes"mode": "append"or"extend"and pushes onto the array in place, copying only the entry. Upstream measured a 1000-sweep log loop at 77 ms withmergevs 16 ms withappend. Orion documents it on themapreference, and the clippy analysis treats an appending mapping as reading its target so the overwrite rules don't misfire. Theops_budgethalf (mergecharged one op) is fixed by datalogic-rs 5.7 (GoPlasmatic/datalogic-rs#77).chore(deps): dataflow-rs 3.15, datalogic-rs 5.7.1, datavalue-rs 0.3.1…