Skip to content
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

Performance: closedness algorithm consuming lots of memory #2853

Open
1 task
myitcv opened this issue Feb 22, 2024 · 0 comments
Open
1 task

Performance: closedness algorithm consuming lots of memory #2853

myitcv opened this issue Feb 22, 2024 · 0 comments
Assignees

Comments

@myitcv
Copy link
Member

myitcv commented Feb 22, 2024

By default, structs are open to adding fields (and we have plans to similarly make lists open by default). That means the following is valid:

x: {name: "CUE"} & {address: "space"}

Structs and lists (containers) can be closed to prevent additional fields/values from being declared. For example, the follow results in an error:

y: close({name: "CUE"}) & {address: "space"}  // ERROR: y.address: field not allowed

Structs and lists can be closed via the close() builtin or via definitions.

Closedness is a powerful aspect when it comes to validation in CUE. However it very much complicates the evaluation process. In a number of the larger configurations we have seen, closedness has resulted in significant memory pressure (and as a result CPU pressure). This pressure can also grow when a closed value (e.g. a definition) is referenced many times from lots of different contexts.

The new evaluator solves this by allowing closedness related structures to be defined and reclaimed locally. In addition, it is more structured about grouping related values, which, in turn, allows it to detect failure and eliminate invalid disjuncts much earlier.

This performance sub-issue captures details and narrative specific to closedness-related performance issues. We will post updates and commentary related to this topic below.

The umbrella performance issue captures higher-level performance updates.

Existing closedness-related bug reports/issues

@cue-lang cue-lang locked as resolved and limited conversation to collaborators Feb 22, 2024
@myitcv myitcv mentioned this issue Feb 22, 2024
@myitcv myitcv changed the title Placeholder 4 Performance: closedness algorithm consuming lots of memory Feb 22, 2024
@cue-lang cue-lang unlocked this conversation Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In progress
Development

No branches or pull requests

2 participants