chore: Optimize parial rego execution byte allocations (#6144)

* chore: Implement benchmark for authorizer.Prepare

Identify time + alloc cost before optimizing
This commit is contained in:
Steven Masley
2023-02-10 08:39:45 -06:00
committed by GitHub
parent ab9cba9396
commit 32fbd10a1f
5 changed files with 51 additions and 25 deletions

View File

@ -51,7 +51,11 @@ func BenchmarkRBACValueAllocation(b *testing.B) {
})
b.Run("JSONRegoValue", func(b *testing.B) {
for i := 0; i < b.N; i++ {
_, err := ast.InterfaceToValue(jsonSubject)
_, err := ast.InterfaceToValue(map[string]interface{}{
"subject": jsonSubject,
"action": ActionRead,
"object": obj,
})
require.NoError(b, err)
}
})