cue-lang / cue

The home of the CUE language! Validate and define text-based and dynamic configuration
https://cuelang.org
Apache License 2.0
5.02k stars 287 forks source link

evalv3: 8X memory usage increase #3372

Open alecholmez opened 1 month ago

alecholmez commented 1 month ago

What version of CUE are you using (cue version)?

$ cue version v0.10.0

Does this issue reproduce with the latest stable release?

Yes this is reproducible with 0.10.0.

What did you do?

We use the go API internally to evaluate CUE projects. With evalv2 enabled, evaluating 3 projects at once, we see about a 2.3gb mem usage ceiling. With the exact same workload of 3 projects, we saw a spike of about 18gb of mem.

Similarly, evalv2 yields a CPU usage of about 1.2 cores max. evalv3 uses about 2.5 cores.

image

This code is quite custom so would be more than happy to setup a meeting and walkthrough what's going on here.

What did you expect to see?

The same, ideally less memory usage.

What did you see instead?

A massive increase of resource utilization.

mvdan commented 1 month ago

Out of curiosity, how does wall time compare between v2 and v3?

alecholmez commented 1 month ago

@mvdan just me quickly counting, it was negligible. They were almost identical. It did take v3 much longer to garbage collect though. Evaluation time was extremely similar