Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: fix concurrent map writes issue in getCachedResult() (#1348)
Co-authored-by: king <yewei@myhayo.com>
- Loading branch information
953c551
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 - ns/op
17.51
ns/op17.65
ns/op0.99
BenchmarkCachedRaw - B/op
0
B/op0
B/opNaN
BenchmarkCachedRaw - allocs/op
0
allocs/op0
allocs/opNaN
BenchmarkCachedBasicModel - ns/op
165.8
ns/op165.6
ns/op1.00
BenchmarkCachedBasicModel - B/op
104
B/op104
B/op1
BenchmarkCachedBasicModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModel - ns/op
165.6
ns/op161.6
ns/op1.02
BenchmarkCachedRBACModel - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelSmall - ns/op
175.9
ns/op176.6
ns/op1.00
BenchmarkCachedRBACModelSmall - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelSmall - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelMedium - ns/op
181.8
ns/op188.1
ns/op0.97
BenchmarkCachedRBACModelMedium - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelMedium - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelLarge - ns/op
166.6
ns/op156.4
ns/op1.07
BenchmarkCachedRBACModelLarge - B/op
96
B/op96
B/op1
BenchmarkCachedRBACModelLarge - allocs/op
3
allocs/op3
allocs/op1
BenchmarkCachedRBACModelWithResourceRoles - ns/op
165.9
ns/op163.9
ns/op1.01
BenchmarkCachedRBACModelWithResourceRoles - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelWithResourceRoles - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelWithDomains - ns/op
175
ns/op178.4
ns/op0.98
BenchmarkCachedRBACModelWithDomains - B/op
120
B/op120
B/op1
BenchmarkCachedRBACModelWithDomains - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedABACModel - ns/op
2905
ns/op2979
ns/op0.98
BenchmarkCachedABACModel - B/op
1541
B/op1538
B/op1.00
BenchmarkCachedABACModel - allocs/op
18
allocs/op18
allocs/op1
BenchmarkCachedKeyMatchModel - ns/op
182.5
ns/op176.2
ns/op1.04
BenchmarkCachedKeyMatchModel - B/op
152
B/op152
B/op1
BenchmarkCachedKeyMatchModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedRBACModelWithDeny - ns/op
166.7
ns/op168.8
ns/op0.99
BenchmarkCachedRBACModelWithDeny - B/op
104
B/op104
B/op1
BenchmarkCachedRBACModelWithDeny - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedPriorityModel - ns/op
170
ns/op162.5
ns/op1.05
BenchmarkCachedPriorityModel - B/op
104
B/op104
B/op1
BenchmarkCachedPriorityModel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkCachedWithEnforceContext - ns/op
307.7
ns/op295.5
ns/op1.04
BenchmarkCachedWithEnforceContext - B/op
240
B/op240
B/op1
BenchmarkCachedWithEnforceContext - allocs/op
5
allocs/op5
allocs/op1
BenchmarkCachedRBACModelMediumParallel - ns/op
167.4
ns/op121.7
ns/op1.38
BenchmarkCachedRBACModelMediumParallel - B/op
106
B/op105
B/op1.01
BenchmarkCachedRBACModelMediumParallel - allocs/op
4
allocs/op4
allocs/op1
BenchmarkHasPolicySmall - ns/op
449.3
ns/op444.1
ns/op1.01
BenchmarkHasPolicySmall - B/op
150
B/op150
B/op1
BenchmarkHasPolicySmall - allocs/op
6
allocs/op6
allocs/op1
BenchmarkHasPolicyMedium - ns/op
480.6
ns/op483.9
ns/op0.99
BenchmarkHasPolicyMedium - B/op
157
B/op157
B/op1
BenchmarkHasPolicyMedium - allocs/op
6
allocs/op6
allocs/op1
BenchmarkHasPolicyLarge - ns/op
502.2
ns/op503.8
ns/op1.00
BenchmarkHasPolicyLarge - B/op
165
B/op165
B/op1
BenchmarkHasPolicyLarge - allocs/op
7
allocs/op7
allocs/op1
BenchmarkAddPolicySmall - ns/op
473.5
ns/op488.2
ns/op0.97
BenchmarkAddPolicySmall - B/op
152
B/op152
B/op1
BenchmarkAddPolicySmall - allocs/op
6
allocs/op6
allocs/op1
BenchmarkAddPolicyMedium - ns/op
549.4
ns/op563.3
ns/op0.98
BenchmarkAddPolicyMedium - B/op
172
B/op173
B/op0.99
BenchmarkAddPolicyMedium - allocs/op
7
allocs/op7
allocs/op1
BenchmarkAddPolicyLarge - ns/op
1116
ns/op1218
ns/op0.92
BenchmarkAddPolicyLarge - B/op
473
B/op473
B/op1
BenchmarkAddPolicyLarge - allocs/op
9
allocs/op9
allocs/op1
BenchmarkRemovePolicySmall - ns/op
503.9
ns/op488.5
ns/op1.03
BenchmarkRemovePolicySmall - B/op
166
B/op166
B/op1
BenchmarkRemovePolicySmall - allocs/op
7
allocs/op7
allocs/op1
BenchmarkRemovePolicyMedium - ns/op
556
ns/op554.2
ns/op1.00
BenchmarkRemovePolicyMedium - B/op
176
B/op176
B/op1
BenchmarkRemovePolicyMedium - allocs/op
7
allocs/op7
allocs/op1
BenchmarkRemovePolicyLarge - ns/op
1257
ns/op1212
ns/op1.04
BenchmarkRemovePolicyLarge - B/op
283
B/op291
B/op0.97
BenchmarkRemovePolicyLarge - allocs/op
12
allocs/op13
allocs/op0.92
BenchmarkRaw - ns/op
17.51
ns/op17.68
ns/op0.99
BenchmarkRaw - B/op
0
B/op0
B/opNaN
BenchmarkRaw - allocs/op
0
allocs/op0
allocs/opNaN
BenchmarkBasicModel - ns/op
3636
ns/op3719
ns/op0.98
BenchmarkBasicModel - B/op
1506
B/op1508
B/op1.00
BenchmarkBasicModel - allocs/op
17
allocs/op17
allocs/op1
BenchmarkRBACModel - ns/op
5494
ns/op5489
ns/op1.00
BenchmarkRBACModel - B/op
2062
B/op2065
B/op1.00
BenchmarkRBACModel - allocs/op
35
allocs/op35
allocs/op1
BenchmarkRBACModelSizes/small - ns/op
47369
ns/op49969
ns/op0.95
BenchmarkRBACModelSizes/small - B/op
20170
B/op20271
B/op1.00
BenchmarkRBACModelSizes/small - allocs/op
480
allocs/op480
allocs/op1
BenchmarkRBACModelSizes/medium - ns/op
496395
ns/op511984
ns/op0.97
BenchmarkRBACModelSizes/medium - B/op
191741
B/op191257
B/op1.00
BenchmarkRBACModelSizes/medium - allocs/op
4829
allocs/op4829
allocs/op1
BenchmarkRBACModelSizes/large - ns/op
5279219
ns/op5195604
ns/op1.02
BenchmarkRBACModelSizes/large - B/op
1901542
B/op1906391
B/op1.00
BenchmarkRBACModelSizes/large - allocs/op
48213
allocs/op48353
allocs/op1.00
BenchmarkRBACModelSmall - ns/op
57717
ns/op59230
ns/op0.97
BenchmarkRBACModelSmall - B/op
20291
B/op20352
B/op1.00
BenchmarkRBACModelSmall - allocs/op
615
allocs/op615
allocs/op1
BenchmarkRBACModelMedium - ns/op
571714
ns/op576178
ns/op0.99
BenchmarkRBACModelMedium - B/op
194685
B/op194638
B/op1.00
BenchmarkRBACModelMedium - allocs/op
6021
allocs/op6020
allocs/op1.00
BenchmarkRBACModelLarge - ns/op
6045148
ns/op6073531
ns/op1.00
BenchmarkRBACModelLarge - B/op
1941339
B/op1940496
B/op1.00
BenchmarkRBACModelLarge - allocs/op
60608
allocs/op60599
allocs/op1.00
BenchmarkRBACModelWithResourceRoles - ns/op
4590
ns/op4605
ns/op1.00
BenchmarkRBACModelWithResourceRoles - B/op
1843
B/op1846
B/op1.00
BenchmarkRBACModelWithResourceRoles - allocs/op
27
allocs/op27
allocs/op1
BenchmarkRBACModelWithDomains - ns/op
5139
ns/op5123
ns/op1.00
BenchmarkRBACModelWithDomains - B/op
1822
B/op1824
B/op1.00
BenchmarkRBACModelWithDomains - allocs/op
25
allocs/op25
allocs/op1
BenchmarkABACModel - ns/op
2834
ns/op2858
ns/op0.99
BenchmarkABACModel - B/op
1531
B/op1536
B/op1.00
BenchmarkABACModel - allocs/op
17
allocs/op17
allocs/op1
BenchmarkABACRuleModel - ns/op
3890511
ns/op3982954
ns/op0.98
BenchmarkABACRuleModel - B/op
1320609
B/op1330745
B/op0.99
BenchmarkABACRuleModel - allocs/op
40091
allocs/op40092
allocs/op1.00
BenchmarkKeyMatchModel - ns/op
6130
ns/op6212
ns/op0.99
BenchmarkKeyMatchModel - B/op
3064
B/op3064
B/op1
BenchmarkKeyMatchModel - allocs/op
37
allocs/op37
allocs/op1
BenchmarkRBACModelWithDeny - ns/op
7000
ns/op6982
ns/op1.00
BenchmarkRBACModelWithDeny - B/op
2474
B/op2483
B/op1.00
BenchmarkRBACModelWithDeny - allocs/op
49
allocs/op49
allocs/op1
BenchmarkPriorityModel - ns/op
4200
ns/op4241
ns/op0.99
BenchmarkPriorityModel - B/op
1757
B/op1759
B/op1.00
BenchmarkPriorityModel - allocs/op
22
allocs/op22
allocs/op1
BenchmarkRBACModelWithDomainPatternLarge - ns/op
22991
ns/op23818
ns/op0.97
BenchmarkRBACModelWithDomainPatternLarge - B/op
16705
B/op16762
B/op1.00
BenchmarkRBACModelWithDomainPatternLarge - allocs/op
164
allocs/op164
allocs/op1
BenchmarkRoleManagerSmall - ns/op
69768
ns/op69717
ns/op1.00
BenchmarkRoleManagerSmall - B/op
11954
B/op11955
B/op1.00
BenchmarkRoleManagerSmall - allocs/op
797
allocs/op797
allocs/op1
BenchmarkRoleManagerMedium - ns/op
736714
ns/op741601
ns/op0.99
BenchmarkRoleManagerMedium - B/op
125915
B/op125914
B/op1.00
BenchmarkRoleManagerMedium - allocs/op
8741
allocs/op8741
allocs/op1
BenchmarkRoleManagerLarge - ns/op
8285580
ns/op8214236
ns/op1.01
BenchmarkRoleManagerLarge - B/op
1349926
B/op1349923
B/op1.00
BenchmarkRoleManagerLarge - allocs/op
89741
allocs/op89741
allocs/op1
BenchmarkBuildRoleLinksWithPatternLarge - ns/op
5937835409
ns/op6040649458
ns/op0.98
BenchmarkBuildRoleLinksWithPatternLarge - B/op
5335847336
B/op5350679168
B/op1.00
BenchmarkBuildRoleLinksWithPatternLarge - allocs/op
60947073
allocs/op60950665
allocs/op1.00
BenchmarkBuildRoleLinksWithDomainPatternLarge - ns/op
160150213
ns/op163583356
ns/op0.98
BenchmarkBuildRoleLinksWithDomainPatternLarge - B/op
141139862
B/op141030638
B/op1.00
BenchmarkBuildRoleLinksWithDomainPatternLarge - allocs/op
1676456
allocs/op1676469
allocs/op1.00
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - ns/op
6130166912
ns/op6200676971
ns/op0.99
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - B/op
5473784224
B/op5472251672
B/op1.00
BenchmarkBuildRoleLinksWithPatternAndDomainPatternLarge - allocs/op
62557797
allocs/op62557899
allocs/op1.00
BenchmarkHasLinkWithPatternLarge - ns/op
10376
ns/op11049
ns/op0.94
BenchmarkHasLinkWithPatternLarge - B/op
7599
B/op7599
B/op1
BenchmarkHasLinkWithPatternLarge - allocs/op
111
allocs/op111
allocs/op1
BenchmarkHasLinkWithDomainPatternLarge - ns/op
485.6
ns/op498.3
ns/op0.97
BenchmarkHasLinkWithDomainPatternLarge - B/op
80
B/op80
B/op1
BenchmarkHasLinkWithDomainPatternLarge - allocs/op
5
allocs/op5
allocs/op1
BenchmarkHasLinkWithPatternAndDomainPatternLarge - ns/op
10113
ns/op10253
ns/op0.99
BenchmarkHasLinkWithPatternAndDomainPatternLarge - B/op
7604
B/op7602
B/op1.00
BenchmarkHasLinkWithPatternAndDomainPatternLarge - allocs/op
111
allocs/op111
allocs/op1
This comment was automatically generated by workflow using github-action-benchmark.
953c551
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
.BenchmarkCachedRBACModelMediumParallel - ns/op
167.4
ns/op121.7
ns/op1.38
This comment was automatically generated by workflow using github-action-benchmark.