-
-
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: improve
GetNamedImplicitPermissionsForUser
performance (#1405)
- Loading branch information
Showing
1 changed file
with
13 additions
and
4 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
eec10eb
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.41
ns/op 0 B/op 0 allocs/op17.41
ns/op 0 B/op 0 allocs/op1
BenchmarkCachedRaw - ns/op
17.41
ns/op17.41
ns/op1
BenchmarkCachedRaw - B/op
0
B/op0
B/op1
BenchmarkCachedRaw - allocs/op
0
allocs/op0
allocs/op1
BenchmarkCachedBasicModel
171.5
ns/op 104 B/op 4 allocs/op168.3
ns/op 104 B/op 4 allocs/op1.02
BenchmarkCachedBasicModel - ns/op
171.5
ns/op168.3
ns/op1.02
BenchmarkCachedBasicModel - B/op
104
B/op104
B/op1
BenchmarkCachedBasicModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModel
170.3
ns/op 104 B/op 4 allocs/op171.4
ns/op 104 B/op 4 allocs/op0.99
BenchmarkCachedRBACModel - ns/op
170.3
ns/op171.4
ns/op0.99
BenchmarkCachedRBACModel - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelSmall
178.2
ns/op 104 B/op 4 allocs/op176.4
ns/op 104 B/op 4 allocs/op1.01
BenchmarkCachedRBACModelSmall - ns/op
178.2
ns/op176.4
ns/op1.01
BenchmarkCachedRBACModelSmall - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelSmall - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelMedium
185.7
ns/op 104 B/op 4 allocs/op182.9
ns/op 104 B/op 4 allocs/op1.02
BenchmarkCachedRBACModelMedium - ns/op
185.7
ns/op182.9
ns/op1.02
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/op159.2
ns/op 96 B/op 3 allocs/op0.97
BenchmarkCachedRBACModelLarge - ns/op
154.4
ns/op159.2
ns/op0.97
BenchmarkCachedRBACModelLarge - B/op
96
B/op96
B/op1
BenchmarkCachedRBACModelLarge - allocs/op
3
allocs/op3
allocs/op1
BenchmarkCachedRBACModelWithResourceRoles
170.7
ns/op 104 B/op 4 allocs/op175.6
ns/op 104 B/op 4 allocs/op0.97
BenchmarkCachedRBACModelWithResourceRoles - ns/op
170.7
ns/op175.6
ns/op0.97
BenchmarkCachedRBACModelWithResourceRoles - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelWithResourceRoles - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelWithDomains
182.6
ns/op 120 B/op 4 allocs/op182.5
ns/op 120 B/op 4 allocs/op1.00
BenchmarkCachedRBACModelWithDomains - ns/op
182.6
ns/op182.5
ns/op1.00
BenchmarkCachedRBACModelWithDomains - B/op
120
B/op120
B/op1
BenchmarkCachedRBACModelWithDomains - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedABACModel
2831
ns/op 1543 B/op 18 allocs/op2906
ns/op 1546 B/op 18 allocs/op0.97
BenchmarkCachedABACModel - ns/op
2831
ns/op2906
ns/op0.97
BenchmarkCachedABACModel - B/op
1543
B/op1546
B/op1.00
BenchmarkCachedABACModel - allocs/op
18
allocs/op18
allocs/op1
BenchmarkCachedKeyMatchModel
189.4
ns/op 152 B/op 4 allocs/op190.2
ns/op 152 B/op 4 allocs/op1.00
BenchmarkCachedKeyMatchModel - ns/op
189.4
ns/op190.2
ns/op1.00
BenchmarkCachedKeyMatchModel - B/op
152
B/op152
B/op1
BenchmarkCachedKeyMatchModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelWithDeny
171
ns/op 104 B/op 4 allocs/op170.5
ns/op 104 B/op 4 allocs/op1.00
BenchmarkCachedRBACModelWithDeny - ns/op
171
ns/op170.5
ns/op1.00
BenchmarkCachedRBACModelWithDeny - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelWithDeny - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedPriorityModel
170.9
ns/op 104 B/op 4 allocs/op170.7
ns/op 104 B/op 4 allocs/op1.00
BenchmarkCachedPriorityModel - ns/op
170.9
ns/op170.7
ns/op1.00
BenchmarkCachedPriorityModel - B/op
104
B/op104
B/op1
BenchmarkCachedPriorityModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedWithEnforceContext
305.4
ns/op 240 B/op 5 allocs/op306.9
ns/op 240 B/op 5 allocs/op1.00
BenchmarkCachedWithEnforceContext - ns/op
305.4
ns/op306.9
ns/op1.00
BenchmarkCachedWithEnforceContext - B/op
240
B/op240
B/op1
BenchmarkCachedWithEnforceContext - allocs/op
5
allocs/op5
allocs/op1
BenchmarkCachedRBACModelMediumParallel
164.4
ns/op 105 B/op 4 allocs/op168.4
ns/op 105 B/op 4 allocs/op0.98
BenchmarkCachedRBACModelMediumParallel - ns/op
164.4
ns/op168.4
ns/op0.98
BenchmarkCachedRBACModelMediumParallel - B/op
105
B/op105
B/op1
BenchmarkCachedRBACModelMediumParallel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkHasPolicySmall
533.4
ns/op 150 B/op 6 allocs/op519.1
ns/op 150 B/op 6 allocs/op1.03
BenchmarkHasPolicySmall - ns/op
533.4
ns/op519.1
ns/op1.03
BenchmarkHasPolicySmall - B/op
150
B/op150
B/op1
BenchmarkHasPolicySmall - allocs/op
6
allocs/op6
allocs/op1
BenchmarkHasPolicyMedium
566.8
ns/op 157 B/op 6 allocs/op553.3
ns/op 157 B/op 6 allocs/op1.02
BenchmarkHasPolicyMedium - ns/op
566.8
ns/op553.3
ns/op1.02
BenchmarkHasPolicyMedium - B/op
157
B/op157
B/op1
BenchmarkHasPolicyMedium - allocs/op
6
allocs/op6
allocs/op1
BenchmarkHasPolicyLarge
560.5
ns/op 165 B/op 7 allocs/op589.4
ns/op 165 B/op 7 allocs/op0.95
BenchmarkHasPolicyLarge - ns/op
560.5
ns/op589.4
ns/op0.95
BenchmarkHasPolicyLarge - B/op
165
B/op165
B/op1
BenchmarkHasPolicyLarge - allocs/op
7
allocs/op7
allocs/op1
BenchmarkAddPolicySmall
515.9
ns/op 152 B/op 6 allocs/op553.1
ns/op 152 B/op 6 allocs/op0.93
BenchmarkAddPolicySmall - ns/op
515.9
ns/op553.1
ns/op0.93
BenchmarkAddPolicySmall - B/op
152
B/op152
B/op1
BenchmarkAddPolicySmall - allocs/op
6
allocs/op6
allocs/op1
BenchmarkAddPolicyMedium
561.9
ns/op 168 B/op 7 allocs/op645.8
ns/op 169 B/op 7 allocs/op0.87
BenchmarkAddPolicyMedium - ns/op
561.9
ns/op645.8
ns/op0.87
BenchmarkAddPolicyMedium - B/op
168
B/op169
B/op0.99
BenchmarkAddPolicyMedium - allocs/op
7
allocs/op7
allocs/op1
BenchmarkAddPolicyLarge
1272
ns/op 459 B/op 9 allocs/op1242
ns/op 464 B/op 9 allocs/op1.02
BenchmarkAddPolicyLarge - ns/op
1272
ns/op1242
ns/op1.02
BenchmarkAddPolicyLarge - B/op
459
B/op464
B/op0.99
BenchmarkAddPolicyLarge - allocs/op
9
allocs/op9
allocs/op1
BenchmarkRemovePolicySmall
551.7
ns/op 166 B/op 7 allocs/op522.1
ns/op 166 B/op 7 allocs/op1.06
BenchmarkRemovePolicySmall - ns/op
551.7
ns/op522.1
ns/op1.06
BenchmarkRemovePolicySmall - B/op
166
B/op166
B/op1
BenchmarkRemovePolicySmall - allocs/op
7
allocs/op7
allocs/op1
BenchmarkRemovePolicyMedium
587.8
ns/op 175 B/op 7 allocs/op558.8
ns/op 175 B/op 7 allocs/op1.05
BenchmarkRemovePolicyMedium - ns/op
587.8
ns/op558.8
ns/op1.05
BenchmarkRemovePolicyMedium - B/op
175
B/op175
B/op1
BenchmarkRemovePolicyMedium - allocs/op
7
allocs/op7
allocs/op1
BenchmarkRemovePolicyLarge
1315
ns/op 281 B/op 12 allocs/op1322
ns/op 288 B/op 13 allocs/op0.99
BenchmarkRemovePolicyLarge - ns/op
1315
ns/op1322
ns/op0.99
BenchmarkRemovePolicyLarge - B/op
281
B/op288
B/op0.98
BenchmarkRemovePolicyLarge - allocs/op
12
allocs/op13
allocs/op0.92
BenchmarkRaw
17.56
ns/op 0 B/op 0 allocs/op17.58
ns/op 0 B/op 0 allocs/op1.00
BenchmarkRaw - ns/op
17.56
ns/op17.58
ns/op1.00
BenchmarkRaw - B/op
0
B/op0
B/op1
BenchmarkRaw - allocs/op
0
allocs/op0
allocs/op1
BenchmarkBasicModel
3581
ns/op 1504 B/op 17 allocs/op3690
ns/op 1509 B/op 17 allocs/op0.97
BenchmarkBasicModel - ns/op
3581
ns/op3690
ns/op0.97
BenchmarkBasicModel - B/op
1504
B/op1509
B/op1.00
BenchmarkBasicModel - allocs/op
17
allocs/op17
allocs/op1
BenchmarkRBACModel
5283
ns/op 2058 B/op 35 allocs/op5549
ns/op 2069 B/op 35 allocs/op0.95
BenchmarkRBACModel - ns/op
5283
ns/op5549
ns/op0.95
BenchmarkRBACModel - B/op
2058
B/op2069
B/op0.99
BenchmarkRBACModel - allocs/op
35
allocs/op35
allocs/op1
BenchmarkRBACModelSizes/small
48025
ns/op 20266 B/op 480 allocs/op52640
ns/op 20284 B/op 480 allocs/op0.91
BenchmarkRBACModelSizes/small - ns/op
48025
ns/op52640
ns/op0.91
BenchmarkRBACModelSizes/small - B/op
20266
B/op20284
B/op1.00
BenchmarkRBACModelSizes/small - allocs/op
480
allocs/op480
allocs/op1
BenchmarkRBACModelSizes/medium
478346
ns/op 191647 B/op 4828 allocs/op534539
ns/op 191714 B/op 4829 allocs/op0.89
BenchmarkRBACModelSizes/medium - ns/op
478346
ns/op534539
ns/op0.89
BenchmarkRBACModelSizes/medium - B/op
191647
B/op191714
B/op1.00
BenchmarkRBACModelSizes/medium - allocs/op
4828
allocs/op4829
allocs/op1.00
BenchmarkRBACModelSizes/large
5163997
ns/op 1899883 B/op 48175 allocs/op6081113
ns/op 1900765 B/op 48203 allocs/op0.85
BenchmarkRBACModelSizes/large - ns/op
5163997
ns/op6081113
ns/op0.85
BenchmarkRBACModelSizes/large - B/op
1899883
B/op1900765
B/op1.00
BenchmarkRBACModelSizes/large - allocs/op
48175
allocs/op48203
allocs/op1.00
BenchmarkRBACModelSmall
58456
ns/op 20183 B/op 615 allocs/op62771
ns/op 20404 B/op 615 allocs/op0.93
BenchmarkRBACModelSmall - ns/op
58456
ns/op62771
ns/op0.93
BenchmarkRBACModelSmall - B/op
20183
B/op20404
B/op0.99
BenchmarkRBACModelSmall - allocs/op
615
allocs/op615
allocs/op1
BenchmarkRBACModelMedium
539888
ns/op 194121 B/op 6017 allocs/op595611
ns/op 194707 B/op 6018 allocs/op0.91
BenchmarkRBACModelMedium - ns/op
539888
ns/op595611
ns/op0.91
BenchmarkRBACModelMedium - B/op
194121
B/op194707
B/op1.00
BenchmarkRBACModelMedium - allocs/op
6017
allocs/op6018
allocs/op1.00
BenchmarkRBACModelLarge
5762432
ns/op 1932815 B/op 60295 allocs/op6139679
ns/op 1933403 B/op 60306 allocs/op0.94
BenchmarkRBACModelLarge - ns/op
5762432
ns/op6139679
ns/op0.94
BenchmarkRBACModelLarge - B/op
1932815
B/op1933403
B/op1.00
BenchmarkRBACModelLarge - allocs/op
60295
allocs/op60306
allocs/op1.00
BenchmarkRBACModelWithResourceRoles
5153
ns/op 2733 B/op 28 allocs/op5484
ns/op 2740 B/op 28 allocs/op0.94
BenchmarkRBACModelWithResourceRoles - ns/op
5153
ns/op5484
ns/op0.94
BenchmarkRBACModelWithResourceRoles - B/op
2733
B/op2740
B/op1.00
BenchmarkRBACModelWithResourceRoles - allocs/op
28
allocs/op28
allocs/op1
BenchmarkRBACModelWithDomains
4989
ns/op 1826 B/op 25 allocs/op5204
ns/op 1827 B/op 25 allocs/op0.96
BenchmarkRBACModelWithDomains - ns/op
4989
ns/op5204
ns/op0.96
BenchmarkRBACModelWithDomains - B/op
1826
B/op1827
B/op1.00
BenchmarkRBACModelWithDomains - allocs/op
25
allocs/op25
allocs/op1
BenchmarkABACModel
2772
ns/op 1534 B/op 17 allocs/op2879
ns/op 1537 B/op 17 allocs/op0.96
BenchmarkABACModel - ns/op
2772
ns/op2879
ns/op0.96
BenchmarkABACModel - B/op
1534
B/op1537
B/op1.00
BenchmarkABACModel - allocs/op
17
allocs/op17
allocs/op1
BenchmarkABACRuleModel
3891015
ns/op 1328409 B/op 40092 allocs/op4091106
ns/op 1329131 B/op 40092 allocs/op0.95
BenchmarkABACRuleModel - ns/op
3891015
ns/op4091106
ns/op0.95
BenchmarkABACRuleModel - B/op
1328409
B/op1329131
B/op1.00
BenchmarkABACRuleModel - allocs/op
40092
allocs/op40092
allocs/op1
BenchmarkKeyMatchModel
5991
ns/op 3064 B/op 37 allocs/op6298
ns/op 3074 B/op 37 allocs/op0.95
BenchmarkKeyMatchModel - ns/op
5991
ns/op6298
ns/op0.95
BenchmarkKeyMatchModel - B/op
3064
B/op3074
B/op1.00
BenchmarkKeyMatchModel - allocs/op
37
allocs/op37
allocs/op1
BenchmarkRBACModelWithDeny
6883
ns/op 2482 B/op 49 allocs/op6978
ns/op 2482 B/op 49 allocs/op0.99
BenchmarkRBACModelWithDeny - ns/op
6883
ns/op6978
ns/op0.99
BenchmarkRBACModelWithDeny - B/op
2482
B/op2482
B/op1
BenchmarkRBACModelWithDeny - allocs/op
49
allocs/op49
allocs/op1
BenchmarkPriorityModel
4133
ns/op 1763 B/op 22 allocs/op4305
ns/op 1765 B/op 22 allocs/op0.96
BenchmarkPriorityModel - ns/op
4133
ns/op4305
ns/op0.96
BenchmarkPriorityModel - B/op
1763
B/op1765
B/op1.00
BenchmarkPriorityModel - allocs/op
22
allocs/op22
allocs/op1
BenchmarkRBACModelWithDomainPatternLarge
22314
ns/op 16738 B/op 164 allocs/op24866
ns/op 16722 B/op 164 allocs/op0.90
BenchmarkRBACModelWithDomainPatternLarge - ns/op
22314
ns/op24866
ns/op0.90
BenchmarkRBACModelWithDomainPatternLarge - B/op
16738
B/op16722
B/op1.00
BenchmarkRBACModelWithDomainPatternLarge - allocs/op
164
allocs/op164
allocs/op1
BenchmarkRoleManagerSmall
67739
ns/op 11954 B/op 797 allocs/op72311
ns/op 11955 B/op 797 allocs/op0.94
BenchmarkRoleManagerSmall - ns/op
67739
ns/op72311
ns/op0.94
BenchmarkRoleManagerSmall - B/op
11954
B/op11955
B/op1.00
BenchmarkRoleManagerSmall - allocs/op
797
allocs/op797
allocs/op1
BenchmarkRoleManagerMedium
714578
ns/op 125914 B/op 8741 allocs/op736318
ns/op 125915 B/op 8741 allocs/op0.97
BenchmarkRoleManagerMedium - ns/op
714578
ns/op736318
ns/op0.97
BenchmarkRoleManagerMedium - B/op
125914
B/op125915
B/op1.00
BenchmarkRoleManagerMedium - allocs/op
8741
allocs/op8741
allocs/op1
BenchmarkRoleManagerLarge
7732673
ns/op 1349919 B/op 89741 allocs/op7947330
ns/op 1349921 B/op 89741 allocs/op0.97
BenchmarkRoleManagerLarge - ns/op
7732673
ns/op7947330
ns/op0.97
BenchmarkRoleManagerLarge - B/op
1349919
B/op1349921
B/op1.00
BenchmarkRoleManagerLarge - allocs/op
89741
allocs/op89741
allocs/op1
BenchmarkBuildRoleLinksWithPatternLarge
5859712437
ns/op 5345583480 B/op 60948514 allocs/op6416438245
ns/op 5345527312 B/op 60949275 allocs/op0.91
BenchmarkBuildRoleLinksWithPatternLarge - ns/op
5859712437
ns/op6416438245
ns/op0.91
BenchmarkBuildRoleLinksWithPatternLarge - B/op
5345583480
B/op5345527312
B/op1.00
BenchmarkBuildRoleLinksWithPatternLarge - allocs/op
60948514
allocs/op60949275
allocs/op1.00
BenchmarkBuildRoleLinksWithDomainPatternLarge
162026121
ns/op 141772106 B/op 1676515 allocs/op178943074
ns/op 141563910 B/op 1676494 allocs/op0.91
BenchmarkBuildRoleLinksWithDomainPatternLarge - ns/op
162026121
ns/op178943074
ns/op0.91
BenchmarkBuildRoleLinksWithDomainPatternLarge - B/op
141772106
B/op141563910
B/op1.00
BenchmarkBuildRoleLinksWithDomainPatternLarge - allocs/op
1676515
allocs/op1676494
allocs/op1.00
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge
6034492315
ns/op 5485225440 B/op 62559574 allocs/op6619276996
ns/op 5482336640 B/op 62559659 allocs/op0.91
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - ns/op
6034492315
ns/op6619276996
ns/op0.91
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - B/op
5485225440
B/op5482336640
B/op1.00
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - allocs/op
62559574
allocs/op62559659
allocs/op1.00
BenchmarkHasLinkWithPatternLarge
9997
ns/op 7606 B/op 111 allocs/op10949
ns/op 7606 B/op 111 allocs/op0.91
BenchmarkHasLinkWithPatternLarge - ns/op
9997
ns/op10949
ns/op0.91
BenchmarkHasLinkWithPatternLarge - B/op
7606
B/op7606
B/op1
BenchmarkHasLinkWithPatternLarge - allocs/op
111
allocs/op111
allocs/op1
BenchmarkHasLinkWithDomainPatternLarge
470.9
ns/op 80 B/op 5 allocs/op500.9
ns/op 80 B/op 5 allocs/op0.94
BenchmarkHasLinkWithDomainPatternLarge - ns/op
470.9
ns/op500.9
ns/op0.94
BenchmarkHasLinkWithDomainPatternLarge - B/op
80
B/op80
B/op1
BenchmarkHasLinkWithDomainPatternLarge - allocs/op
5
allocs/op5
allocs/op1
BenchmarkHasLinkWithPatternAndDomainPatternLarge
9990
ns/op 7611 B/op 111 allocs/op10644
ns/op 7604 B/op 111 allocs/op0.94
BenchmarkHasLinkWithPatternAndDomainPatternLarge - ns/op
9990
ns/op10644
ns/op0.94
BenchmarkHasLinkWithPatternAndDomainPatternLarge - B/op
7611
B/op7604
B/op1.00
BenchmarkHasLinkWithPatternAndDomainPatternLarge - allocs/op
111
allocs/op111
allocs/op1
This comment was automatically generated by workflow using github-action-benchmark.