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

evalv3: repeated use of schema causes wall time and memory use to blow up #3633

Open
mvdan opened this issue Dec 24, 2024 · 0 comments
Open
Labels
evaluator evalv3 issues affecting only the evaluator version 3

Comments

@mvdan
Copy link
Member

mvdan commented Dec 24, 2024

# With the old evaluator.
env CUE_EXPERIMENT=evalv3=0
exec cue vet -c

# With the new evaluator.
env CUE_EXPERIMENT=evalv3=1
exec cue vet -c

-- input.cue --
package p

import "list"

#Schema: {
	required?: [...string] 
	properties?: [string]: null | bool | string | [...int] | #Schema

	foo00?: null | bool | string | [...int] | {string: int32}
	foo01?: null | bool | string | [...int] | {string: int32}
	foo02?: null | bool | string | [...int] | {string: int32}
	foo03?: null | bool | string | [...int] | {string: int32}
	foo04?: null | bool | string | [...int] | {string: int32}
	foo05?: null | bool | string | [...int] | {string: int32}
	foo06?: null | bool | string | [...int] | {string: int32}
	foo07?: null | bool | string | [...int] | {string: int32}
	foo08?: null | bool | string | [...int] | {string: int32}
	foo09?: null | bool | string | [...int] | {string: int32}
	foo10?: null | bool | string | [...int] | {string: int32}
	foo11?: null | bool | string | [...int] | {string: int32}
	foo12?: null | bool | string | [...int] | {string: int32}
	foo13?: null | bool | string | [...int] | {string: int32}
	foo14?: null | bool | string | [...int] | {string: int32}
	foo15?: null | bool | string | [...int] | {string: int32}
	foo16?: null | bool | string | [...int] | {string: int32}
	foo17?: null | bool | string | [...int] | {string: int32}
	foo18?: null | bool | string | [...int] | {string: int32}
	foo19?: null | bool | string | [...int] | {string: int32}
}

out: [...#Schema] & list.Repeat([{
	#Schema
	properties: foo: required: ["bar", "baz"]
}], 100)

As of f2c38f8:

# With the old evaluator. (0.411s)
> env CUE_EXPERIMENT=evalv3=0
> exec cue vet -c
# With the new evaluator. (4.120s)
> env CUE_EXPERIMENT=evalv3=1
> exec cue vet -c

The peak memory usage also jumps from 63MiB to 3.4GiB, meaning we allocate nearly one gigabyte per second. So something seems very wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
evaluator evalv3 issues affecting only the evaluator version 3
Projects
None yet
Development

No branches or pull requests

1 participant