While the Engine in wasm binding implements the Clone trait, it's not currently exposed in wasm binding, so there doesn't seem to be way to clone from Javascript.
A small clone method on Engine could be added to allow cloning in Javascript.
I was running a benchmark on Clone where I would clone before each evaluation, I noticed that without running a dummy evaluation first before cloning, each evaluation after cloning would be very slow.
I have to basically do (psuedocode)
template := new Engine()
engine.addPolicy(...)
engine.addDataJson(..)
engine.addInputJson(dummy)
engine.evalRule(dummy rule) // Without this evaluation, each eval after clone is very expensive.
for each loop {
e := template.clone()
e.addInputJson(...)
e.evalRule(....)
}
To avoid using dummy inputs, can an API be provided in Rust, so we can call engine.prepare() after addDataJson.
I was using almost 1MB rego file.
While the Engine in wasm binding implements the Clone trait, it's not currently exposed in wasm binding, so there doesn't seem to be way to clone from Javascript.
A small clone method on Engine could be added to allow cloning in Javascript.
I was running a benchmark on Clone where I would clone before each evaluation, I noticed that without running a dummy evaluation first before cloning, each evaluation after cloning would be very slow.
I have to basically do (psuedocode)
To avoid using dummy inputs, can an API be provided in Rust, so we can call
engine.prepare()after addDataJson.I was using almost 1MB rego file.