-
Notifications
You must be signed in to change notification settings - Fork 328
Closed
Description
What version of CUE are you using (cue version
)?
➜ cue git:(33b7393) ✗ ./cue-33b7393 version cue version v0.0.0-20230808110549-33b73930b8fc go version go1.21.0 -buildmode exe -compiler gc DefaultGODEBUG panicnil=1 CGO_ENABLED 1 GOARCH amd64 GOOS linux GOAMD64 v1 vcs git vcs.revision 33b73930b8fc8a719a88978be0b7e019ba34e247 vcs.time 2023-08-08T11:05:49Z vcs.modified false ➜ cue git:(97d7109d) ✗ ./cue-97d7109 version cue version v0.0.0-20230809090532-97d7109df4d0 go version go1.21.0 -buildmode exe -compiler gc DefaultGODEBUG panicnil=1 CGO_ENABLED 1 GOARCH amd64 GOOS linux GOAMD64 v1 vcs git vcs.revision 97d7109df4d03e7ecc77daa12dbc8b6a247e4d37 vcs.time 2023-08-09T09:05:32Z vcs.modified true
Does this issue reproduce with the latest stable release?
Yes also running on 0.6.0.
What did you do?
I noticed that when running cue 0.6.0 that it was approximately 10x slower on my rules.
Bisecting led me to commit 97d7109 where the performance regression started but only when using a "_tool.cue" file.
➜ example-cue-gh git:(main) hyperfine "../cue/cue-33b7393 build-rules" && hyperfine "../cue/cue-97d7109 build-rules"
Benchmark 1: ../cue/cue-33b7393 build-rules
Time (mean ± σ): 282.4 ms ± 15.0 ms [User: 436.7 ms, System: 33.0 ms]
Range (min … max): 266.5 ms … 308.8 ms 10 runs
Benchmark 1: ../cue/cue-97d7109 build-rules
Time (mean ± σ): 5.881 s ± 0.450 s [User: 8.591 s, System: 0.117 s]
Range (min … max): 5.337 s … 6.769 s 10 runs
but not when directly using cue export
➜ example-cue-gh git:(main) hyperfine "../cue/cue-33b7393 export rules/rule.cue --out yaml" && hyperfine "../cue/cue-97d7109 export rules/rule.cue --out yaml"
Benchmark 1: ../cue/cue-33b7393 export rules/rule.cue --out yaml
Time (mean ± σ): 157.8 ms ± 7.6 ms [User: 241.0 ms, System: 21.8 ms]
Range (min … max): 142.5 ms … 176.3 ms 18 runs
Benchmark 1: ../cue/cue-97d7109 export rules/rule.cue --out yaml
Time (mean ± σ): 160.7 ms ± 11.3 ms [User: 252.4 ms, System: 15.9 ms]
Range (min … max): 147.7 ms … 189.6 ms 19 runs
You can reproduce my tests with my example repo: https://github.com/MarcWort/example-cue
What did you expect to see?
Not such a strong performance impact. My actual project now takes 4 minutes instead of 30secs. I tried some changes on the ruleset but havent found any particular section where the performance hit appears.