Perfomance: add preallocation for some slices (#59263)

add preallocation for some slices
This commit is contained in:
Denis Limarev
2022-11-28 13:10:24 +01:00
committed by GitHub
parent 254577ba56
commit b814c66c1d
8 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -124,7 +124,7 @@ func (a allEvaluator) Evaluate(permissions map[string][]string) bool {
}
func (a allEvaluator) MutateScopes(ctx context.Context, mutate ScopeAttributeMutator) (Evaluator, error) {
var modified []Evaluator
modified := make([]Evaluator, 0, len(a.allOf))
for _, e := range a.allOf {
i, err := e.MutateScopes(ctx, mutate)
if err != nil {
@@ -174,7 +174,7 @@ func (a anyEvaluator) Evaluate(permissions map[string][]string) bool {
}
func (a anyEvaluator) MutateScopes(ctx context.Context, mutate ScopeAttributeMutator) (Evaluator, error) {
var modified []Evaluator
modified := make([]Evaluator, 0, len(a.anyOf))
for _, e := range a.anyOf {
i, err := e.MutateScopes(ctx, mutate)
if err != nil {