Skip to content

Commit 2862a10

Browse files
committed
internal/core/adt: more eagerly update stats in tests
To minimize diffs, we normally only update stats if there are significant changes. For diffs that already exist, however, we want to update these stats more eagerly. We also add an option to force the updating of counters using CUE_UPDATE=force. This will especially be useful to trigger individual files that are otherwise not included. Using this option for all files would cause too many not so useful difss to be added. Note that a lot of CloseIDElems have changed. This is probably the result of recent optimizations to the closedness algorithm, where the diffs of normal operation were too small to trigger an update. Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I350c9521d3cc6e6c7eeba160de20194ef50bbc19 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1217932 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Daniel Martí <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
1 parent 5100525 commit 2862a10

21 files changed

+111
-87
lines changed

cue/testdata/benchmarks/issue3633.txtar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Unifications: 667
1010
Conjuncts: 2680
1111
Disjuncts: 1955
1212

13-
CloseIDElems: 2155
13+
CloseIDElems: 884
1414
NumCloseIDs: 53
1515
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
1616
diff old new
@@ -34,7 +34,7 @@ diff old new
3434
+Conjuncts: 2680
3535
+Disjuncts: 1955
3636
+
37-
+CloseIDElems: 2155
37+
+CloseIDElems: 884
3838
+NumCloseIDs: 53
3939
-- out/eval/stats --
4040
Leaks: 0

cue/testdata/benchmarks/issue572.txtar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Unifications: 3001
2020
Conjuncts: 7498
2121
Disjuncts: 0
2222

23-
CloseIDElems: 4500
23+
CloseIDElems: 3
2424
NumCloseIDs: 4499
2525
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
2626
diff old new
@@ -45,7 +45,7 @@ diff old new
4545
-NumCloseIDs: 1
4646
+Disjuncts: 0
4747
+
48-
+CloseIDElems: 4500
48+
+CloseIDElems: 3
4949
+NumCloseIDs: 4499
5050
-- out/eval/stats --
5151
Leaks: 0

cue/testdata/benchmarks/sharefg.txtar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Unifications: 452
120120
Conjuncts: 845
121121
Disjuncts: 0
122122

123-
CloseIDElems: 4039
123+
CloseIDElems: 0
124124
NumCloseIDs: 238
125125
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
126126
diff old new
@@ -144,7 +144,7 @@ diff old new
144144
+Conjuncts: 845
145145
+Disjuncts: 0
146146
+
147-
+CloseIDElems: 4039
147+
+CloseIDElems: 0
148148
+NumCloseIDs: 238
149149
-- out/eval/stats --
150150
Leaks: 112

cue/testdata/builtins/closed.txtar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Unifications: 230
102102
Conjuncts: 360
103103
Disjuncts: 12
104104

105-
CloseIDElems: 1415
105+
CloseIDElems: 579
106106
NumCloseIDs: 106
107107
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
108108
diff old new
@@ -128,7 +128,7 @@ diff old new
128128
+Conjuncts: 360
129129
+Disjuncts: 12
130130
+
131-
+CloseIDElems: 1415
131+
+CloseIDElems: 579
132132
+NumCloseIDs: 106
133133
-- out/eval/stats --
134134
Leaks: 61

cue/testdata/builtins/list/sort.txtar

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,42 @@ import "list"
33

44
a: list.Sort([2, 3, 1, 4], {x: _, y: _, less: x < y})
55
-- out/evalalpha/stats --
6-
Leaks: 11
6+
Leaks: 15
77
Freed: 0
88
Reused: 0
9-
Allocs: 11
9+
Allocs: 15
1010
Retain: 0
1111

12-
Unifications: 11
13-
Conjuncts: 11
12+
Unifications: 15
13+
Conjuncts: 20
1414
Disjuncts: 0
15+
16+
CloseIDElems: 0
17+
NumCloseIDs: 5
1518
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
1619
diff old new
1720
--- old
1821
+++ new
19-
@@ -1,9 +1,9 @@
22+
@@ -1,9 +1,12 @@
2023
-Leaks: 0
2124
-Freed: 15
2225
-Reused: 10
2326
-Allocs: 5
2427
-Retain: 2
25-
+Leaks: 11
28+
+Leaks: 15
2629
+Freed: 0
2730
+Reused: 0
28-
+Allocs: 11
31+
+Allocs: 15
2932
+Retain: 0
3033

31-
-Unifications: 15
34+
Unifications: 15
3235
-Conjuncts: 24
3336
-Disjuncts: 17
34-
+Unifications: 11
35-
+Conjuncts: 11
37+
+Conjuncts: 20
3638
+Disjuncts: 0
39+
+
40+
+CloseIDElems: 0
41+
+NumCloseIDs: 5
3742
-- out/eval/stats --
3843
Leaks: 0
3944
Freed: 15

cue/testdata/builtins/matchn.txtar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ Unifications: 931
356356
Conjuncts: 1511
357357
Disjuncts: 16
358358

359-
CloseIDElems: 1170
359+
CloseIDElems: 383
360360
NumCloseIDs: 483
361361
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
362362
diff old new
@@ -382,7 +382,7 @@ diff old new
382382
+Conjuncts: 1511
383383
+Disjuncts: 16
384384
+
385-
+CloseIDElems: 1170
385+
+CloseIDElems: 383
386386
+NumCloseIDs: 483
387387
-- out/eval/stats --
388388
Leaks: 52

cue/testdata/comprehensions/issue1732.txtar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Unifications: 94
132132
Conjuncts: 172
133133
Disjuncts: 6
134134

135-
CloseIDElems: 1121
135+
CloseIDElems: 638
136136
NumCloseIDs: 38
137137
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
138138
diff old new
@@ -161,7 +161,7 @@ diff old new
161161
+Conjuncts: 172
162162
+Disjuncts: 6
163163
+
164-
+CloseIDElems: 1121
164+
+CloseIDElems: 638
165165
+NumCloseIDs: 38
166166
-- out/eval/stats --
167167
Leaks: 3

cue/testdata/comprehensions/nested2.txtar

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ Unifications: 50
118118
Conjuncts: 92
119119
Disjuncts: 0
120120

121-
CloseIDElems: 1260
122-
NumCloseIDs: 78
121+
CloseIDElems: 82
122+
NumCloseIDs: 39
123123
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
124124
diff old new
125125
--- old
@@ -136,7 +136,7 @@ diff old new
136136
-Disjuncts: 57
137137
-
138138
-CloseIDElems: 0
139-
-NumCloseIDs: 27
139+
-NumCloseIDs: 10
140140
+Leaks: 50
141141
+Freed: 0
142142
+Reused: 0
@@ -147,8 +147,8 @@ diff old new
147147
+Conjuncts: 92
148148
+Disjuncts: 0
149149
+
150-
+CloseIDElems: 1260
151-
+NumCloseIDs: 78
150+
+CloseIDElems: 82
151+
+NumCloseIDs: 39
152152
-- out/eval/stats --
153153
Leaks: 2
154154
Freed: 50

cue/testdata/cycle/023_reentrance.txtar

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ fib12: (fib & {n: 12}).out // Error
6161
}).out
6262
}
6363
-- out/evalalpha/stats --
64-
Leaks: 78
64+
Leaks: 110
6565
Freed: 0
6666
Reused: 0
67-
Allocs: 78
67+
Allocs: 110
6868
Retain: 0
6969

70-
Unifications: 62
71-
Conjuncts: 140
70+
Unifications: 100
71+
Conjuncts: 306
7272
Disjuncts: 0
7373

74-
CloseIDElems: 0
75-
NumCloseIDs: 41
74+
CloseIDElems: 95
75+
NumCloseIDs: 117
7676
-- out/evalalpha --
7777
Errors:
7878
structural cycle:
@@ -130,7 +130,7 @@ Result:
130130
diff old new
131131
--- old
132132
+++ new
133-
@@ -1,9 +1,12 @@
133+
@@ -1,12 +1,12 @@
134134
-Leaks: 16
135135
-Freed: 180
136136
-Reused: 170
@@ -140,18 +140,21 @@ diff old new
140140
-Unifications: 196
141141
-Conjuncts: 464
142142
-Disjuncts: 268
143-
+Leaks: 78
143+
-
144+
-CloseIDElems: 0
145+
-NumCloseIDs: 46
146+
+Leaks: 110
144147
+Freed: 0
145148
+Reused: 0
146-
+Allocs: 78
149+
+Allocs: 110
147150
+Retain: 0
148151
+
149-
+Unifications: 62
150-
+Conjuncts: 140
152+
+Unifications: 100
153+
+Conjuncts: 306
151154
+Disjuncts: 0
152155
+
153-
+CloseIDElems: 0
154-
+NumCloseIDs: 41
156+
+CloseIDElems: 95
157+
+NumCloseIDs: 117
155158
-- diff/-out/evalalpha<==>+out/eval --
156159
diff old new
157160
--- old

cue/testdata/cycle/evaluate.txtar

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -123,44 +123,47 @@ issue3978: {
123123
}
124124
}
125125
-- out/evalalpha/stats --
126-
Leaks: 119
126+
Leaks: 126
127127
Freed: 0
128128
Reused: 0
129-
Allocs: 119
129+
Allocs: 126
130130
Retain: 0
131131

132-
Unifications: 99
133-
Conjuncts: 133
132+
Unifications: 106
133+
Conjuncts: 153
134134
Disjuncts: 5
135135

136-
CloseIDElems: 11
137-
NumCloseIDs: 26
136+
CloseIDElems: 7
137+
NumCloseIDs: 47
138138
-- diff/-out/evalalpha/stats<==>+out/eval/stats --
139139
diff old new
140140
--- old
141141
+++ new
142-
@@ -1,9 +1,12 @@
142+
@@ -1,12 +1,12 @@
143143
-Leaks: 48
144-
-Freed: 127
145-
-Reused: 120
144+
-Freed: 129
145+
-Reused: 122
146146
-Allocs: 55
147147
-Retain: 138
148148
-
149-
-Unifications: 163
150-
-Conjuncts: 299
151-
-Disjuncts: 192
152-
+Leaks: 119
149+
-Unifications: 165
150+
-Conjuncts: 302
151+
-Disjuncts: 194
152+
-
153+
-CloseIDElems: 0
154+
-NumCloseIDs: 6
155+
+Leaks: 126
153156
+Freed: 0
154157
+Reused: 0
155-
+Allocs: 119
158+
+Allocs: 126
156159
+Retain: 0
157160
+
158-
+Unifications: 99
159-
+Conjuncts: 133
161+
+Unifications: 106
162+
+Conjuncts: 153
160163
+Disjuncts: 5
161164
+
162-
+CloseIDElems: 11
163-
+NumCloseIDs: 26
165+
+CloseIDElems: 7
166+
+NumCloseIDs: 47
164167
-- out/eval/stats --
165168
Leaks: 48
166169
Freed: 129

0 commit comments

Comments
 (0)