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: only shadow ruletrie with matching data refs #3153

Conversation

srenatus
Copy link
Contributor

@srenatus srenatus commented 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.


So, for one of the bundles I've been testing this with, it helped a lot:

  • Function count: 1102 -> 816
  • module size: 700K -> 516K

In that bundle, there's not been ANY func gen increase, so, no with statement was targeting a virtual rule. It also means that the mapping data we're using for #3058 has become a lot smaller, from

g0:
   foo:
     bar: 10
     baz: 11
g1:
  foo:
    bar: 12
    baz: 13
...
g78:
  foo:
    ...

to only the g0 subtree.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
@srenatus srenatus force-pushed the sr/wasm/optmize-with-stmt-shadowing branch from 65729b3 to 465a6ff Compare February 16, 2021 13:32
@srenatus srenatus marked this pull request as ready for review February 16, 2021 13:57
Copy link
Member

@tsandall tsandall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@srenatus srenatus merged commit 27b45eb into open-policy-agent:master Feb 16, 2021
@srenatus srenatus deleted the sr/wasm/optmize-with-stmt-shadowing branch February 16, 2021 16:35
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

Successfully merging this pull request may close these issues.

wasm: optimize with handling in planner
2 participants