mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
storage: Size the Path correctly in construction.
Improvements due to reduced allocations: benchmark old ns/op new ns/op delta BenchmarkAuthzForbidAuthn-8 30951 30871 -0.26% BenchmarkAuthzForbidPath-8 96070 95554 -0.54% BenchmarkAuthzForbidMethod-8 102412 101239 -1.15% BenchmarkAuthzAllow10Paths-8 99315 99859 +0.55% BenchmarkAuthzAllow100Paths-8 620837 595914 -4.01% BenchmarkAuthzAllow1000Paths-8 5423305 5301059 -2.25% BenchmarkRESTAuthzForbidAuthn-8 472427 469012 -0.72% BenchmarkRESTAuthzForbidPath-8 546472 541892 -0.84% BenchmarkRESTAuthzForbidMethod-8 551292 549082 -0.40% BenchmarkRESTAuthzAllow10Paths-8 546016 544676 -0.25% BenchmarkRESTAuthzAllow100Paths-8 1106900 1099005 -0.71% BenchmarkRESTAuthzAllow1000Paths-8 6201083 6004029 -3.18% BenchmarkScheduler10x30-8 12109234 12061512 -0.39% Signed-off-by: Teemu Koponen <koponen@styra.com>
This commit is contained in:
committed by
Torin Sandall
parent
7a99bc3c88
commit
3991328cad
@@ -57,6 +57,8 @@ func NewPathForRef(ref ast.Ref) (path Path, err error) {
|
||||
return Path{}, nil
|
||||
}
|
||||
|
||||
path = make(Path, 0, len(ref)-1)
|
||||
|
||||
for _, term := range ref[1:] {
|
||||
switch v := term.Value.(type) {
|
||||
case ast.String:
|
||||
|
||||
Reference in New Issue
Block a user