-
Notifications
You must be signed in to change notification settings - Fork 234
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
Compilation latency dominated by addOverload operations when using extension libraries #519
Comments
@jpbetz This doesn't surprise me. Why can't you use a statically configured environment? |
Maybe we can? We vary the variable decls used across the compiled CEL expressions, which is what I think got us hung up here. I'll have a look at #347 PR that you shared offline with me and see if that can be use to eliminate the bulk of the cost. |
@jpbetz Take a look at the draft state for #347. I've added some options to early validate declarations and to ensure that validated declarations are copied from one This means that if you do an func init() {
// maybe panic if this errors
baseEnv, _ = cel.NewEnv(
cel.HomogeneousAggregateLiterals(),
library.ExtensionLibs...,
cel.EarlyValidateDeclarations(true),
)
} Then use the Before PR:
After PR:
What do you think? If you think this will work, I'll finish up the tests tomorrow and we'll do another release. I'm actually tempted to make a base copy of the stdEnv internal to CEL to speed up the simple extension cases as well. |
Fixed by #347 See kubernetes/kubernetes#108954 for benchmarks. |
Originally found by @DangerOnTheRanger and @liggitt
In Kubernetes we use the same set of libraries for all CEL expressions, but have to pay the cost of registering them into an environment each time a CEL expression is compiled. This appears to dominate the compilation cost.
cel-go/cel/env.go
Line 163 in ffa9b84
The text was updated successfully, but these errors were encountered: