Skip to content

Commit 6c86b41

Browse files
committed
internal/core/adt: alternative algorithm for splitting trees
Introduce a different and simpler algorithm for splitting conjunct trees. See insertAndSkipConjuncts in conjunct.go for more details. Fixes #3601 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I00e5e3697c9b4456bf0cccd2d6b08e748a31b993 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1205364 Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Matthew Sackman <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
1 parent 4ae75f8 commit 6c86b41

16 files changed

+387
-491
lines changed

cue/testdata/cycle/023_reentrance.txtar

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Allocs: 70
6868
Retain: 0
6969

7070
Unifications: 62
71-
Conjuncts: 212
71+
Conjuncts: 224
7272
Disjuncts: 0
7373
-- out/evalalpha --
7474
Errors:
@@ -138,7 +138,7 @@ diff old new
138138
-Conjuncts: 464
139139
-Disjuncts: 268
140140
+Unifications: 62
141-
+Conjuncts: 212
141+
+Conjuncts: 224
142142
+Disjuncts: 0
143143
-- diff/-out/evalalpha<==>+out/eval --
144144
diff old new

cue/testdata/cycle/builtins.txtar

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Allocs: 193
136136
Retain: 0
137137

138138
Unifications: 167
139-
Conjuncts: 664
139+
Conjuncts: 657
140140
Disjuncts: 28
141141
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
142142
diff old new
@@ -158,7 +158,7 @@ diff old new
158158
-Conjuncts: 389
159159
-Disjuncts: 290
160160
+Unifications: 167
161-
+Conjuncts: 664
161+
+Conjuncts: 657
162162
+Disjuncts: 28
163163
-- out/eval/stats --
164164
Leaks: 12

cue/testdata/cycle/comprehension.txtar

+2-2
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ Allocs: 778
317317
Retain: 0
318318

319319
Unifications: 498
320-
Conjuncts: 3595
320+
Conjuncts: 2977
321321
Disjuncts: 196
322322
-- out/evalalpha --
323323
Errors:
@@ -958,7 +958,7 @@ diff old new
958958
-Conjuncts: 2525
959959
-Disjuncts: 1404
960960
+Unifications: 498
961-
+Conjuncts: 3595
961+
+Conjuncts: 2977
962962
+Disjuncts: 196
963963
-- out/eval/stats --
964964
Leaks: 50

cue/testdata/cycle/inline.txtar

+8-8
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,14 @@ inline: acrossFields: ok1: {
153153
}
154154
}
155155
-- out/evalalpha/stats --
156-
Leaks: 113
156+
Leaks: 137
157157
Freed: 0
158158
Reused: 0
159-
Allocs: 113
159+
Allocs: 137
160160
Retain: 0
161161

162-
Unifications: 109
163-
Conjuncts: 588
162+
Unifications: 101
163+
Conjuncts: 509
164164
Disjuncts: 0
165165
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
166166
diff old new
@@ -172,17 +172,17 @@ diff old new
172172
-Reused: 136
173173
-Allocs: 252
174174
-Retain: 834
175-
+Leaks: 113
175+
+Leaks: 137
176176
+Freed: 0
177177
+Reused: 0
178-
+Allocs: 113
178+
+Allocs: 137
179179
+Retain: 0
180180

181181
-Unifications: 388
182182
-Conjuncts: 1307
183183
-Disjuncts: 707
184-
+Unifications: 109
185-
+Conjuncts: 588
184+
+Unifications: 101
185+
+Conjuncts: 509
186186
+Disjuncts: 0
187187
-- out/eval/stats --
188188
Leaks: 247

cue/testdata/cycle/inline_non_recursive.txtar

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Allocs: 228
101101
Retain: 0
102102

103103
Unifications: 183
104-
Conjuncts: 1009
104+
Conjuncts: 824
105105
Disjuncts: 0
106106
-- out/evalalpha --
107107
Errors:
@@ -249,7 +249,7 @@ diff old new
249249
-Conjuncts: 2813
250250
-Disjuncts: 1485
251251
+Unifications: 183
252-
+Conjuncts: 1009
252+
+Conjuncts: 824
253253
+Disjuncts: 0
254254
-- diff/-out/evalalpha<==>+out/eval --
255255
diff old new

cue/testdata/cycle/issue990.txtar

+12-12
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ This seems to be the result of incorrect handling of disjunctions.
8383
-- diff/todo/p3 --
8484
Reordering
8585
-- out/evalalpha/stats --
86-
Leaks: 633
87-
Freed: 49
88-
Reused: 49
89-
Allocs: 633
86+
Leaks: 605
87+
Freed: 45
88+
Reused: 45
89+
Allocs: 605
9090
Retain: 0
9191

9292
Unifications: 175
93-
Conjuncts: 2747
94-
Disjuncts: 100
93+
Conjuncts: 2668
94+
Disjuncts: 92
9595
-- out/evalalpha --
9696
Errors:
9797
out.subs: structural cycle:
@@ -258,18 +258,18 @@ diff old new
258258
-Reused: 3200
259259
-Allocs: 25
260260
-Retain: 26
261-
+Leaks: 633
262-
+Freed: 49
263-
+Reused: 49
264-
+Allocs: 633
261+
+Leaks: 605
262+
+Freed: 45
263+
+Reused: 45
264+
+Allocs: 605
265265
+Retain: 0
266266

267267
-Unifications: 2577
268268
-Conjuncts: 12017
269269
-Disjuncts: 3244
270270
+Unifications: 175
271-
+Conjuncts: 2747
272-
+Disjuncts: 100
271+
+Conjuncts: 2668
272+
+Disjuncts: 92
273273
-- diff/-out/evalalpha<==>+out/eval --
274274
diff old new
275275
--- old

0 commit comments

Comments
 (0)