File tree Expand file tree Collapse file tree 4 files changed +1709
-1043
lines changed Expand file tree Collapse file tree 4 files changed +1709
-1043
lines changed Original file line number Diff line number Diff line change 14
14
php :
15
15
- " 8.2"
16
16
- " 8.3"
17
- dependencies :
18
- - " lowest"
19
- - " highest"
17
+ # dependencies:
18
+ # - "lowest"
19
+ # - "highest"
20
20
include :
21
21
- php-version : " 8.3"
22
22
composer-options : " --ignore-platform-reqs"
30
30
- name : Composer install
31
31
uses : " ramsey/composer-install@v3"
32
32
with :
33
- dependency-versions : " ${{ matrix.dependencies }}"
33
+ # dependency-versions: "${{ matrix.dependencies }}"
34
34
composer-options : " ${{ matrix.composer-options }}"
35
35
36
36
- name : PHPStan static analysis
Original file line number Diff line number Diff line change 31
31
echo 'Available hash algos: ' . implode (', ' , hash_algos ()) . PHP_EOL . PHP_EOL ;
32
32
33
33
// How many data points do we generate?
34
- $ dataCount = 35000 ;
34
+ $ dataCount = 25000 ;
35
35
// How many times do we re-generate the data and re-hash it?
36
36
$ dataIterations = 10 ;
37
37
49
49
'node2 ' => 30 ,
50
50
'node3 ' => 50 ,
51
51
],
52
+ '15 15 25 45 ' => [
53
+ 'node1 ' => 15 ,
54
+ 'node2 ' => 15 ,
55
+ 'node3 ' => 25 ,
56
+ 'node4 ' => 45 ,
57
+ ],
58
+ '50 20 20 5 5 ' => [
59
+ 'node1 ' => 50 ,
60
+ 'node2 ' => 20 ,
61
+ 'node3 ' => 20 ,
62
+ 'node4 ' => 5 ,
63
+ 'node5 ' => 5 ,
64
+ ],
52
65
'25 25 25 25 ' => [
53
66
'node1 ' => 100 /4 ,
54
67
'node2 ' => 100 /4 ,
112
125
'node9 ' => 100 /10 ,
113
126
'node10 ' => 100 /10 ,
114
127
],
115
- '11 11 11 11 11 11 11 11 11 11 11 ' => [
128
+ '9.09 9.09 9.09 9.09 9.09 9.09 9.09 9.09 9.09 9.09 9.09 ' => [
116
129
'node1 ' => 100 /11 ,
117
130
'node2 ' => 100 /11 ,
118
131
'node3 ' => 100 /11 ,
125
138
'node10 ' => 100 /11 ,
126
139
'node11 ' => 100 /11 ,
127
140
],
128
- '15 15 25 45 ' => [
129
- 'node1 ' => 15 ,
130
- 'node2 ' => 15 ,
131
- 'node3 ' => 25 ,
132
- 'node4 ' => 45 ,
133
- ],
134
- '50 20 20 5 5 ' => [
135
- 'node1 ' => 50 ,
136
- 'node2 ' => 20 ,
137
- 'node3 ' => 20 ,
138
- 'node4 ' => 5 ,
139
- 'node5 ' => 5 ,
141
+ '3 1 5 1 ' => [
142
+ 'node1 ' => 3 ,
143
+ 'node2 ' => 1 ,
144
+ 'node3 ' => 5 ,
145
+ 'node4 ' => 1 ,
140
146
],
141
147
'1 1 ' => [
142
148
'node1 ' => 1 ,
280
286
$ time = (microtime (true ) - $ time ) * 1000 ;
281
287
282
288
$ total = array_sum ($ distribution );
289
+
290
+ // Convert the weights to an expected percentage of the total distribution
291
+ $ nodeDistributionTotalWeight = array_sum ($ nodeDistribution );
292
+ $ nodeDistributionPercentages = [];
293
+ foreach ($ nodeDistribution as $ nodeName => $ weight ) {
294
+ $ nodeDistributionPercentages [$ nodeName ] = $ weight * 100 / $ nodeDistributionTotalWeight ;
295
+ }
296
+
297
+ // Calculate the deviation from the perfect distribution percentage
283
298
foreach ($ distribution as $ nodeName => &$ count ) {
284
- $ count = abs ($ nodeDistribution [$ nodeName ] - ($ count / $ total * 100 ));
299
+ $ count = abs ($ nodeDistributionPercentages [$ nodeName ] - ($ count / $ total * 100 ));
285
300
}
286
301
287
302
$ totalIterationDeviation = array_sum ($ distribution );
You can’t perform that action at this time.
0 commit comments