mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
52e587ab11
Refs copied for the purpose of modification often don't need _all_ parts deep-copied, but only those to be modified. It turns out that in most cases in the context of eval, **no** parts of the ref needs copying, as those refs are static. This PR adds a simple new method to refs that allows smarter copying, saving a million and a half allocations in the `regal lint` benchmark, and hundreds to thousands of allocations in common policy evaluation. **Before** ``` 1716967000 ns/op 3125089752 B/op 62201992 allocs/op ``` **After** ``` 1679479541 ns/op 3086159368 B/op 60630066 allocs/op ``` Also added an unrelated benchmark of a trivial policy, as I've been curious to track down costs of doing almost "nothing". Signed-off-by: Anders Eknert <anders@styra.com>
0 lines
0 B
Plaintext
0 lines
0 B
Plaintext
The file is empty.