Skip to content

Commit 51bf6f2

Browse files
committed
tools/flow: add test case for issue 2559
The added CUE takes 7s to test with tools/flow or run with `cue cmd`, as it's adapted from https://github.com/MarcWort/example-cue to show the worst case scenario of tools/flow being slow by nesting many references to non-task nodes which do some underlying work. Thanks to Marc W for providing the original reproducer on GitHub. For #2559. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I25543e7c22b1dda6a8a8528198d2d7b4a63bb411 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1198565 Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Roger Peppe <[email protected]>
1 parent bc41b25 commit 51bf6f2

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

tools/flow/testdata/issue2559.txtar

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#IgnoreConcrete: true
2+
#InferTasks: true
3+
-- in.cue --
4+
package p
5+
6+
import (
7+
"list"
8+
"tool/cli"
9+
)
10+
11+
root: test: cli.Print & { text: "\(len(list.FlattenN(indir1, 10)))" }
12+
13+
indir1: [if len(indir2) > 0 { indir2 }]
14+
indir2: [if len(indir3) > 0 { indir3 }]
15+
indir3: [if len(indir4) > 0 { indir4 }]
16+
indir4: indir5
17+
indir5: indir6
18+
indir6: indir7
19+
indir7: [for i in list.Range(1,20,4) {
20+
#pair & {
21+
one: n: 0
22+
two: n: i
23+
}
24+
}]
25+
26+
#pair: {
27+
one: #unit & {
28+
n: <25
29+
}
30+
two: #unit & {
31+
n: >=one.n
32+
if n == one.n {
33+
n: <= one.n
34+
}
35+
}
36+
if two.n > one.n {
37+
one: n: 0
38+
}
39+
}
40+
41+
#unit: {
42+
n: int
43+
#padding: {in: <10, out: "0\(in)"} | {in: >=10, out: "\(in)"}
44+
str: (#padding & {in: n}).out
45+
}
46+
-- out/run/errors --
47+
-- out/run/t0 --
48+
graph TD
49+
t0("root.test [Ready]")
50+
51+
-- out/run/t1 --
52+
graph TD
53+
t0("root.test [Terminated]")
54+
55+
-- out/run/t1/value --
56+
{
57+
$id: "tool/cli.Print"
58+
stdout: "foo"
59+
text: "5"
60+
}
61+
-- out/run/t1/stats --
62+
Leaks: 0
63+
Freed: 262168
64+
Reused: 262148
65+
Allocs: 20
66+
Retain: 352
67+
68+
Unifications: 187362
69+
Conjuncts: 902602
70+
Disjuncts: 262432
71+
-- out/run/stats/totals --
72+
Leaks: 0
73+
Freed: 262168
74+
Reused: 262148
75+
Allocs: 20
76+
Retain: 352
77+
78+
Unifications: 187362
79+
Conjuncts: 902602
80+
Disjuncts: 262432
81+
-- out/run/t2 --
82+
graph TD
83+
t0("root.prepare [Terminated]")
84+
t1("root.run [Terminated]")
85+
t1-->t0
86+
87+
-- out/run/t2/value --
88+
{
89+
$id: "run"
90+
stdout: "foo"
91+
env: {
92+
input: "foo"
93+
}
94+
}
95+
-- out/run/t2/stats --
96+
Leaks: 0
97+
Freed: 12
98+
Reused: 12
99+
Allocs: 0
100+
Retain: 0
101+
102+
Unifications: 12
103+
Conjuncts: 20
104+
Disjuncts: 12

0 commit comments

Comments
 (0)