-
-
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 error to some of the APIs (#1389)
* fix: add nil checks * fix: lint * fix: return error at anywhere assertion not found * fix: lint * fix: test * fix: format
- Loading branch information
Showing
16 changed files
with
396 additions
and
190 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
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
Oops, something went wrong.
65cce21
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.55
ns/op 0 B/op 0 allocs/op17.56
ns/op 0 B/op 0 allocs/op1.00
BenchmarkCachedRaw - ns/op
17.55
ns/op17.56
ns/op1.00
BenchmarkCachedRaw - B/op
0
B/op0
B/op1
BenchmarkCachedRaw - allocs/op
0
allocs/op0
allocs/op1
BenchmarkCachedBasicModel
158.7
ns/op 104 B/op 4 allocs/op166
ns/op 104 B/op 4 allocs/op0.96
BenchmarkCachedBasicModel - ns/op
158.7
ns/op166
ns/op0.96
BenchmarkCachedBasicModel - B/op
104
B/op104
B/op1
BenchmarkCachedBasicModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModel
159
ns/op 104 B/op 4 allocs/op165.3
ns/op 104 B/op 4 allocs/op0.96
BenchmarkCachedRBACModel - ns/op
159
ns/op165.3
ns/op0.96
BenchmarkCachedRBACModel - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelSmall
179.2
ns/op 104 B/op 4 allocs/op183.4
ns/op 104 B/op 4 allocs/op0.98
BenchmarkCachedRBACModelSmall - ns/op
179.2
ns/op183.4
ns/op0.98
BenchmarkCachedRBACModelSmall - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelSmall - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelMedium
181.8
ns/op 104 B/op 4 allocs/op185.5
ns/op 104 B/op 4 allocs/op0.98
BenchmarkCachedRBACModelMedium - ns/op
181.8
ns/op185.5
ns/op0.98
BenchmarkCachedRBACModelMedium - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelMedium - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelLarge
154.4
ns/op 96 B/op 3 allocs/op162.2
ns/op 96 B/op 3 allocs/op0.95
BenchmarkCachedRBACModelLarge - ns/op
154.4
ns/op162.2
ns/op0.95
BenchmarkCachedRBACModelLarge - B/op
96
B/op96
B/op1
BenchmarkCachedRBACModelLarge - allocs/op
3
allocs/op3
allocs/op1
BenchmarkCachedRBACModelWithResourceRoles
161.8
ns/op 104 B/op 4 allocs/op170
ns/op 104 B/op 4 allocs/op0.95
BenchmarkCachedRBACModelWithResourceRoles - ns/op
161.8
ns/op170
ns/op0.95
BenchmarkCachedRBACModelWithResourceRoles - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelWithResourceRoles - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelWithDomains
175.2
ns/op 120 B/op 4 allocs/op180.4
ns/op 120 B/op 4 allocs/op0.97
BenchmarkCachedRBACModelWithDomains - ns/op
175.2
ns/op180.4
ns/op0.97
BenchmarkCachedRBACModelWithDomains - B/op
120
B/op120
B/op1
BenchmarkCachedRBACModelWithDomains - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedABACModel
2685
ns/op 1537 B/op 18 allocs/op2752
ns/op 1538 B/op 18 allocs/op0.98
BenchmarkCachedABACModel - ns/op
2685
ns/op2752
ns/op0.98
BenchmarkCachedABACModel - B/op
1537
B/op1538
B/op1.00
BenchmarkCachedABACModel - allocs/op
18
allocs/op18
allocs/op1
BenchmarkCachedKeyMatchModel
174.6
ns/op 152 B/op 4 allocs/op193.9
ns/op 152 B/op 4 allocs/op0.90
BenchmarkCachedKeyMatchModel - ns/op
174.6
ns/op193.9
ns/op0.90
BenchmarkCachedKeyMatchModel - B/op
152
B/op152
B/op1
BenchmarkCachedKeyMatchModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelWithDeny
160.2
ns/op 104 B/op 4 allocs/op171
ns/op 104 B/op 4 allocs/op0.94
BenchmarkCachedRBACModelWithDeny - ns/op
160.2
ns/op171
ns/op0.94
BenchmarkCachedRBACModelWithDeny - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelWithDeny - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedPriorityModel
161
ns/op 104 B/op 4 allocs/op169.6
ns/op 104 B/op 4 allocs/op0.95
BenchmarkCachedPriorityModel - ns/op
161
ns/op169.6
ns/op0.95
BenchmarkCachedPriorityModel - B/op
104
B/op104
B/op1
BenchmarkCachedPriorityModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedWithEnforceContext
274.9
ns/op 240 B/op 5 allocs/op303
ns/op 240 B/op 5 allocs/op0.91
BenchmarkCachedWithEnforceContext - ns/op
274.9
ns/op303
ns/op0.91
BenchmarkCachedWithEnforceContext - B/op
240
B/op240
B/op1
BenchmarkCachedWithEnforceContext - allocs/op
5
allocs/op5
allocs/op1
BenchmarkCachedRBACModelMediumParallel
161.9
ns/op 106 B/op 4 allocs/op169.2
ns/op 106 B/op 4 allocs/op0.96
BenchmarkCachedRBACModelMediumParallel - ns/op
161.9
ns/op169.2
ns/op0.96
BenchmarkCachedRBACModelMediumParallel - B/op
106
B/op106
B/op1
BenchmarkCachedRBACModelMediumParallel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkHasPolicySmall
514.4
ns/op 150 B/op 6 allocs/op455.2
ns/op 150 B/op 6 allocs/op1.13
BenchmarkHasPolicySmall - ns/op
514.4
ns/op455.2
ns/op1.13
BenchmarkHasPolicySmall - B/op
150
B/op150
B/op1
BenchmarkHasPolicySmall - allocs/op
6
allocs/op6
allocs/op1
BenchmarkHasPolicyMedium
533.6
ns/op 157 B/op 6 allocs/op482.9
ns/op 157 B/op 6 allocs/op1.10
BenchmarkHasPolicyMedium - ns/op
533.6
ns/op482.9
ns/op1.10
BenchmarkHasPolicyMedium - B/op
157
B/op157
B/op1
BenchmarkHasPolicyMedium - allocs/op
6
allocs/op6
allocs/op1
BenchmarkHasPolicyLarge
568.7
ns/op 165 B/op 7 allocs/op523.8
ns/op 165 B/op 7 allocs/op1.09
BenchmarkHasPolicyLarge - ns/op
568.7
ns/op523.8
ns/op1.09
BenchmarkHasPolicyLarge - B/op
165
B/op165
B/op1
BenchmarkHasPolicyLarge - allocs/op
7
allocs/op7
allocs/op1
BenchmarkAddPolicySmall
505.3
ns/op 152 B/op 6 allocs/op464.2
ns/op 152 B/op 6 allocs/op1.09
BenchmarkAddPolicySmall - ns/op
505.3
ns/op464.2
ns/op1.09
BenchmarkAddPolicySmall - B/op
152
B/op152
B/op1
BenchmarkAddPolicySmall - allocs/op
6
allocs/op6
allocs/op1
BenchmarkAddPolicyMedium
615.2
ns/op 177 B/op 7 allocs/op577.2
ns/op 177 B/op 7 allocs/op1.07
BenchmarkAddPolicyMedium - ns/op
615.2
ns/op577.2
ns/op1.07
BenchmarkAddPolicyMedium - B/op
177
B/op177
B/op1
BenchmarkAddPolicyMedium - allocs/op
7
allocs/op7
allocs/op1
BenchmarkAddPolicyLarge
1178
ns/op 470 B/op 9 allocs/op1195
ns/op 470 B/op 9 allocs/op0.99
BenchmarkAddPolicyLarge - ns/op
1178
ns/op1195
ns/op0.99
BenchmarkAddPolicyLarge - B/op
470
B/op470
B/op1
BenchmarkAddPolicyLarge - allocs/op
9
allocs/op9
allocs/op1
BenchmarkRemovePolicySmall
521.8
ns/op 166 B/op 7 allocs/op478.2
ns/op 166 B/op 7 allocs/op1.09
BenchmarkRemovePolicySmall - ns/op
521.8
ns/op478.2
ns/op1.09
BenchmarkRemovePolicySmall - B/op
166
B/op166
B/op1
BenchmarkRemovePolicySmall - allocs/op
7
allocs/op7
allocs/op1
BenchmarkRemovePolicyMedium
563.3
ns/op 177 B/op 7 allocs/op560.7
ns/op 176 B/op 7 allocs/op1.00
BenchmarkRemovePolicyMedium - ns/op
563.3
ns/op560.7
ns/op1.00
BenchmarkRemovePolicyMedium - B/op
177
B/op176
B/op1.01
BenchmarkRemovePolicyMedium - allocs/op
7
allocs/op7
allocs/op1
BenchmarkRemovePolicyLarge
1202
ns/op 296 B/op 13 allocs/op1347
ns/op 290 B/op 13 allocs/op0.89
BenchmarkRemovePolicyLarge - ns/op
1202
ns/op1347
ns/op0.89
BenchmarkRemovePolicyLarge - B/op
296
B/op290
B/op1.02
BenchmarkRemovePolicyLarge - allocs/op
13
allocs/op13
allocs/op1
BenchmarkRaw
17.56
ns/op 0 B/op 0 allocs/op17.4
ns/op 0 B/op 0 allocs/op1.01
BenchmarkRaw - ns/op
17.56
ns/op17.4
ns/op1.01
BenchmarkRaw - B/op
0
B/op0
B/op1
BenchmarkRaw - allocs/op
0
allocs/op0
allocs/op1
BenchmarkBasicModel
3401
ns/op 1503 B/op 17 allocs/op3537
ns/op 1506 B/op 17 allocs/op0.96
BenchmarkBasicModel - ns/op
3401
ns/op3537
ns/op0.96
BenchmarkBasicModel - B/op
1503
B/op1506
B/op1.00
BenchmarkBasicModel - allocs/op
17
allocs/op17
allocs/op1
BenchmarkRBACModel
5231
ns/op 2056 B/op 35 allocs/op5319
ns/op 2064 B/op 35 allocs/op0.98
BenchmarkRBACModel - ns/op
5231
ns/op5319
ns/op0.98
BenchmarkRBACModel - B/op
2056
B/op2064
B/op1.00
BenchmarkRBACModel - allocs/op
35
allocs/op35
allocs/op1
BenchmarkRBACModelSizes/small
51810
ns/op 20346 B/op 480 allocs/op48717
ns/op 20231 B/op 480 allocs/op1.06
BenchmarkRBACModelSizes/small - ns/op
51810
ns/op48717
ns/op1.06
BenchmarkRBACModelSizes/small - B/op
20346
B/op20231
B/op1.01
BenchmarkRBACModelSizes/small - allocs/op
480
allocs/op480
allocs/op1
BenchmarkRBACModelSizes/medium
478667
ns/op 191678 B/op 4828 allocs/op500856
ns/op 191431 B/op 4828 allocs/op0.96
BenchmarkRBACModelSizes/medium - ns/op
478667
ns/op500856
ns/op0.96
BenchmarkRBACModelSizes/medium - B/op
191678
B/op191431
B/op1.00
BenchmarkRBACModelSizes/medium - allocs/op
4828
allocs/op4828
allocs/op1
BenchmarkRBACModelSizes/large
5102054
ns/op 1906407 B/op 48353 allocs/op5300440
ns/op 1899686 B/op 48171 allocs/op0.96
BenchmarkRBACModelSizes/large - ns/op
5102054
ns/op5300440
ns/op0.96
BenchmarkRBACModelSizes/large - B/op
1906407
B/op1899686
B/op1.00
BenchmarkRBACModelSizes/large - allocs/op
48353
allocs/op48171
allocs/op1.00
BenchmarkRBACModelSmall
60837
ns/op 20482 B/op 615 allocs/op60137
ns/op 20440 B/op 615 allocs/op1.01
BenchmarkRBACModelSmall - ns/op
60837
ns/op60137
ns/op1.01
BenchmarkRBACModelSmall - B/op
20482
B/op20440
B/op1.00
BenchmarkRBACModelSmall - allocs/op
615
allocs/op615
allocs/op1
BenchmarkRBACModelMedium
577655
ns/op 194765 B/op 6021 allocs/op588805
ns/op 194936 B/op 6020 allocs/op0.98
BenchmarkRBACModelMedium - ns/op
577655
ns/op588805
ns/op0.98
BenchmarkRBACModelMedium - B/op
194765
B/op194936
B/op1.00
BenchmarkRBACModelMedium - allocs/op
6021
allocs/op6020
allocs/op1.00
BenchmarkRBACModelLarge
5934143
ns/op 1940245 B/op 60608 allocs/op6218220
ns/op 1941524 B/op 60641 allocs/op0.95
BenchmarkRBACModelLarge - ns/op
5934143
ns/op6218220
ns/op0.95
BenchmarkRBACModelLarge - B/op
1940245
B/op1941524
B/op1.00
BenchmarkRBACModelLarge - allocs/op
60608
allocs/op60641
allocs/op1.00
BenchmarkRBACModelWithResourceRoles
4939
ns/op 2724 B/op 28 allocs/op5048
ns/op 2730 B/op 28 allocs/op0.98
BenchmarkRBACModelWithResourceRoles - ns/op
4939
ns/op5048
ns/op0.98
BenchmarkRBACModelWithResourceRoles - B/op
2724
B/op2730
B/op1.00
BenchmarkRBACModelWithResourceRoles - allocs/op
28
allocs/op28
allocs/op1
BenchmarkRBACModelWithDomains
4816
ns/op 1820 B/op 25 allocs/op4935
ns/op 1824 B/op 25 allocs/op0.98
BenchmarkRBACModelWithDomains - ns/op
4816
ns/op4935
ns/op0.98
BenchmarkRBACModelWithDomains - B/op
1820
B/op1824
B/op1.00
BenchmarkRBACModelWithDomains - allocs/op
25
allocs/op25
allocs/op1
BenchmarkABACModel
2604
ns/op 1529 B/op 17 allocs/op2671
ns/op 1531 B/op 17 allocs/op0.97
BenchmarkABACModel - ns/op
2604
ns/op2671
ns/op0.97
BenchmarkABACModel - B/op
1529
B/op1531
B/op1.00
BenchmarkABACModel - allocs/op
17
allocs/op17
allocs/op1
BenchmarkABACRuleModel
3784670
ns/op 1324583 B/op 40091 allocs/op3907306
ns/op 1329018 B/op 40092 allocs/op0.97
BenchmarkABACRuleModel - ns/op
3784670
ns/op3907306
ns/op0.97
BenchmarkABACRuleModel - B/op
1324583
B/op1329018
B/op1.00
BenchmarkABACRuleModel - allocs/op
40091
allocs/op40092
allocs/op1.00
BenchmarkKeyMatchModel
5685
ns/op 3054 B/op 37 allocs/op5869
ns/op 3063 B/op 37 allocs/op0.97
BenchmarkKeyMatchModel - ns/op
5685
ns/op5869
ns/op0.97
BenchmarkKeyMatchModel - B/op
3054
B/op3063
B/op1.00
BenchmarkKeyMatchModel - allocs/op
37
allocs/op37
allocs/op1
BenchmarkRBACModelWithDeny
6556
ns/op 2472 B/op 49 allocs/op6731
ns/op 2477 B/op 49 allocs/op0.97
BenchmarkRBACModelWithDeny - ns/op
6556
ns/op6731
ns/op0.97
BenchmarkRBACModelWithDeny - B/op
2472
B/op2477
B/op1.00
BenchmarkRBACModelWithDeny - allocs/op
49
allocs/op49
allocs/op1
BenchmarkPriorityModel
3965
ns/op 1755 B/op 22 allocs/op4088
ns/op 1758 B/op 22 allocs/op0.97
BenchmarkPriorityModel - ns/op
3965
ns/op4088
ns/op0.97
BenchmarkPriorityModel - B/op
1755
B/op1758
B/op1.00
BenchmarkPriorityModel - allocs/op
22
allocs/op22
allocs/op1
BenchmarkRBACModelWithDomainPatternLarge
22975
ns/op 16741 B/op 164 allocs/op22747
ns/op 16721 B/op 164 allocs/op1.01
BenchmarkRBACModelWithDomainPatternLarge - ns/op
22975
ns/op22747
ns/op1.01
BenchmarkRBACModelWithDomainPatternLarge - B/op
16741
B/op16721
B/op1.00
BenchmarkRBACModelWithDomainPatternLarge - allocs/op
164
allocs/op164
allocs/op1
BenchmarkRoleManagerSmall
68543
ns/op 11956 B/op 797 allocs/op67823
ns/op 11955 B/op 797 allocs/op1.01
BenchmarkRoleManagerSmall - ns/op
68543
ns/op67823
ns/op1.01
BenchmarkRoleManagerSmall - B/op
11956
B/op11955
B/op1.00
BenchmarkRoleManagerSmall - allocs/op
797
allocs/op797
allocs/op1
BenchmarkRoleManagerMedium
711191
ns/op 125916 B/op 8741 allocs/op710275
ns/op 125914 B/op 8741 allocs/op1.00
BenchmarkRoleManagerMedium - ns/op
711191
ns/op710275
ns/op1.00
BenchmarkRoleManagerMedium - B/op
125916
B/op125914
B/op1.00
BenchmarkRoleManagerMedium - allocs/op
8741
allocs/op8741
allocs/op1
BenchmarkRoleManagerLarge
7906676
ns/op 1349923 B/op 89741 allocs/op7956983
ns/op 1349932 B/op 89741 allocs/op0.99
BenchmarkRoleManagerLarge - ns/op
7906676
ns/op7956983
ns/op0.99
BenchmarkRoleManagerLarge - B/op
1349923
B/op1349932
B/op1.00
BenchmarkRoleManagerLarge - allocs/op
89741
allocs/op89741
allocs/op1
BenchmarkBuildRoleLinksWithPatternLarge
6175247993
ns/op 5352361120 B/op 60951447 allocs/op6128452526
ns/op 5344946064 B/op 60949357 allocs/op1.01
BenchmarkBuildRoleLinksWithPatternLarge - ns/op
6175247993
ns/op6128452526
ns/op1.01
BenchmarkBuildRoleLinksWithPatternLarge - B/op
5352361120
B/op5344946064
B/op1.00
BenchmarkBuildRoleLinksWithPatternLarge - allocs/op
60951447
allocs/op60949357
allocs/op1.00
BenchmarkBuildRoleLinksWithDomainPatternLarge
169925258
ns/op 141977253 B/op 1676596 allocs/op167620139
ns/op 141724989 B/op 1676532 allocs/op1.01
BenchmarkBuildRoleLinksWithDomainPatternLarge - ns/op
169925258
ns/op167620139
ns/op1.01
BenchmarkBuildRoleLinksWithDomainPatternLarge - B/op
141977253
B/op141724989
B/op1.00
BenchmarkBuildRoleLinksWithDomainPatternLarge - allocs/op
1676596
allocs/op1676532
allocs/op1.00
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge
6345010372
ns/op 5494759736 B/op 62562904 allocs/op6324546585
ns/op 5485116776 B/op 62560476 allocs/op1.00
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - ns/op
6345010372
ns/op6324546585
ns/op1.00
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - B/op
5494759736
B/op5485116776
B/op1.00
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - allocs/op
62562904
allocs/op62560476
allocs/op1.00
BenchmarkHasLinkWithPatternLarge
10465
ns/op 7606 B/op 111 allocs/op10321
ns/op 7605 B/op 111 allocs/op1.01
BenchmarkHasLinkWithPatternLarge - ns/op
10465
ns/op10321
ns/op1.01
BenchmarkHasLinkWithPatternLarge - B/op
7606
B/op7605
B/op1.00
BenchmarkHasLinkWithPatternLarge - allocs/op
111
allocs/op111
allocs/op1
BenchmarkHasLinkWithDomainPatternLarge
471.8
ns/op 80 B/op 5 allocs/op475.6
ns/op 80 B/op 5 allocs/op0.99
BenchmarkHasLinkWithDomainPatternLarge - ns/op
471.8
ns/op475.6
ns/op0.99
BenchmarkHasLinkWithDomainPatternLarge - B/op
80
B/op80
B/op1
BenchmarkHasLinkWithDomainPatternLarge - allocs/op
5
allocs/op5
allocs/op1
BenchmarkHasLinkWithPatternAndDomainPatternLarge
10366
ns/op 7612 B/op 111 allocs/op10323
ns/op 7610 B/op 111 allocs/op1.00
BenchmarkHasLinkWithPatternAndDomainPatternLarge - ns/op
10366
ns/op10323
ns/op1.00
BenchmarkHasLinkWithPatternAndDomainPatternLarge - B/op
7612
B/op7610
B/op1.00
BenchmarkHasLinkWithPatternAndDomainPatternLarge - allocs/op
111
allocs/op111
allocs/op1
This comment was automatically generated by workflow using github-action-benchmark.
65cce21
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
.BenchmarkHasPolicySmall
514.4
ns/op 150 B/op 6 allocs/op455.2
ns/op 150 B/op 6 allocs/op1.13
BenchmarkHasPolicySmall - ns/op
514.4
ns/op455.2
ns/op1.13
BenchmarkHasPolicyMedium
533.6
ns/op 157 B/op 6 allocs/op482.9
ns/op 157 B/op 6 allocs/op1.10
BenchmarkHasPolicyMedium - ns/op
533.6
ns/op482.9
ns/op1.10
This comment was automatically generated by workflow using github-action-benchmark.