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

wasm: optimize with handling in planner #3150

Closed
srenatus opened this issue Feb 12, 2021 · 0 comments · Fixed by #3153
Closed

wasm: optimize with handling in planner #3150

srenatus opened this issue Feb 12, 2021 · 0 comments · Fixed by #3153

Comments

@srenatus
Copy link
Contributor

Right now, any encountered with statement will cause all data functions to be put aside, and replanned (in a new "generation"):

// If any of the with statements targeted the data document we shadow
// the existing planned functions during expression planning. This
// causes the planner to re-plan any rules that may be required during
// planning of this expression (transitively).
if len(dataRefs) > 0 {
p.funcs.Push(map[string]string{})
for _, ref := range dataRefs {
p.rules.Push(ref)
}
}

We could attempt to be more sophisticated here. In bundles with heavy with usage, this causes the wasm code to have a whole lot of functions.

@srenatus srenatus self-assigned this Feb 16, 2021
srenatus added a commit that referenced this issue Feb 16, 2021
Before, the planner had decided to shadow all rules whenever a with statement was targeting "data".
Now, it's looking at the ruletrie to see if whatever ref the with statement targets actually is a rule (or package ref). If so, it'll shadow, if not, it won't.

Fixes #3150.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant