-
-
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: add nil checks on RoleManager (#1371)
- Loading branch information
Showing
4 changed files
with
65 additions
and
11 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
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
46136ed
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.56
ns/op 0 B/op 0 allocs/op17.63
ns/op 0 B/op 0 allocs/op1.00
BenchmarkCachedRaw - ns/op
17.56
ns/op17.63
ns/op1.00
BenchmarkCachedRaw - B/op
0
B/op0
B/op1
BenchmarkCachedRaw - allocs/op
0
allocs/op0
allocs/op1
BenchmarkCachedBasicModel
169.1
ns/op 104 B/op 4 allocs/op167
ns/op 104 B/op 4 allocs/op1.01
BenchmarkCachedBasicModel - ns/op
169.1
ns/op167
ns/op1.01
BenchmarkCachedBasicModel - B/op
104
B/op104
B/op1
BenchmarkCachedBasicModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModel
170.4
ns/op 104 B/op 4 allocs/op164.8
ns/op 104 B/op 4 allocs/op1.03
BenchmarkCachedRBACModel - ns/op
170.4
ns/op164.8
ns/op1.03
BenchmarkCachedRBACModel - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelSmall
187
ns/op 104 B/op 4 allocs/op174.1
ns/op 104 B/op 4 allocs/op1.07
BenchmarkCachedRBACModelSmall - ns/op
187
ns/op174.1
ns/op1.07
BenchmarkCachedRBACModelSmall - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelSmall - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelMedium
195.8
ns/op 104 B/op 4 allocs/op176.3
ns/op 104 B/op 4 allocs/op1.11
BenchmarkCachedRBACModelMedium - ns/op
195.8
ns/op176.3
ns/op1.11
BenchmarkCachedRBACModelMedium - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelMedium - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelLarge
163.6
ns/op 96 B/op 3 allocs/op164.5
ns/op 96 B/op 3 allocs/op0.99
BenchmarkCachedRBACModelLarge - ns/op
163.6
ns/op164.5
ns/op0.99
BenchmarkCachedRBACModelLarge - B/op
96
B/op96
B/op1
BenchmarkCachedRBACModelLarge - allocs/op
3
allocs/op3
allocs/op1
BenchmarkCachedRBACModelWithResourceRoles
173.8
ns/op 104 B/op 4 allocs/op166.4
ns/op 104 B/op 4 allocs/op1.04
BenchmarkCachedRBACModelWithResourceRoles - ns/op
173.8
ns/op166.4
ns/op1.04
BenchmarkCachedRBACModelWithResourceRoles - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelWithResourceRoles - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelWithDomains
183.6
ns/op 120 B/op 4 allocs/op173.6
ns/op 120 B/op 4 allocs/op1.06
BenchmarkCachedRBACModelWithDomains - ns/op
183.6
ns/op173.6
ns/op1.06
BenchmarkCachedRBACModelWithDomains - B/op
120
B/op120
B/op1
BenchmarkCachedRBACModelWithDomains - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedABACModel
2741
ns/op 1542 B/op 18 allocs/op2871
ns/op 1538 B/op 18 allocs/op0.95
BenchmarkCachedABACModel - ns/op
2741
ns/op2871
ns/op0.95
BenchmarkCachedABACModel - B/op
1542
B/op1538
B/op1.00
BenchmarkCachedABACModel - allocs/op
18
allocs/op18
allocs/op1
BenchmarkCachedKeyMatchModel
186.9
ns/op 152 B/op 4 allocs/op180.4
ns/op 152 B/op 4 allocs/op1.04
BenchmarkCachedKeyMatchModel - ns/op
186.9
ns/op180.4
ns/op1.04
BenchmarkCachedKeyMatchModel - B/op
152
B/op152
B/op1
BenchmarkCachedKeyMatchModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelWithDeny
170.6
ns/op 104 B/op 4 allocs/op164.6
ns/op 104 B/op 4 allocs/op1.04
BenchmarkCachedRBACModelWithDeny - ns/op
170.6
ns/op164.6
ns/op1.04
BenchmarkCachedRBACModelWithDeny - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelWithDeny - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedPriorityModel
171.1
ns/op 104 B/op 4 allocs/op170.5
ns/op 104 B/op 4 allocs/op1.00
BenchmarkCachedPriorityModel - ns/op
171.1
ns/op170.5
ns/op1.00
BenchmarkCachedPriorityModel - B/op
104
B/op104
B/op1
BenchmarkCachedPriorityModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedWithEnforceContext
294
ns/op 240 B/op 5 allocs/op295.5
ns/op 240 B/op 5 allocs/op0.99
BenchmarkCachedWithEnforceContext - ns/op
294
ns/op295.5
ns/op0.99
BenchmarkCachedWithEnforceContext - B/op
240
B/op240
B/op1
BenchmarkCachedWithEnforceContext - allocs/op
5
allocs/op5
allocs/op1
BenchmarkCachedRBACModelMediumParallel
174.7
ns/op 106 B/op 4 allocs/op168.1
ns/op 106 B/op 4 allocs/op1.04
BenchmarkCachedRBACModelMediumParallel - ns/op
174.7
ns/op168.1
ns/op1.04
BenchmarkCachedRBACModelMediumParallel - B/op
106
B/op106
B/op1
BenchmarkCachedRBACModelMediumParallel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkHasPolicySmall
461.2
ns/op 150 B/op 6 allocs/op462.4
ns/op 150 B/op 6 allocs/op1.00
BenchmarkHasPolicySmall - ns/op
461.2
ns/op462.4
ns/op1.00
BenchmarkHasPolicySmall - B/op
150
B/op150
B/op1
BenchmarkHasPolicySmall - allocs/op
6
allocs/op6
allocs/op1
BenchmarkHasPolicyMedium
492.1
ns/op 157 B/op 6 allocs/op486.9
ns/op 157 B/op 6 allocs/op1.01
BenchmarkHasPolicyMedium - ns/op
492.1
ns/op486.9
ns/op1.01
BenchmarkHasPolicyMedium - B/op
157
B/op157
B/op1
BenchmarkHasPolicyMedium - allocs/op
6
allocs/op6
allocs/op1
BenchmarkHasPolicyLarge
530
ns/op 165 B/op 7 allocs/op522.1
ns/op 165 B/op 7 allocs/op1.02
BenchmarkHasPolicyLarge - ns/op
530
ns/op522.1
ns/op1.02
BenchmarkHasPolicyLarge - B/op
165
B/op165
B/op1
BenchmarkHasPolicyLarge - allocs/op
7
allocs/op7
allocs/op1
BenchmarkAddPolicySmall
486
ns/op 152 B/op 6 allocs/op492.3
ns/op 152 B/op 6 allocs/op0.99
BenchmarkAddPolicySmall - ns/op
486
ns/op492.3
ns/op0.99
BenchmarkAddPolicySmall - B/op
152
B/op152
B/op1
BenchmarkAddPolicySmall - allocs/op
6
allocs/op6
allocs/op1
BenchmarkAddPolicyMedium
554.5
ns/op 175 B/op 7 allocs/op593.4
ns/op 172 B/op 7 allocs/op0.93
BenchmarkAddPolicyMedium - ns/op
554.5
ns/op593.4
ns/op0.93
BenchmarkAddPolicyMedium - B/op
175
B/op172
B/op1.02
BenchmarkAddPolicyMedium - allocs/op
7
allocs/op7
allocs/op1
BenchmarkAddPolicyLarge
1090
ns/op 470 B/op 9 allocs/op1198
ns/op 473 B/op 9 allocs/op0.91
BenchmarkAddPolicyLarge - ns/op
1090
ns/op1198
ns/op0.91
BenchmarkAddPolicyLarge - B/op
470
B/op473
B/op0.99
BenchmarkAddPolicyLarge - allocs/op
9
allocs/op9
allocs/op1
BenchmarkRemovePolicySmall
502.5
ns/op 166 B/op 7 allocs/op461.1
ns/op 166 B/op 7 allocs/op1.09
BenchmarkRemovePolicySmall - ns/op
502.5
ns/op461.1
ns/op1.09
BenchmarkRemovePolicySmall - B/op
166
B/op166
B/op1
BenchmarkRemovePolicySmall - allocs/op
7
allocs/op7
allocs/op1
BenchmarkRemovePolicyMedium
543.1
ns/op 176 B/op 7 allocs/op539.9
ns/op 176 B/op 7 allocs/op1.01
BenchmarkRemovePolicyMedium - ns/op
543.1
ns/op539.9
ns/op1.01
BenchmarkRemovePolicyMedium - B/op
176
B/op176
B/op1
BenchmarkRemovePolicyMedium - allocs/op
7
allocs/op7
allocs/op1
BenchmarkRemovePolicyLarge
1325
ns/op 288 B/op 13 allocs/op1206
ns/op 286 B/op 13 allocs/op1.10
BenchmarkRemovePolicyLarge - ns/op
1325
ns/op1206
ns/op1.10
BenchmarkRemovePolicyLarge - B/op
288
B/op286
B/op1.01
BenchmarkRemovePolicyLarge - allocs/op
13
allocs/op13
allocs/op1
BenchmarkRaw
17.48
ns/op 0 B/op 0 allocs/op17.58
ns/op 0 B/op 0 allocs/op0.99
BenchmarkRaw - ns/op
17.48
ns/op17.58
ns/op0.99
BenchmarkRaw - B/op
0
B/op0
B/op1
BenchmarkRaw - allocs/op
0
allocs/op0
allocs/op1
BenchmarkBasicModel
3608
ns/op 1509 B/op 17 allocs/op3647
ns/op 1508 B/op 17 allocs/op0.99
BenchmarkBasicModel - ns/op
3608
ns/op3647
ns/op0.99
BenchmarkBasicModel - B/op
1509
B/op1508
B/op1.00
BenchmarkBasicModel - allocs/op
17
allocs/op17
allocs/op1
BenchmarkRBACModel
5341
ns/op 2059 B/op 35 allocs/op5423
ns/op 2061 B/op 35 allocs/op0.98
BenchmarkRBACModel - ns/op
5341
ns/op5423
ns/op0.98
BenchmarkRBACModel - B/op
2059
B/op2061
B/op1.00
BenchmarkRBACModel - allocs/op
35
allocs/op35
allocs/op1
BenchmarkRBACModelSizes/small
51775
ns/op 20315 B/op 480 allocs/op48230
ns/op 20261 B/op 480 allocs/op1.07
BenchmarkRBACModelSizes/small - ns/op
51775
ns/op48230
ns/op1.07
BenchmarkRBACModelSizes/small - B/op
20315
B/op20261
B/op1.00
BenchmarkRBACModelSizes/small - allocs/op
480
allocs/op480
allocs/op1
BenchmarkRBACModelSizes/medium
491760
ns/op 191785 B/op 4828 allocs/op516998
ns/op 191748 B/op 4827 allocs/op0.95
BenchmarkRBACModelSizes/medium - ns/op
491760
ns/op516998
ns/op0.95
BenchmarkRBACModelSizes/medium - B/op
191785
B/op191748
B/op1.00
BenchmarkRBACModelSizes/medium - allocs/op
4828
allocs/op4827
allocs/op1.00
BenchmarkRBACModelSizes/large
5222509
ns/op 1898988 B/op 48143 allocs/op5336522
ns/op 1906072 B/op 48353 allocs/op0.98
BenchmarkRBACModelSizes/large - ns/op
5222509
ns/op5336522
ns/op0.98
BenchmarkRBACModelSizes/large - B/op
1898988
B/op1906072
B/op1.00
BenchmarkRBACModelSizes/large - allocs/op
48143
allocs/op48353
allocs/op1.00
BenchmarkRBACModelSmall
62104
ns/op 20370 B/op 615 allocs/op56481
ns/op 20362 B/op 615 allocs/op1.10
BenchmarkRBACModelSmall - ns/op
62104
ns/op56481
ns/op1.10
BenchmarkRBACModelSmall - B/op
20370
B/op20362
B/op1.00
BenchmarkRBACModelSmall - allocs/op
615
allocs/op615
allocs/op1
BenchmarkRBACModelMedium
573635
ns/op 194825 B/op 6021 allocs/op565580
ns/op 194598 B/op 6020 allocs/op1.01
BenchmarkRBACModelMedium - ns/op
573635
ns/op565580
ns/op1.01
BenchmarkRBACModelMedium - B/op
194825
B/op194598
B/op1.00
BenchmarkRBACModelMedium - allocs/op
6021
allocs/op6020
allocs/op1.00
BenchmarkRBACModelLarge
6030064
ns/op 1941690 B/op 60656 allocs/op5991834
ns/op 1940335 B/op 60599 allocs/op1.01
BenchmarkRBACModelLarge - ns/op
6030064
ns/op5991834
ns/op1.01
BenchmarkRBACModelLarge - B/op
1941690
B/op1940335
B/op1.00
BenchmarkRBACModelLarge - allocs/op
60656
allocs/op60599
allocs/op1.00
BenchmarkRBACModelWithResourceRoles
5212
ns/op 2733 B/op 28 allocs/op4539
ns/op 1843 B/op 27 allocs/op1.15
BenchmarkRBACModelWithResourceRoles - ns/op
5212
ns/op4539
ns/op1.15
BenchmarkRBACModelWithResourceRoles - B/op
2733
B/op1843
B/op1.48
BenchmarkRBACModelWithResourceRoles - allocs/op
28
allocs/op27
allocs/op1.04
BenchmarkRBACModelWithDomains
5017
ns/op 1826 B/op 25 allocs/op5093
ns/op 1827 B/op 25 allocs/op0.99
BenchmarkRBACModelWithDomains - ns/op
5017
ns/op5093
ns/op0.99
BenchmarkRBACModelWithDomains - B/op
1826
B/op1827
B/op1.00
BenchmarkRBACModelWithDomains - allocs/op
25
allocs/op25
allocs/op1
BenchmarkABACModel
2782
ns/op 1534 B/op 17 allocs/op2893
ns/op 1534 B/op 17 allocs/op0.96
BenchmarkABACModel - ns/op
2782
ns/op2893
ns/op0.96
BenchmarkABACModel - B/op
1534
B/op1534
B/op1
BenchmarkABACModel - allocs/op
17
allocs/op17
allocs/op1
BenchmarkABACRuleModel
4036196
ns/op 1328785 B/op 40092 allocs/op4034367
ns/op 1326375 B/op 40092 allocs/op1.00
BenchmarkABACRuleModel - ns/op
4036196
ns/op4034367
ns/op1.00
BenchmarkABACRuleModel - B/op
1328785
B/op1326375
B/op1.00
BenchmarkABACRuleModel - allocs/op
40092
allocs/op40092
allocs/op1
BenchmarkKeyMatchModel
6082
ns/op 3067 B/op 37 allocs/op6192
ns/op 3058 B/op 37 allocs/op0.98
BenchmarkKeyMatchModel - ns/op
6082
ns/op6192
ns/op0.98
BenchmarkKeyMatchModel - B/op
3067
B/op3058
B/op1.00
BenchmarkKeyMatchModel - allocs/op
37
allocs/op37
allocs/op1
BenchmarkRBACModelWithDeny
6922
ns/op 2480 B/op 49 allocs/op6880
ns/op 2476 B/op 49 allocs/op1.01
BenchmarkRBACModelWithDeny - ns/op
6922
ns/op6880
ns/op1.01
BenchmarkRBACModelWithDeny - B/op
2480
B/op2476
B/op1.00
BenchmarkRBACModelWithDeny - allocs/op
49
allocs/op49
allocs/op1
BenchmarkPriorityModel
4199
ns/op 1761 B/op 22 allocs/op4246
ns/op 1761 B/op 22 allocs/op0.99
BenchmarkPriorityModel - ns/op
4199
ns/op4246
ns/op0.99
BenchmarkPriorityModel - B/op
1761
B/op1761
B/op1
BenchmarkPriorityModel - allocs/op
22
allocs/op22
allocs/op1
BenchmarkRBACModelWithDomainPatternLarge
23391
ns/op 16732 B/op 164 allocs/op24387
ns/op 16745 B/op 164 allocs/op0.96
BenchmarkRBACModelWithDomainPatternLarge - ns/op
23391
ns/op24387
ns/op0.96
BenchmarkRBACModelWithDomainPatternLarge - B/op
16732
B/op16745
B/op1.00
BenchmarkRBACModelWithDomainPatternLarge - allocs/op
164
allocs/op164
allocs/op1
BenchmarkRoleManagerSmall
70045
ns/op 11955 B/op 797 allocs/op70383
ns/op 11955 B/op 797 allocs/op1.00
BenchmarkRoleManagerSmall - ns/op
70045
ns/op70383
ns/op1.00
BenchmarkRoleManagerSmall - B/op
11955
B/op11955
B/op1
BenchmarkRoleManagerSmall - allocs/op
797
allocs/op797
allocs/op1
BenchmarkRoleManagerMedium
707450
ns/op 125915 B/op 8741 allocs/op748653
ns/op 125915 B/op 8741 allocs/op0.94
BenchmarkRoleManagerMedium - ns/op
707450
ns/op748653
ns/op0.94
BenchmarkRoleManagerMedium - B/op
125915
B/op125915
B/op1
BenchmarkRoleManagerMedium - allocs/op
8741
allocs/op8741
allocs/op1
BenchmarkRoleManagerLarge
7642968
ns/op 1349923 B/op 89741 allocs/op8191233
ns/op 1349922 B/op 89741 allocs/op0.93
BenchmarkRoleManagerLarge - ns/op
7642968
ns/op8191233
ns/op0.93
BenchmarkRoleManagerLarge - B/op
1349923
B/op1349922
B/op1.00
BenchmarkRoleManagerLarge - allocs/op
89741
allocs/op89741
allocs/op1
BenchmarkBuildRoleLinksWithPatternLarge
6256557958
ns/op 5346899296 B/op 60949825 allocs/op6188018487
ns/op 5346308392 B/op 60950166 allocs/op1.01
BenchmarkBuildRoleLinksWithPatternLarge - ns/op
6256557958
ns/op6188018487
ns/op1.01
BenchmarkBuildRoleLinksWithPatternLarge - B/op
5346899296
B/op5346308392
B/op1.00
BenchmarkBuildRoleLinksWithPatternLarge - allocs/op
60949825
allocs/op60950166
allocs/op1.00
BenchmarkBuildRoleLinksWithDomainPatternLarge
171326965
ns/op 141524824 B/op 1676490 allocs/op167324166
ns/op 141336646 B/op 1676529 allocs/op1.02
BenchmarkBuildRoleLinksWithDomainPatternLarge - ns/op
171326965
ns/op167324166
ns/op1.02
BenchmarkBuildRoleLinksWithDomainPatternLarge - B/op
141524824
B/op141336646
B/op1.00
BenchmarkBuildRoleLinksWithDomainPatternLarge - allocs/op
1676490
allocs/op1676529
allocs/op1.00
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge
6449048820
ns/op 5482896960 B/op 62559958 allocs/op6322665690
ns/op 5485058616 B/op 62560942 allocs/op1.02
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - ns/op
6449048820
ns/op6322665690
ns/op1.02
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - B/op
5482896960
B/op5485058616
B/op1.00
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - allocs/op
62559958
allocs/op62560942
allocs/op1.00
BenchmarkHasLinkWithPatternLarge
10565
ns/op 7608 B/op 111 allocs/op10698
ns/op 7609 B/op 111 allocs/op0.99
BenchmarkHasLinkWithPatternLarge - ns/op
10565
ns/op10698
ns/op0.99
BenchmarkHasLinkWithPatternLarge - B/op
7608
B/op7609
B/op1.00
BenchmarkHasLinkWithPatternLarge - allocs/op
111
allocs/op111
allocs/op1
BenchmarkHasLinkWithDomainPatternLarge
481.8
ns/op 80 B/op 5 allocs/op497.3
ns/op 80 B/op 5 allocs/op0.97
BenchmarkHasLinkWithDomainPatternLarge - ns/op
481.8
ns/op497.3
ns/op0.97
BenchmarkHasLinkWithDomainPatternLarge - B/op
80
B/op80
B/op1
BenchmarkHasLinkWithDomainPatternLarge - allocs/op
5
allocs/op5
allocs/op1
BenchmarkHasLinkWithPatternAndDomainPatternLarge
10329
ns/op 7610 B/op 111 allocs/op10858
ns/op 7607 B/op 111 allocs/op0.95
BenchmarkHasLinkWithPatternAndDomainPatternLarge - ns/op
10329
ns/op10858
ns/op0.95
BenchmarkHasLinkWithPatternAndDomainPatternLarge - B/op
7610
B/op7607
B/op1.00
BenchmarkHasLinkWithPatternAndDomainPatternLarge - allocs/op
111
allocs/op111
allocs/op1
This comment was automatically generated by workflow using github-action-benchmark.
46136ed
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.
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
1.10
.BenchmarkCachedRBACModelMedium
195.8
ns/op 104 B/op 4 allocs/op176.3
ns/op 104 B/op 4 allocs/op1.11
BenchmarkCachedRBACModelMedium - ns/op
195.8
ns/op176.3
ns/op1.11
BenchmarkRBACModelWithResourceRoles
5212
ns/op 2733 B/op 28 allocs/op4539
ns/op 1843 B/op 27 allocs/op1.15
BenchmarkRBACModelWithResourceRoles - ns/op
5212
ns/op4539
ns/op1.15
BenchmarkRBACModelWithResourceRoles - B/op
2733
B/op1843
B/op1.48
This comment was automatically generated by workflow using github-action-benchmark.