The current CertLogic evaluator interprets the CertLogic expression's JSON directly. (This includes doing format validation which can also be done through the validate function.) This can be made more performant as follows:
Do any format validation separate from evaluation, and mark format-validated rules as such in some way.
“Compile” the expression JSON to a tree of JS objects whose root evaluates that expression directly on data. This has the following benefits:
The JS objects can be cached, and are likely to be picked up for JITing.
Some operations can be optimised during the compilation stage. E.g., the execution of the in operation can be optimised by sorting the right-hand side of the operation (provided it's a static array, and not the result of an expression which depends on the input data), and performing a binary search instead of a standard linear search.
The current CertLogic evaluator interprets the CertLogic expression's JSON directly. (This includes doing format validation which can also be done through the
validate
function.) This can be made more performant as follows:in
operation can be optimised by sorting the right-hand side of the operation (provided it's a static array, and not the result of an expression which depends on the input data), and performing a binary search instead of a standard linear search.