mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
397f9b0245
Surprisingly, this sailed up as the major source of B/op in the Regal linting itself benchmark. I guess we never paid attention to it in the past as there were many worse culprits. With help from @tsandall we tracked this down to Regal's frequent use of walk, and how that'd unify the path-value array. Not sure if there are any other noteworthy scenarios that lead on to this path, but at least us `walk` enthusiasts get to start the weekend in the best possible way. No surprises wrt the fix here. Just cram everything into a single struct that can be reused across requests via a sync pool. Not particularly elegant, but fairly limited, so I hope to get this in even if the impact should be minimal outside of `walk` heavy integrations. RegalLintingItself benchmark, main vs change. Ns/op and # allocs largely unchanged, while the difference in B/op is rather massive for a simple change! ``` 348015056 ns/op 1260364874 B/op 31868705 allocs/op 343963417 ns/op 1122163613 B/op 31874931 allocs/op ``` Signed-off-by: Anders Eknert <anders.eknert@apple.com>