-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: CachedEnforcer does not clean the result cached in memory when …
…call ClearPolicy method (#1413) * fix: CachedEnforcer does not clean the result cached in memory when call ClearPolicy method * fix: remove redundant return statement
- Loading branch information
1 parent
963e1c4
commit 71c8c84
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71c8c84
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
BenchmarkCachedRaw
17.51
ns/op 0 B/op 0 allocs/op17.54
ns/op 0 B/op 0 allocs/op1.00
BenchmarkCachedRaw - ns/op
17.51
ns/op17.54
ns/op1.00
BenchmarkCachedRaw - B/op
0
B/op0
B/op1
BenchmarkCachedRaw - allocs/op
0
allocs/op0
allocs/op1
BenchmarkCachedBasicModel
171.7
ns/op 104 B/op 4 allocs/op168.8
ns/op 104 B/op 4 allocs/op1.02
BenchmarkCachedBasicModel - ns/op
171.7
ns/op168.8
ns/op1.02
BenchmarkCachedBasicModel - B/op
104
B/op104
B/op1
BenchmarkCachedBasicModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModel
171
ns/op 104 B/op 4 allocs/op167.9
ns/op 104 B/op 4 allocs/op1.02
BenchmarkCachedRBACModel - ns/op
171
ns/op167.9
ns/op1.02
BenchmarkCachedRBACModel - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelSmall
180.9
ns/op 104 B/op 4 allocs/op176.2
ns/op 104 B/op 4 allocs/op1.03
BenchmarkCachedRBACModelSmall - ns/op
180.9
ns/op176.2
ns/op1.03
BenchmarkCachedRBACModelSmall - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelSmall - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelMedium
190.4
ns/op 104 B/op 4 allocs/op179.5
ns/op 104 B/op 4 allocs/op1.06
BenchmarkCachedRBACModelMedium - ns/op
190.4
ns/op179.5
ns/op1.06
BenchmarkCachedRBACModelMedium - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelMedium - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelLarge
158
ns/op 96 B/op 3 allocs/op157.2
ns/op 96 B/op 3 allocs/op1.01
BenchmarkCachedRBACModelLarge - ns/op
158
ns/op157.2
ns/op1.01
BenchmarkCachedRBACModelLarge - B/op
96
B/op96
B/op1
BenchmarkCachedRBACModelLarge - allocs/op
3
allocs/op3
allocs/op1
BenchmarkCachedRBACModelWithResourceRoles
172.1
ns/op 104 B/op 4 allocs/op170.4
ns/op 104 B/op 4 allocs/op1.01
BenchmarkCachedRBACModelWithResourceRoles - ns/op
172.1
ns/op170.4
ns/op1.01
BenchmarkCachedRBACModelWithResourceRoles - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelWithResourceRoles - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelWithDomains
184.7
ns/op 120 B/op 4 allocs/op180.6
ns/op 120 B/op 4 allocs/op1.02
BenchmarkCachedRBACModelWithDomains - ns/op
184.7
ns/op180.6
ns/op1.02
BenchmarkCachedRBACModelWithDomains - B/op
120
B/op120
B/op1
BenchmarkCachedRBACModelWithDomains - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedABACModel
2862
ns/op 1543 B/op 18 allocs/op2805
ns/op 1540 B/op 18 allocs/op1.02
BenchmarkCachedABACModel - ns/op
2862
ns/op2805
ns/op1.02
BenchmarkCachedABACModel - B/op
1543
B/op1540
B/op1.00
BenchmarkCachedABACModel - allocs/op
18
allocs/op18
allocs/op1
BenchmarkCachedKeyMatchModel
190.4
ns/op 152 B/op 4 allocs/op188.2
ns/op 152 B/op 4 allocs/op1.01
BenchmarkCachedKeyMatchModel - ns/op
190.4
ns/op188.2
ns/op1.01
BenchmarkCachedKeyMatchModel - B/op
152
B/op152
B/op1
BenchmarkCachedKeyMatchModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelWithDeny
172.7
ns/op 104 B/op 4 allocs/op171.8
ns/op 104 B/op 4 allocs/op1.01
BenchmarkCachedRBACModelWithDeny - ns/op
172.7
ns/op171.8
ns/op1.01
BenchmarkCachedRBACModelWithDeny - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelWithDeny - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedPriorityModel
172.5
ns/op 104 B/op 4 allocs/op169.1
ns/op 104 B/op 4 allocs/op1.02
BenchmarkCachedPriorityModel - ns/op
172.5
ns/op169.1
ns/op1.02
BenchmarkCachedPriorityModel - B/op
104
B/op104
B/op1
BenchmarkCachedPriorityModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedWithEnforceContext
303
ns/op 240 B/op 5 allocs/op301.2
ns/op 240 B/op 5 allocs/op1.01
BenchmarkCachedWithEnforceContext - ns/op
303
ns/op301.2
ns/op1.01
BenchmarkCachedWithEnforceContext - B/op
240
B/op240
B/op1
BenchmarkCachedWithEnforceContext - allocs/op
5
allocs/op5
allocs/op1
BenchmarkCachedRBACModelMediumParallel
161.1
ns/op 105 B/op 4 allocs/op171.8
ns/op 105 B/op 4 allocs/op0.94
BenchmarkCachedRBACModelMediumParallel - ns/op
161.1
ns/op171.8
ns/op0.94
BenchmarkCachedRBACModelMediumParallel - B/op
105
B/op105
B/op1
BenchmarkCachedRBACModelMediumParallel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkHasPolicySmall
536.2
ns/op 150 B/op 6 allocs/op522.5
ns/op 150 B/op 6 allocs/op1.03
BenchmarkHasPolicySmall - ns/op
536.2
ns/op522.5
ns/op1.03
BenchmarkHasPolicySmall - B/op
150
B/op150
B/op1
BenchmarkHasPolicySmall - allocs/op
6
allocs/op6
allocs/op1
BenchmarkHasPolicyMedium
541.4
ns/op 157 B/op 6 allocs/op574.5
ns/op 157 B/op 6 allocs/op0.94
BenchmarkHasPolicyMedium - ns/op
541.4
ns/op574.5
ns/op0.94
BenchmarkHasPolicyMedium - B/op
157
B/op157
B/op1
BenchmarkHasPolicyMedium - allocs/op
6
allocs/op6
allocs/op1
BenchmarkHasPolicyLarge
578.8
ns/op 165 B/op 7 allocs/op606.2
ns/op 165 B/op 7 allocs/op0.95
BenchmarkHasPolicyLarge - ns/op
578.8
ns/op606.2
ns/op0.95
BenchmarkHasPolicyLarge - B/op
165
B/op165
B/op1
BenchmarkHasPolicyLarge - allocs/op
7
allocs/op7
allocs/op1
BenchmarkAddPolicySmall
587.4
ns/op 152 B/op 6 allocs/op537.1
ns/op 152 B/op 6 allocs/op1.09
BenchmarkAddPolicySmall - ns/op
587.4
ns/op537.1
ns/op1.09
BenchmarkAddPolicySmall - B/op
152
B/op152
B/op1
BenchmarkAddPolicySmall - allocs/op
6
allocs/op6
allocs/op1
BenchmarkAddPolicyMedium
609.3
ns/op 169 B/op 7 allocs/op582.9
ns/op 168 B/op 7 allocs/op1.05
BenchmarkAddPolicyMedium - ns/op
609.3
ns/op582.9
ns/op1.05
BenchmarkAddPolicyMedium - B/op
169
B/op168
B/op1.01
BenchmarkAddPolicyMedium - allocs/op
7
allocs/op7
allocs/op1
BenchmarkAddPolicyLarge
1150
ns/op 447 B/op 9 allocs/op1282
ns/op 456 B/op 9 allocs/op0.90
BenchmarkAddPolicyLarge - ns/op
1150
ns/op1282
ns/op0.90
BenchmarkAddPolicyLarge - B/op
447
B/op456
B/op0.98
BenchmarkAddPolicyLarge - allocs/op
9
allocs/op9
allocs/op1
BenchmarkRemovePolicySmall
556
ns/op 166 B/op 7 allocs/op550.4
ns/op 166 B/op 7 allocs/op1.01
BenchmarkRemovePolicySmall - ns/op
556
ns/op550.4
ns/op1.01
BenchmarkRemovePolicySmall - B/op
166
B/op166
B/op1
BenchmarkRemovePolicySmall - allocs/op
7
allocs/op7
allocs/op1
BenchmarkRemovePolicyMedium
575.5
ns/op 175 B/op 7 allocs/op562.7
ns/op 175 B/op 7 allocs/op1.02
BenchmarkRemovePolicyMedium - ns/op
575.5
ns/op562.7
ns/op1.02
BenchmarkRemovePolicyMedium - B/op
175
B/op175
B/op1
BenchmarkRemovePolicyMedium - allocs/op
7
allocs/op7
allocs/op1
BenchmarkRemovePolicyLarge
1200
ns/op 280 B/op 12 allocs/op1233
ns/op 285 B/op 13 allocs/op0.97
BenchmarkRemovePolicyLarge - ns/op
1200
ns/op1233
ns/op0.97
BenchmarkRemovePolicyLarge - B/op
280
B/op285
B/op0.98
BenchmarkRemovePolicyLarge - allocs/op
12
allocs/op13
allocs/op0.92
BenchmarkRaw
17.46
ns/op 0 B/op 0 allocs/op17.54
ns/op 0 B/op 0 allocs/op1.00
BenchmarkRaw - ns/op
17.46
ns/op17.54
ns/op1.00
BenchmarkRaw - B/op
0
B/op0
B/op1
BenchmarkRaw - allocs/op
0
allocs/op0
allocs/op1
BenchmarkBasicModel
3759
ns/op 1508 B/op 17 allocs/op3605
ns/op 1509 B/op 17 allocs/op1.04
BenchmarkBasicModel - ns/op
3759
ns/op3605
ns/op1.04
BenchmarkBasicModel - B/op
1508
B/op1509
B/op1.00
BenchmarkBasicModel - allocs/op
17
allocs/op17
allocs/op1
BenchmarkRBACModel
5406
ns/op 2066 B/op 35 allocs/op5508
ns/op 2066 B/op 35 allocs/op0.98
BenchmarkRBACModel - ns/op
5406
ns/op5508
ns/op0.98
BenchmarkRBACModel - B/op
2066
B/op2066
B/op1
BenchmarkRBACModel - allocs/op
35
allocs/op35
allocs/op1
BenchmarkRBACModelSizes/small
51357
ns/op 20274 B/op 480 allocs/op49137
ns/op 20265 B/op 480 allocs/op1.05
BenchmarkRBACModelSizes/small - ns/op
51357
ns/op49137
ns/op1.05
BenchmarkRBACModelSizes/small - B/op
20274
B/op20265
B/op1.00
BenchmarkRBACModelSizes/small - allocs/op
480
allocs/op480
allocs/op1
BenchmarkRBACModelSizes/medium
501478
ns/op 191673 B/op 4828 allocs/op494595
ns/op 191741 B/op 4829 allocs/op1.01
BenchmarkRBACModelSizes/medium - ns/op
501478
ns/op494595
ns/op1.01
BenchmarkRBACModelSizes/medium - B/op
191673
B/op191741
B/op1.00
BenchmarkRBACModelSizes/medium - allocs/op
4828
allocs/op4829
allocs/op1.00
BenchmarkRBACModelSizes/large
5384829
ns/op 1898883 B/op 48147 allocs/op5349307
ns/op 1898653 B/op 48149 allocs/op1.01
BenchmarkRBACModelSizes/large - ns/op
5384829
ns/op5349307
ns/op1.01
BenchmarkRBACModelSizes/large - B/op
1898883
B/op1898653
B/op1.00
BenchmarkRBACModelSizes/large - allocs/op
48147
allocs/op48149
allocs/op1.00
BenchmarkRBACModelSmall
61078
ns/op 20307 B/op 615 allocs/op58926
ns/op 20370 B/op 615 allocs/op1.04
BenchmarkRBACModelSmall - ns/op
61078
ns/op58926
ns/op1.04
BenchmarkRBACModelSmall - B/op
20307
B/op20370
B/op1.00
BenchmarkRBACModelSmall - allocs/op
615
allocs/op615
allocs/op1
BenchmarkRBACModelMedium
569566
ns/op 194618 B/op 6018 allocs/op578442
ns/op 194635 B/op 6018 allocs/op0.98
BenchmarkRBACModelMedium - ns/op
569566
ns/op578442
ns/op0.98
BenchmarkRBACModelMedium - B/op
194618
B/op194635
B/op1.00
BenchmarkRBACModelMedium - allocs/op
6018
allocs/op6018
allocs/op1
BenchmarkRBACModelLarge
6054414
ns/op 1933406 B/op 60306 allocs/op5998936
ns/op 1933373 B/op 60305 allocs/op1.01
BenchmarkRBACModelLarge - ns/op
6054414
ns/op5998936
ns/op1.01
BenchmarkRBACModelLarge - B/op
1933406
B/op1933373
B/op1.00
BenchmarkRBACModelLarge - allocs/op
60306
allocs/op60305
allocs/op1.00
BenchmarkRBACModelWithResourceRoles
5502
ns/op 2737 B/op 28 allocs/op5276
ns/op 2736 B/op 28 allocs/op1.04
BenchmarkRBACModelWithResourceRoles - ns/op
5502
ns/op5276
ns/op1.04
BenchmarkRBACModelWithResourceRoles - B/op
2737
B/op2736
B/op1.00
BenchmarkRBACModelWithResourceRoles - allocs/op
28
allocs/op28
allocs/op1
BenchmarkRBACModelWithDomains
5108
ns/op 1831 B/op 25 allocs/op5002
ns/op 1828 B/op 25 allocs/op1.02
BenchmarkRBACModelWithDomains - ns/op
5108
ns/op5002
ns/op1.02
BenchmarkRBACModelWithDomains - B/op
1831
B/op1828
B/op1.00
BenchmarkRBACModelWithDomains - allocs/op
25
allocs/op25
allocs/op1
BenchmarkABACModel
2853
ns/op 1537 B/op 17 allocs/op2773
ns/op 1535 B/op 17 allocs/op1.03
BenchmarkABACModel - ns/op
2853
ns/op2773
ns/op1.03
BenchmarkABACModel - B/op
1537
B/op1535
B/op1.00
BenchmarkABACModel - allocs/op
17
allocs/op17
allocs/op1
BenchmarkABACRuleModel
4012227
ns/op 1327547 B/op 40092 allocs/op3901387
ns/op 1325432 B/op 40092 allocs/op1.03
BenchmarkABACRuleModel - ns/op
4012227
ns/op3901387
ns/op1.03
BenchmarkABACRuleModel - B/op
1327547
B/op1325432
B/op1.00
BenchmarkABACRuleModel - allocs/op
40092
allocs/op40092
allocs/op1
BenchmarkKeyMatchModel
6169
ns/op 3070 B/op 37 allocs/op6076
ns/op 3068 B/op 37 allocs/op1.02
BenchmarkKeyMatchModel - ns/op
6169
ns/op6076
ns/op1.02
BenchmarkKeyMatchModel - B/op
3070
B/op3068
B/op1.00
BenchmarkKeyMatchModel - allocs/op
37
allocs/op37
allocs/op1
BenchmarkRBACModelWithDeny
7028
ns/op 2486 B/op 49 allocs/op6866
ns/op 2481 B/op 49 allocs/op1.02
BenchmarkRBACModelWithDeny - ns/op
7028
ns/op6866
ns/op1.02
BenchmarkRBACModelWithDeny - B/op
2486
B/op2481
B/op1.00
BenchmarkRBACModelWithDeny - allocs/op
49
allocs/op49
allocs/op1
BenchmarkPriorityModel
4214
ns/op 1765 B/op 22 allocs/op4146
ns/op 1765 B/op 22 allocs/op1.02
BenchmarkPriorityModel - ns/op
4214
ns/op4146
ns/op1.02
BenchmarkPriorityModel - B/op
1765
B/op1765
B/op1
BenchmarkPriorityModel - allocs/op
22
allocs/op22
allocs/op1
BenchmarkRBACModelWithDomainPatternLarge
23325
ns/op 16738 B/op 164 allocs/op22369
ns/op 16722 B/op 164 allocs/op1.04
BenchmarkRBACModelWithDomainPatternLarge - ns/op
23325
ns/op22369
ns/op1.04
BenchmarkRBACModelWithDomainPatternLarge - B/op
16738
B/op16722
B/op1.00
BenchmarkRBACModelWithDomainPatternLarge - allocs/op
164
allocs/op164
allocs/op1
BenchmarkRoleManagerSmall
72070
ns/op 11955 B/op 797 allocs/op68573
ns/op 11955 B/op 797 allocs/op1.05
BenchmarkRoleManagerSmall - ns/op
72070
ns/op68573
ns/op1.05
BenchmarkRoleManagerSmall - B/op
11955
B/op11955
B/op1
BenchmarkRoleManagerSmall - allocs/op
797
allocs/op797
allocs/op1
BenchmarkRoleManagerMedium
730149
ns/op 125914 B/op 8741 allocs/op714073
ns/op 125914 B/op 8741 allocs/op1.02
BenchmarkRoleManagerMedium - ns/op
730149
ns/op714073
ns/op1.02
BenchmarkRoleManagerMedium - B/op
125914
B/op125914
B/op1
BenchmarkRoleManagerMedium - allocs/op
8741
allocs/op8741
allocs/op1
BenchmarkRoleManagerLarge
7836069
ns/op 1349921 B/op 89741 allocs/op7722631
ns/op 1349921 B/op 89741 allocs/op1.01
BenchmarkRoleManagerLarge - ns/op
7836069
ns/op7722631
ns/op1.01
BenchmarkRoleManagerLarge - B/op
1349921
B/op1349921
B/op1
BenchmarkRoleManagerLarge - allocs/op
89741
allocs/op89741
allocs/op1
BenchmarkBuildRoleLinksWithPatternLarge
6100830492
ns/op 5348967480 B/op 60949856 allocs/op5813094304
ns/op 5322951904 B/op 60944183 allocs/op1.05
BenchmarkBuildRoleLinksWithPatternLarge - ns/op
6100830492
ns/op5813094304
ns/op1.05
BenchmarkBuildRoleLinksWithPatternLarge - B/op
5348967480
B/op5322951904
B/op1.00
BenchmarkBuildRoleLinksWithPatternLarge - allocs/op
60949856
allocs/op60944183
allocs/op1.00
BenchmarkBuildRoleLinksWithDomainPatternLarge
166042141
ns/op 141653112 B/op 1676506 allocs/op159623563
ns/op 141020763 B/op 1676378 allocs/op1.04
BenchmarkBuildRoleLinksWithDomainPatternLarge - ns/op
166042141
ns/op159623563
ns/op1.04
BenchmarkBuildRoleLinksWithDomainPatternLarge - B/op
141653112
B/op141020763
B/op1.00
BenchmarkBuildRoleLinksWithDomainPatternLarge - allocs/op
1676506
allocs/op1676378
allocs/op1.00
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge
6282298314
ns/op 5484342144 B/op 62560166 allocs/op6013422214
ns/op 5462285056 B/op 62555086 allocs/op1.04
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - ns/op
6282298314
ns/op6013422214
ns/op1.04
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - B/op
5484342144
B/op5462285056
B/op1.00
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - allocs/op
62560166
allocs/op62555086
allocs/op1.00
BenchmarkHasLinkWithPatternLarge
10424
ns/op 7608 B/op 111 allocs/op9950
ns/op 7585 B/op 111 allocs/op1.05
BenchmarkHasLinkWithPatternLarge - ns/op
10424
ns/op9950
ns/op1.05
BenchmarkHasLinkWithPatternLarge - B/op
7608
B/op7585
B/op1.00
BenchmarkHasLinkWithPatternLarge - allocs/op
111
allocs/op111
allocs/op1
BenchmarkHasLinkWithDomainPatternLarge
496.7
ns/op 80 B/op 5 allocs/op480.1
ns/op 80 B/op 5 allocs/op1.03
BenchmarkHasLinkWithDomainPatternLarge - ns/op
496.7
ns/op480.1
ns/op1.03
BenchmarkHasLinkWithDomainPatternLarge - B/op
80
B/op80
B/op1
BenchmarkHasLinkWithDomainPatternLarge - allocs/op
5
allocs/op5
allocs/op1
BenchmarkHasLinkWithPatternAndDomainPatternLarge
10419
ns/op 7608 B/op 111 allocs/op9905
ns/op 7584 B/op 111 allocs/op1.05
BenchmarkHasLinkWithPatternAndDomainPatternLarge - ns/op
10419
ns/op9905
ns/op1.05
BenchmarkHasLinkWithPatternAndDomainPatternLarge - B/op
7608
B/op7584
B/op1.00
BenchmarkHasLinkWithPatternAndDomainPatternLarge - allocs/op
111
allocs/op111
allocs/op1
This comment was automatically generated by workflow using github-action-benchmark.