-
-
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: cut down the lock range in `LoadPolicy`, delete outdated `LoadPolicyFast` * fix: fix logic
- Loading branch information
Showing
2 changed files
with
38 additions
and
52 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
20fd529
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.54
ns/op 0 B/op 0 allocs/op17.56
ns/op 0 B/op 0 allocs/op1.00
BenchmarkCachedRaw - ns/op
17.54
ns/op17.56
ns/op1.00
BenchmarkCachedRaw - B/op
0
B/op0
B/op1
BenchmarkCachedRaw - allocs/op
0
allocs/op0
allocs/op1
BenchmarkCachedBasicModel
167.6
ns/op 104 B/op 4 allocs/op168.6
ns/op 104 B/op 4 allocs/op0.99
BenchmarkCachedBasicModel - ns/op
167.6
ns/op168.6
ns/op0.99
BenchmarkCachedBasicModel - B/op
104
B/op104
B/op1
BenchmarkCachedBasicModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModel
168.2
ns/op 104 B/op 4 allocs/op169.2
ns/op 104 B/op 4 allocs/op0.99
BenchmarkCachedRBACModel - ns/op
168.2
ns/op169.2
ns/op0.99
BenchmarkCachedRBACModel - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelSmall
169.7
ns/op 104 B/op 4 allocs/op174.5
ns/op 104 B/op 4 allocs/op0.97
BenchmarkCachedRBACModelSmall - ns/op
169.7
ns/op174.5
ns/op0.97
BenchmarkCachedRBACModelSmall - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelSmall - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelMedium
179.3
ns/op 104 B/op 4 allocs/op183
ns/op 104 B/op 4 allocs/op0.98
BenchmarkCachedRBACModelMedium - ns/op
179.3
ns/op183
ns/op0.98
BenchmarkCachedRBACModelMedium - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelMedium - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelLarge
162
ns/op 96 B/op 3 allocs/op158.7
ns/op 96 B/op 3 allocs/op1.02
BenchmarkCachedRBACModelLarge - ns/op
162
ns/op158.7
ns/op1.02
BenchmarkCachedRBACModelLarge - B/op
96
B/op96
B/op1
BenchmarkCachedRBACModelLarge - allocs/op
3
allocs/op3
allocs/op1
BenchmarkCachedRBACModelWithResourceRoles
167.6
ns/op 104 B/op 4 allocs/op171
ns/op 104 B/op 4 allocs/op0.98
BenchmarkCachedRBACModelWithResourceRoles - ns/op
167.6
ns/op171
ns/op0.98
BenchmarkCachedRBACModelWithResourceRoles - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelWithResourceRoles - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelWithDomains
178.5
ns/op 120 B/op 4 allocs/op188.6
ns/op 120 B/op 4 allocs/op0.95
BenchmarkCachedRBACModelWithDomains - ns/op
178.5
ns/op188.6
ns/op0.95
BenchmarkCachedRBACModelWithDomains - B/op
120
B/op120
B/op1
BenchmarkCachedRBACModelWithDomains - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedABACModel
2816
ns/op 1536 B/op 18 allocs/op2892
ns/op 1547 B/op 18 allocs/op0.97
BenchmarkCachedABACModel - ns/op
2816
ns/op2892
ns/op0.97
BenchmarkCachedABACModel - B/op
1536
B/op1547
B/op0.99
BenchmarkCachedABACModel - allocs/op
18
allocs/op18
allocs/op1
BenchmarkCachedKeyMatchModel
185.3
ns/op 152 B/op 4 allocs/op193.1
ns/op 152 B/op 4 allocs/op0.96
BenchmarkCachedKeyMatchModel - ns/op
185.3
ns/op193.1
ns/op0.96
BenchmarkCachedKeyMatchModel - B/op
152
B/op152
B/op1
BenchmarkCachedKeyMatchModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelWithDeny
168.2
ns/op 104 B/op 4 allocs/op176.5
ns/op 104 B/op 4 allocs/op0.95
BenchmarkCachedRBACModelWithDeny - ns/op
168.2
ns/op176.5
ns/op0.95
BenchmarkCachedRBACModelWithDeny - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelWithDeny - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedPriorityModel
170.6
ns/op 104 B/op 4 allocs/op172.4
ns/op 104 B/op 4 allocs/op0.99
BenchmarkCachedPriorityModel - ns/op
170.6
ns/op172.4
ns/op0.99
BenchmarkCachedPriorityModel - B/op
104
B/op104
B/op1
BenchmarkCachedPriorityModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedWithEnforceContext
304.4
ns/op 240 B/op 5 allocs/op298.7
ns/op 240 B/op 5 allocs/op1.02
BenchmarkCachedWithEnforceContext - ns/op
304.4
ns/op298.7
ns/op1.02
BenchmarkCachedWithEnforceContext - B/op
240
B/op240
B/op1
BenchmarkCachedWithEnforceContext - allocs/op
5
allocs/op5
allocs/op1
BenchmarkCachedRBACModelMediumParallel
176.1
ns/op 106 B/op 4 allocs/op166.3
ns/op 106 B/op 4 allocs/op1.06
BenchmarkCachedRBACModelMediumParallel - ns/op
176.1
ns/op166.3
ns/op1.06
BenchmarkCachedRBACModelMediumParallel - B/op
106
B/op106
B/op1
BenchmarkCachedRBACModelMediumParallel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkHasPolicySmall
491.4
ns/op 150 B/op 6 allocs/op531.1
ns/op 150 B/op 6 allocs/op0.93
BenchmarkHasPolicySmall - ns/op
491.4
ns/op531.1
ns/op0.93
BenchmarkHasPolicySmall - B/op
150
B/op150
B/op1
BenchmarkHasPolicySmall - allocs/op
6
allocs/op6
allocs/op1
BenchmarkHasPolicyMedium
567.9
ns/op 157 B/op 6 allocs/op588.5
ns/op 157 B/op 6 allocs/op0.96
BenchmarkHasPolicyMedium - ns/op
567.9
ns/op588.5
ns/op0.96
BenchmarkHasPolicyMedium - B/op
157
B/op157
B/op1
BenchmarkHasPolicyMedium - allocs/op
6
allocs/op6
allocs/op1
BenchmarkHasPolicyLarge
595.5
ns/op 165 B/op 7 allocs/op563.5
ns/op 165 B/op 7 allocs/op1.06
BenchmarkHasPolicyLarge - ns/op
595.5
ns/op563.5
ns/op1.06
BenchmarkHasPolicyLarge - B/op
165
B/op165
B/op1
BenchmarkHasPolicyLarge - allocs/op
7
allocs/op7
allocs/op1
BenchmarkAddPolicySmall
526.9
ns/op 152 B/op 6 allocs/op538.2
ns/op 152 B/op 6 allocs/op0.98
BenchmarkAddPolicySmall - ns/op
526.9
ns/op538.2
ns/op0.98
BenchmarkAddPolicySmall - B/op
152
B/op152
B/op1
BenchmarkAddPolicySmall - allocs/op
6
allocs/op6
allocs/op1
BenchmarkAddPolicyMedium
647.1
ns/op 176 B/op 7 allocs/op644.5
ns/op 178 B/op 7 allocs/op1.00
BenchmarkAddPolicyMedium - ns/op
647.1
ns/op644.5
ns/op1.00
BenchmarkAddPolicyMedium - B/op
176
B/op178
B/op0.99
BenchmarkAddPolicyMedium - allocs/op
7
allocs/op7
allocs/op1
BenchmarkAddPolicyLarge
1126
ns/op 470 B/op 9 allocs/op1186
ns/op 470 B/op 9 allocs/op0.95
BenchmarkAddPolicyLarge - ns/op
1126
ns/op1186
ns/op0.95
BenchmarkAddPolicyLarge - B/op
470
B/op470
B/op1
BenchmarkAddPolicyLarge - allocs/op
9
allocs/op9
allocs/op1
BenchmarkRemovePolicySmall
542.9
ns/op 166 B/op 7 allocs/op505.2
ns/op 166 B/op 7 allocs/op1.07
BenchmarkRemovePolicySmall - ns/op
542.9
ns/op505.2
ns/op1.07
BenchmarkRemovePolicySmall - B/op
166
B/op166
B/op1
BenchmarkRemovePolicySmall - allocs/op
7
allocs/op7
allocs/op1
BenchmarkRemovePolicyMedium
592.6
ns/op 177 B/op 7 allocs/op590.9
ns/op 177 B/op 7 allocs/op1.00
BenchmarkRemovePolicyMedium - ns/op
592.6
ns/op590.9
ns/op1.00
BenchmarkRemovePolicyMedium - B/op
177
B/op177
B/op1
BenchmarkRemovePolicyMedium - allocs/op
7
allocs/op7
allocs/op1
BenchmarkRemovePolicyLarge
1279
ns/op 295 B/op 13 allocs/op1347
ns/op 286 B/op 13 allocs/op0.95
BenchmarkRemovePolicyLarge - ns/op
1279
ns/op1347
ns/op0.95
BenchmarkRemovePolicyLarge - B/op
295
B/op286
B/op1.03
BenchmarkRemovePolicyLarge - allocs/op
13
allocs/op13
allocs/op1
BenchmarkRaw
17.54
ns/op 0 B/op 0 allocs/op17.53
ns/op 0 B/op 0 allocs/op1.00
BenchmarkRaw - ns/op
17.54
ns/op17.53
ns/op1.00
BenchmarkRaw - B/op
0
B/op0
B/op1
BenchmarkRaw - allocs/op
0
allocs/op0
allocs/op1
BenchmarkBasicModel
3620
ns/op 1504 B/op 17 allocs/op3620
ns/op 1509 B/op 17 allocs/op1
BenchmarkBasicModel - ns/op
3620
ns/op3620
ns/op1
BenchmarkBasicModel - B/op
1504
B/op1509
B/op1.00
BenchmarkBasicModel - allocs/op
17
allocs/op17
allocs/op1
BenchmarkRBACModel
5348
ns/op 2056 B/op 35 allocs/op5514
ns/op 2070 B/op 35 allocs/op0.97
BenchmarkRBACModel - ns/op
5348
ns/op5514
ns/op0.97
BenchmarkRBACModel - B/op
2056
B/op2070
B/op0.99
BenchmarkRBACModel - allocs/op
35
allocs/op35
allocs/op1
BenchmarkRBACModelSizes/small
49114
ns/op 20157 B/op 480 allocs/op52601
ns/op 20155 B/op 480 allocs/op0.93
BenchmarkRBACModelSizes/small - ns/op
49114
ns/op52601
ns/op0.93
BenchmarkRBACModelSizes/small - B/op
20157
B/op20155
B/op1.00
BenchmarkRBACModelSizes/small - allocs/op
480
allocs/op480
allocs/op1
BenchmarkRBACModelSizes/medium
495157
ns/op 191647 B/op 4828 allocs/op542076
ns/op 191724 B/op 4827 allocs/op0.91
BenchmarkRBACModelSizes/medium - ns/op
495157
ns/op542076
ns/op0.91
BenchmarkRBACModelSizes/medium - B/op
191647
B/op191724
B/op1.00
BenchmarkRBACModelSizes/medium - allocs/op
4828
allocs/op4827
allocs/op1.00
BenchmarkRBACModelSizes/large
5150973
ns/op 1906223 B/op 48353 allocs/op5641269
ns/op 1899745 B/op 48170 allocs/op0.91
BenchmarkRBACModelSizes/large - ns/op
5150973
ns/op5641269
ns/op0.91
BenchmarkRBACModelSizes/large - B/op
1906223
B/op1899745
B/op1.00
BenchmarkRBACModelSizes/large - allocs/op
48353
allocs/op48170
allocs/op1.00
BenchmarkRBACModelSmall
59732
ns/op 20172 B/op 615 allocs/op63994
ns/op 20291 B/op 615 allocs/op0.93
BenchmarkRBACModelSmall - ns/op
59732
ns/op63994
ns/op0.93
BenchmarkRBACModelSmall - B/op
20172
B/op20291
B/op0.99
BenchmarkRBACModelSmall - allocs/op
615
allocs/op615
allocs/op1
BenchmarkRBACModelMedium
561631
ns/op 194653 B/op 6020 allocs/op571823
ns/op 194246 B/op 6021 allocs/op0.98
BenchmarkRBACModelMedium - ns/op
561631
ns/op571823
ns/op0.98
BenchmarkRBACModelMedium - B/op
194653
B/op194246
B/op1.00
BenchmarkRBACModelMedium - allocs/op
6020
allocs/op6021
allocs/op1.00
BenchmarkRBACModelLarge
6007372
ns/op 1940593 B/op 60598 allocs/op6022236
ns/op 1941549 B/op 60660 allocs/op1.00
BenchmarkRBACModelLarge - ns/op
6007372
ns/op6022236
ns/op1.00
BenchmarkRBACModelLarge - B/op
1940593
B/op1941549
B/op1.00
BenchmarkRBACModelLarge - allocs/op
60598
allocs/op60660
allocs/op1.00
BenchmarkRBACModelWithResourceRoles
5153
ns/op 2725 B/op 28 allocs/op5272
ns/op 2727 B/op 28 allocs/op0.98
BenchmarkRBACModelWithResourceRoles - ns/op
5153
ns/op5272
ns/op0.98
BenchmarkRBACModelWithResourceRoles - B/op
2725
B/op2727
B/op1.00
BenchmarkRBACModelWithResourceRoles - allocs/op
28
allocs/op28
allocs/op1
BenchmarkRBACModelWithDomains
5019
ns/op 1821 B/op 25 allocs/op5110
ns/op 1824 B/op 25 allocs/op0.98
BenchmarkRBACModelWithDomains - ns/op
5019
ns/op5110
ns/op0.98
BenchmarkRBACModelWithDomains - B/op
1821
B/op1824
B/op1.00
BenchmarkRBACModelWithDomains - allocs/op
25
allocs/op25
allocs/op1
BenchmarkABACModel
2762
ns/op 1528 B/op 17 allocs/op2807
ns/op 1532 B/op 17 allocs/op0.98
BenchmarkABACModel - ns/op
2762
ns/op2807
ns/op0.98
BenchmarkABACModel - B/op
1528
B/op1532
B/op1.00
BenchmarkABACModel - allocs/op
17
allocs/op17
allocs/op1
BenchmarkABACRuleModel
3889125
ns/op 1319010 B/op 40090 allocs/op3924947
ns/op 1322742 B/op 40091 allocs/op0.99
BenchmarkABACRuleModel - ns/op
3889125
ns/op3924947
ns/op0.99
BenchmarkABACRuleModel - B/op
1319010
B/op1322742
B/op1.00
BenchmarkABACRuleModel - allocs/op
40090
allocs/op40091
allocs/op1.00
BenchmarkKeyMatchModel
5960
ns/op 3056 B/op 37 allocs/op6074
ns/op 3061 B/op 37 allocs/op0.98
BenchmarkKeyMatchModel - ns/op
5960
ns/op6074
ns/op0.98
BenchmarkKeyMatchModel - B/op
3056
B/op3061
B/op1.00
BenchmarkKeyMatchModel - allocs/op
37
allocs/op37
allocs/op1
BenchmarkRBACModelWithDeny
6803
ns/op 2474 B/op 49 allocs/op6900
ns/op 2475 B/op 49 allocs/op0.99
BenchmarkRBACModelWithDeny - ns/op
6803
ns/op6900
ns/op0.99
BenchmarkRBACModelWithDeny - B/op
2474
B/op2475
B/op1.00
BenchmarkRBACModelWithDeny - allocs/op
49
allocs/op49
allocs/op1
BenchmarkPriorityModel
4161
ns/op 1757 B/op 22 allocs/op4264
ns/op 1758 B/op 22 allocs/op0.98
BenchmarkPriorityModel - ns/op
4161
ns/op4264
ns/op0.98
BenchmarkPriorityModel - B/op
1757
B/op1758
B/op1.00
BenchmarkPriorityModel - allocs/op
22
allocs/op22
allocs/op1
BenchmarkRBACModelWithDomainPatternLarge
22762
ns/op 16725 B/op 164 allocs/op24258
ns/op 16725 B/op 164 allocs/op0.94
BenchmarkRBACModelWithDomainPatternLarge - ns/op
22762
ns/op24258
ns/op0.94
BenchmarkRBACModelWithDomainPatternLarge - B/op
16725
B/op16725
B/op1
BenchmarkRBACModelWithDomainPatternLarge - allocs/op
164
allocs/op164
allocs/op1
BenchmarkRoleManagerSmall
68918
ns/op 11954 B/op 797 allocs/op72457
ns/op 11955 B/op 797 allocs/op0.95
BenchmarkRoleManagerSmall - ns/op
68918
ns/op72457
ns/op0.95
BenchmarkRoleManagerSmall - B/op
11954
B/op11955
B/op1.00
BenchmarkRoleManagerSmall - allocs/op
797
allocs/op797
allocs/op1
BenchmarkRoleManagerMedium
725375
ns/op 125914 B/op 8741 allocs/op731324
ns/op 125914 B/op 8741 allocs/op0.99
BenchmarkRoleManagerMedium - ns/op
725375
ns/op731324
ns/op0.99
BenchmarkRoleManagerMedium - B/op
125914
B/op125914
B/op1
BenchmarkRoleManagerMedium - allocs/op
8741
allocs/op8741
allocs/op1
BenchmarkRoleManagerLarge
7624543
ns/op 1349922 B/op 89741 allocs/op8233351
ns/op 1349925 B/op 89741 allocs/op0.93
BenchmarkRoleManagerLarge - ns/op
7624543
ns/op8233351
ns/op0.93
BenchmarkRoleManagerLarge - B/op
1349922
B/op1349925
B/op1.00
BenchmarkRoleManagerLarge - allocs/op
89741
allocs/op89741
allocs/op1
BenchmarkBuildRoleLinksWithPatternLarge
5905623189
ns/op 5318694536 B/op 60943128 allocs/op6206621355
ns/op 5343071792 B/op 60948569 allocs/op0.95
BenchmarkBuildRoleLinksWithPatternLarge - ns/op
5905623189
ns/op6206621355
ns/op0.95
BenchmarkBuildRoleLinksWithPatternLarge - B/op
5318694536
B/op5343071792
B/op1.00
BenchmarkBuildRoleLinksWithPatternLarge - allocs/op
60943128
allocs/op60948569
allocs/op1.00
BenchmarkBuildRoleLinksWithDomainPatternLarge
163510188
ns/op 140879097 B/op 1676339 allocs/op168311104
ns/op 141535321 B/op 1676485 allocs/op0.97
BenchmarkBuildRoleLinksWithDomainPatternLarge - ns/op
163510188
ns/op168311104
ns/op0.97
BenchmarkBuildRoleLinksWithDomainPatternLarge - B/op
140879097
B/op141535321
B/op1.00
BenchmarkBuildRoleLinksWithDomainPatternLarge - allocs/op
1676339
allocs/op1676485
allocs/op1.00
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge
6104538856
ns/op 5456735352 B/op 62553863 allocs/op6397425812
ns/op 5485469712 B/op 62560148 allocs/op0.95
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - ns/op
6104538856
ns/op6397425812
ns/op0.95
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - B/op
5456735352
B/op5485469712
B/op0.99
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - allocs/op
62553863
allocs/op62560148
allocs/op1.00
BenchmarkHasLinkWithPatternLarge
10221
ns/op 7579 B/op 111 allocs/op11270
ns/op 7607 B/op 111 allocs/op0.91
BenchmarkHasLinkWithPatternLarge - ns/op
10221
ns/op11270
ns/op0.91
BenchmarkHasLinkWithPatternLarge - B/op
7579
B/op7607
B/op1.00
BenchmarkHasLinkWithPatternLarge - allocs/op
111
allocs/op111
allocs/op1
BenchmarkHasLinkWithDomainPatternLarge
470.4
ns/op 80 B/op 5 allocs/op473.9
ns/op 80 B/op 5 allocs/op0.99
BenchmarkHasLinkWithDomainPatternLarge - ns/op
470.4
ns/op473.9
ns/op0.99
BenchmarkHasLinkWithDomainPatternLarge - B/op
80
B/op80
B/op1
BenchmarkHasLinkWithDomainPatternLarge - allocs/op
5
allocs/op5
allocs/op1
BenchmarkHasLinkWithPatternAndDomainPatternLarge
10264
ns/op 7597 B/op 111 allocs/op10531
ns/op 7612 B/op 111 allocs/op0.97
BenchmarkHasLinkWithPatternAndDomainPatternLarge - ns/op
10264
ns/op10531
ns/op0.97
BenchmarkHasLinkWithPatternAndDomainPatternLarge - B/op
7597
B/op7612
B/op1.00
BenchmarkHasLinkWithPatternAndDomainPatternLarge - allocs/op
111
allocs/op111
allocs/op1
This comment was automatically generated by workflow using github-action-benchmark.