Files
jq/tests
gibkim d334411b9f Fix assignment operators copying their whole input since #3633 (#3706)
Since #3633, `reduce` pushes a copy of its input before the `FORK`,
and that copy stays in a slot saved by the `FORK` until the loop ends.
When `init` holds `.`, as in `_assign` and `_modify`, the copy is a
second reference to the accumulator, so the first `setpath` in each
reduction copies the whole input. Building an object key by key with
`.[$k] = $v`, `|=` or `+=` became quadratic again, the slowdown #618
reported and `DUPN` was added to fix.

Store the input in a variable before the `FORK` and load it with
`LOADVN` at the start of the loop instead. The slots saved by the
`FORK` no longer refer to the input while the body runs, and the slot
below `init` is still not popped destructively, so #3227 stays fixed.
2026-12-03 15:33:36 +09:00
..
…
…
…
…
…
…
…