Skip to content
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

Improve validator performance - early returns #3

Open
dholroyd opened this issue Feb 3, 2021 · 0 comments
Open

Improve validator performance - early returns #3

dholroyd opened this issue Feb 3, 2021 · 0 comments

Comments

@dholroyd
Copy link
Owner

dholroyd commented Feb 3, 2021

In translating Haskall pseudo code from An algorithm for RELAX NG validation into Rust, some spots where Haskall lazy evaluation lead to efficiencies are turned into eager evaluation in the Rust - we evaluate schema expressions we don't need to.

For example we don't need to calculate the derivative of p2 if we already know that p1's derivative became NotAllowed here:

let d1 = Self::att_deriv(memo, p1, schema, att);
let s1 = schema.group(d1, p2);
let d2 = Self::att_deriv(memo, p2, schema, att);
let s2 = schema.group(p1, d2);
schema.choice(s1, s2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant