summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2017-12-11 11:20:16 -0600
committerNicolas Williams <nico@cryptonector.com>2017-12-11 11:20:16 -0600
commit9a4576e7567dd38b91f28592b47eb6dafe0c4332 (patch)
tree3f825020433fd48aafd9d424f1095abe099a9abf /tests
parentb5560d8420d330c4f90b3282c028bba476b01c1c (diff)
Revert "reduce: handle empty updates (fix #1313)"
This reverts commit e24af3c78e78a3aab05a2800d825d56f1d842b1b. While the semantics are desirable, there is no way to implement them efficiently. The reason is that in order to handle backtracking (empty) from the state update expression, we have to retain a reference to the reduction state value in order to restore it upon backtracking. Retaining a reference to the reduction state kills performance by causing lots of additional memory allocations and garbage because the input to the update expression will always have at least two references, thus no changes to it can be done in-place, and all changes end up being CoW changes. Avoiding this is the very reason for the LOADVN instruction (leaving `null` in the variable loaded from).
Diffstat (limited to 'tests')
-rw-r--r--tests/jq.test5
1 files changed, 0 insertions, 5 deletions
diff --git a/tests/jq.test b/tests/jq.test
index 12d2b4db..8771ba65 100644
--- a/tests/jq.test
+++ b/tests/jq.test
@@ -705,11 +705,6 @@ reduce [[1,2,10], [3,4,10]][] as [$i,$j] (0; . + $i * $j)
null
14
-# Test fix for #1313 (reduce should handle empty updates)
-reduce range(5) as $n ([]; select($n%2 == 1) | . + [$n])
-null
-[1,3]
-
# This, while useless, should still compile.
reduce . as $n (.; .)
null