-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
evaluator: it looks like the result of executing functions is not reused #2566
Comments
Perhaps related to #2243, where "chained" calls to builtins would result in increasingly slower evaluation. |
I checked behaviour before and after changeset https://review.gerrithub.io/c/cue-lang/cue/+/549247 from #2243 and got exactly same behaviour. |
Interestingly, in this example, import "strings"
let bar = strings.ToLower("BAR")
a: strings.HasPrefix("foo1", bar)
b: strings.HasPrefix("foo2", bar)
c: strings.HasPrefix("foo3", bar)
d: strings.HasPrefix("foo4", bar)
e: strings.HasPrefix("foo5", bar) But in this example import "strings"
let bar = strings.ToLower("BAR")
a: bar
b: bar
c: bar
d: bar
e: bar |
I spent several days debugging this issue and wrote the ugly workaround: |
What version of CUE are you using (
cue version
)?Does this issue reproduce with the latest stable release?
Yes
What did you do?
I evaluate cue file with breakpoint on line: https://github.com/cue-lang/cue/blob/v0.6.0/pkg/strings/pkg.go#L300
What did you expect to see?
I expect only one interrupt at breakpoint (function
strings.HasPrefix
executed one time).What did you see instead?
I got 6 interrupts at breakpoints (function
strings.HasPrefix
executed 6 times).The text was updated successfully, but these errors were encountered: