Hi,
We’re using cel-js in a system where CEL expressions are compiled and stored
as AST (serialized JSON) in a database.
Currently, Environment.evaluate() requires a source string and internally
re-parses it on every call. This prevents reuse of precompiled ASTs and leads
to repeated parsing overhead.
Would it be possible to expose an API like:
evaluateAst(ast, context)
This would allow:
- Reusing compiled expressions across requests
- Avoiding repeated parsing
- Better performance in high-frequency evaluation scenarios
Happy to contribute if this aligns with the project direction.
Thanks!
PS: we're aware of parse() for in-memory reuse. Our use case requires persisting the compiled AST to a database and reloading it in a different process/request without re-parsing. The current AST structure contains function references (#meta.evaluate) that aren't JSON-serializable, so we can't round-trip through storage.
Hi,
We’re using cel-js in a system where CEL expressions are compiled and stored
as AST (serialized JSON) in a database.
Currently,
Environment.evaluate()requires a source string and internallyre-parses it on every call. This prevents reuse of precompiled ASTs and leads
to repeated parsing overhead.
Would it be possible to expose an API like:
evaluateAst(ast, context)
This would allow:
Happy to contribute if this aligns with the project direction.
Thanks!
PS: we're aware of parse() for in-memory reuse. Our use case requires persisting the compiled AST to a database and reloading it in a different process/request without re-parsing. The current AST structure contains function references (#meta.evaluate) that aren't JSON-serializable, so we can't round-trip through storage.