-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
built-ins: add object.subset() builtin #4751
built-ins: add object.subset() builtin #4751
Conversation
I have created a simple benchmark in
The "slow" tests are done using pure Rego, while the other tests use the new builtin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just nitpicks.
I'm working on getting the metadata change related to the last release fixed here, #4753, so if you could rebase, I'd appreciate that. Running make generate
should be enough to have only the needed sections added.
In bbb127862c8b6a8fb32303a55c2fef5531b43a13, I have spent some time with the profiler and have made some low hanging fruit optimizations. I am reasonably confident that this doesn't leave performance on the floor, except for array subset using an O(n^2) naive algorithm rather than Boyer-Moore or something similar. The new speedup over pure Rego is 2.77x, compared to 1.97x with the initial version of this PR. |
6f41826
to
55d80f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for bearing with me. The tiniest nitpicks only 🙃 👇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! LGTM
234cc56
to
3cb62d8
Compare
This implements the new object.subset() builtin. Based on my benchmarking, this offers a 2.77x speedup compared to implementing the same thing in pure Rego, and is also easier to read. Fixes open-policy-agent#4358 Signed-off-by: Charles Daniels <[email protected]>
3cb62d8
to
1c2816d
Compare
No changes, just need rubber stamp after rebasing. |
This implements the new object.subset() builtin.
Fixes #4358
Signed-off-by: Charles Daniels [email protected]