-
Notifications
You must be signed in to change notification settings - Fork 257
Init function bindings on environment init #1199
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
Init function bindings on environment init #1199
Conversation
|
@beldmian ideally the programs would be cached rather than recreated. Is that perhaps an option? |
|
@TristonianJones Programs are not serializable (at least in general way), which is needed to make them cached in my use case, the nearest to program thing serializable, as I can see, is checked expression of its AST. |
|
@beldmian I see, are you having to page in / out a lot of ASTs in the same environment? |
|
/gcbrun |
|
@TristonianJones Yes, to be precise, I am precompiling a lot of cel expressions in one environment and then they are being shipped to another one (there they are being executed not really many times, but the execution should be fast and at the same time the consumption of resources should be small enough). |
9412cfb to
280ddaf
Compare
|
/gcbrun |
|
@beldmian thanks for the contribution! |
* Init function bindings on environment init * Move calculation of function bindings under sync.Once call in new program creation
While performing some performance testing for one of my projects, I saw that in case of creating many (a lot of) CEL programs in the same environment, creation of function bindings for them can take a significant percentage of CPU time, because they are being regenerated on every program creation, which, as I can see from code, feels really excessive. This PR suggest a way to perform calculation of bindings once for environment configuration and then reuse this bindings in program creation.
Probably, there also should be provided a way to change this behavior through options, let me know if that feels more acceptable with them.
Pull Requests Guidelines
See CONTRIBUTING.md for more details about when to create
a GitHub Pull Request and when other kinds of contributions or
consultation might be more desirable.
When creating a new pull request, please fork the repo and work within a
development branch.
Commit Messages
Reviews
Merging
they have write access. Otherwise, the change will be merged by a maintainer.
closes #<issue-num>: descriptionin the merge message,if applicable.