-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
More reduced allocations #7193
More reduced allocations #7193
Conversation
6809980
to
5c3f996
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 working on this. Some comments inline 🙃
d6102d8
to
409425a
Compare
The failing test is "unrelated to this PR", which is a bit of a bold statement, given that the test was added by this very PR. But that test fails even on current OPA, and it seems like we have some ordering issue in the Wasm-implementation of
|
49d325c
to
4206ed7
Compare
6696512
to
6e292f6
Compare
✅ Deploy Preview for openpolicyagent ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
For the first time, down under a 100 million allocations when running `regal lint bundle` 🎈 **main** ``` BenchmarkLintAllEnabled-10 1 2538350916 ns/op 6182626816 B/op 108424249 allocs/op ``` **pr** ``` BenchmarkLintAllEnabled-10 1 2282894416 ns/op 5310032744 B/op 93674054 allocs/op ``` But there's more to it than just the number of allocations: ``` ➜ hyperfine -i --warmup 1 'regal lint bundle' 'regal-new lint bundle' Benchmark 1: regal lint bundle Time (mean ± σ): 2.822 s ± 0.055 s [User: 19.299 s, System: 0.603 s] Range (min … max): 2.743 s … 2.961 s 10 runs Benchmark 2: regal-new lint bundle Time (mean ± σ): 2.373 s ± 0.040 s [User: 15.940 s, System: 0.575 s] Range (min … max): 2.315 s … 2.435 s 10 runs Summary regal-new lint bundle ran 1.19 ± 0.03 times faster than regal lint bundle ``` Most notable changes: - Reuse trieTraversalResult in indexing, as these were expensive and short-lived. This had the most dramatic impact on the number of reduced allocations of all the changes here. - Optimize *set, *object and *Array operations to minimize allocations by using "primitive" form iteration instead of the function literal counterparts internally, and to only reset the sort guard when needed. - New Array.Equal implementation does not remove any allocations as the old implementation didn't allocate either. It did however perform much better for the case where the compared arrays were not equal. Signed-off-by: Anders Eknert <[email protected]> # Conflicts: # topdown/casts.go
6e292f6
to
fe9b023
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.
LGTM 🚀
For the first time, down under a 100 million allocations when running
regal lint bundle
🎈main
pr
But there's more to it than just the number of allocations:
Most notable changes:
Reuse trieTraversalResult in indexing, as these were expensive and short-lived. This had the most dramatic impact on the number of reduced allocations of all the changes here.
Optimize *set, *object and *Array operations to minimize allocations by using "primitive" form iteration instead of the function literal counterparts internally, and to only reset the sort guard when needed.
New Array.Equal implementation does not remove any allocations as the old implementation didn't allocate either. It did however perform much better for the case where the compared arrays were not equal.