Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: move network core metrics to separate file #5445

Merged
merged 2 commits into from
May 1, 2023

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented May 1, 2023

Motivation

Description

Moves metrics related to components that may be placed in a separate thread into another file. The purpose of this PR is to move trivial changes out of the larger #5351

@dapplion dapplion requested a review from a team as a code owner May 1, 2023 10:05
@dapplion dapplion force-pushed the dapplion/network-core-metrics branch from 3b72c38 to 08b0dd1 Compare May 1, 2023 11:31
@github-actions
Copy link
Contributor

github-actions bot commented May 1, 2023

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: b51dd78 Previous: 28f5cec Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.0632 ms/op 604.37 us/op 1.76
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 57.988 us/op 59.767 us/op 0.97
BLS verify - blst-native 1.5188 ms/op 1.2689 ms/op 1.20
BLS verifyMultipleSignatures 3 - blst-native 3.0332 ms/op 2.6030 ms/op 1.17
BLS verifyMultipleSignatures 8 - blst-native 6.4784 ms/op 5.7284 ms/op 1.13
BLS verifyMultipleSignatures 32 - blst-native 23.490 ms/op 20.356 ms/op 1.15
BLS aggregatePubkeys 32 - blst-native 30.647 us/op 28.584 us/op 1.07
BLS aggregatePubkeys 128 - blst-native 122.78 us/op 115.50 us/op 1.06
getAttestationsForBlock 69.160 ms/op 84.902 ms/op 0.81
isKnown best case - 1 super set check 326.00 ns/op 305.00 ns/op 1.07
isKnown normal case - 2 super set checks 338.00 ns/op 296.00 ns/op 1.14
isKnown worse case - 16 super set checks 324.00 ns/op 302.00 ns/op 1.07
CheckpointStateCache - add get delete 6.8920 us/op 6.6500 us/op 1.04
validate gossip signedAggregateAndProof - struct 3.5975 ms/op 3.3277 ms/op 1.08
validate gossip attestation - struct 1.7113 ms/op 1.5015 ms/op 1.14
pickEth1Vote - no votes 1.7122 ms/op 1.4607 ms/op 1.17
pickEth1Vote - max votes 12.384 ms/op 12.792 ms/op 0.97
pickEth1Vote - Eth1Data hashTreeRoot value x2048 11.339 ms/op 10.734 ms/op 1.06
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 18.781 ms/op 19.083 ms/op 0.98
pickEth1Vote - Eth1Data fastSerialize value x2048 940.52 us/op 918.22 us/op 1.02
pickEth1Vote - Eth1Data fastSerialize tree x2048 10.173 ms/op 7.4586 ms/op 1.36
bytes32 toHexString 731.00 ns/op 816.00 ns/op 0.90
bytes32 Buffer.toString(hex) 489.00 ns/op 569.00 ns/op 0.86
bytes32 Buffer.toString(hex) from Uint8Array 748.00 ns/op 682.00 ns/op 1.10
bytes32 Buffer.toString(hex) + 0x 498.00 ns/op 446.00 ns/op 1.12
Object access 1 prop 0.22200 ns/op 0.21800 ns/op 1.02
Map access 1 prop 0.20800 ns/op 0.18400 ns/op 1.13
Object get x1000 8.8560 ns/op 8.7420 ns/op 1.01
Map get x1000 0.64100 ns/op 0.67800 ns/op 0.95
Object set x1000 69.631 ns/op 74.824 ns/op 0.93
Map set x1000 60.252 ns/op 56.437 ns/op 1.07
Return object 10000 times 0.28900 ns/op 0.30990 ns/op 0.93
Throw Error 10000 times 5.5692 us/op 4.7162 us/op 1.18
fastMsgIdFn sha256 / 200 bytes 4.5950 us/op 3.7970 us/op 1.21
fastMsgIdFn h32 xxhash / 200 bytes 391.00 ns/op 358.00 ns/op 1.09
fastMsgIdFn h64 xxhash / 200 bytes 577.00 ns/op 521.00 ns/op 1.11
fastMsgIdFn sha256 / 1000 bytes 15.643 us/op 13.002 us/op 1.20
fastMsgIdFn h32 xxhash / 1000 bytes 558.00 ns/op 506.00 ns/op 1.10
fastMsgIdFn h64 xxhash / 1000 bytes 654.00 ns/op 658.00 ns/op 0.99
fastMsgIdFn sha256 / 10000 bytes 132.32 us/op 117.55 us/op 1.13
fastMsgIdFn h32 xxhash / 10000 bytes 2.4060 us/op 2.1810 us/op 1.10
fastMsgIdFn h64 xxhash / 10000 bytes 1.7900 us/op 1.5410 us/op 1.16
enrSubnets - fastDeserialize 64 bits 1.9760 us/op 1.9660 us/op 1.01
enrSubnets - ssz BitVector 64 bits 734.00 ns/op 671.00 ns/op 1.09
enrSubnets - fastDeserialize 4 bits 304.00 ns/op 240.00 ns/op 1.27
enrSubnets - ssz BitVector 4 bits 760.00 ns/op 676.00 ns/op 1.12
prioritizePeers score -10:0 att 32-0.1 sync 2-0 158.08 us/op 153.57 us/op 1.03
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 181.93 us/op 179.20 us/op 1.02
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 222.12 us/op 238.74 us/op 0.93
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 413.72 us/op 490.49 us/op 0.84
prioritizePeers score 0:0 att 64-1 sync 4-1 495.50 us/op 504.02 us/op 0.98
array of 16000 items push then shift 2.0425 us/op 2.1092 us/op 0.97
LinkedList of 16000 items push then shift 10.513 ns/op 13.633 ns/op 0.77
array of 16000 items push then pop 128.29 ns/op 140.62 ns/op 0.91
LinkedList of 16000 items push then pop 10.846 ns/op 14.387 ns/op 0.75
array of 24000 items push then shift 3.0620 us/op 3.1743 us/op 0.96
LinkedList of 24000 items push then shift 11.602 ns/op 15.120 ns/op 0.77
array of 24000 items push then pop 112.67 ns/op 109.27 ns/op 1.03
LinkedList of 24000 items push then pop 10.888 ns/op 12.159 ns/op 0.90
intersect bitArray bitLen 8 16.762 ns/op 21.398 ns/op 0.78
intersect array and set length 8 111.36 ns/op 143.36 ns/op 0.78
intersect bitArray bitLen 128 55.858 ns/op 71.650 ns/op 0.78
intersect array and set length 128 1.4517 us/op 1.8474 us/op 0.79
Buffer.concat 32 items 3.9170 us/op 4.2510 us/op 0.92
Uint8Array.set 32 items 2.8000 us/op 2.9140 us/op 0.96
pass gossip attestations to forkchoice per slot 4.0114 ms/op 4.2296 ms/op 0.95
computeDeltas 3.5672 ms/op 4.4289 ms/op 0.81
computeProposerBoostScoreFromBalances 2.1094 ms/op 2.3379 ms/op 0.90
altair processAttestation - 250000 vs - 7PWei normalcase 2.5685 ms/op 4.0300 ms/op 0.64
altair processAttestation - 250000 vs - 7PWei worstcase 3.6991 ms/op 5.3416 ms/op 0.69
altair processAttestation - setStatus - 1/6 committees join 160.72 us/op 163.62 us/op 0.98
altair processAttestation - setStatus - 1/3 committees join 313.58 us/op 301.06 us/op 1.04
altair processAttestation - setStatus - 1/2 committees join 448.44 us/op 406.86 us/op 1.10
altair processAttestation - setStatus - 2/3 committees join 564.31 us/op 542.96 us/op 1.04
altair processAttestation - setStatus - 4/5 committees join 769.84 us/op 703.79 us/op 1.09
altair processAttestation - setStatus - 100% committees join 849.53 us/op 817.74 us/op 1.04
altair processBlock - 250000 vs - 7PWei normalcase 18.056 ms/op 20.540 ms/op 0.88
altair processBlock - 250000 vs - 7PWei normalcase hashState 28.560 ms/op 30.011 ms/op 0.95
altair processBlock - 250000 vs - 7PWei worstcase 53.246 ms/op 64.447 ms/op 0.83
altair processBlock - 250000 vs - 7PWei worstcase hashState 74.899 ms/op 87.532 ms/op 0.86
phase0 processBlock - 250000 vs - 7PWei normalcase 2.5323 ms/op 2.8210 ms/op 0.90
phase0 processBlock - 250000 vs - 7PWei worstcase 34.084 ms/op 36.578 ms/op 0.93
altair processEth1Data - 250000 vs - 7PWei normalcase 593.15 us/op 637.33 us/op 0.93
vc - 250000 eb 1 eth1 1 we 0 wn 0 - smpl 15 8.1210 us/op 12.032 us/op 0.67
vc - 250000 eb 0.95 eth1 0.1 we 0.05 wn 0 - smpl 219 22.651 us/op 40.354 us/op 0.56
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 9.3440 us/op 16.415 us/op 0.57
vc - 250000 eb 0.95 eth1 0.7 we 0.05 wn 0 - smpl 18 6.9200 us/op 13.689 us/op 0.51
vc - 250000 eb 0.1 eth1 0.1 we 0 wn 0 - smpl 1020 89.037 us/op 123.93 us/op 0.72
vc - 250000 eb 0.03 eth1 0.03 we 0 wn 0 - smpl 11777 720.63 us/op 1.0877 ms/op 0.66
vc - 250000 eb 0.01 eth1 0.01 we 0 wn 0 - smpl 16384 944.23 us/op 1.2816 ms/op 0.74
vc - 250000 eb 0 eth1 0 we 0 wn 0 - smpl 16384 949.23 us/op 1.1926 ms/op 0.80
vc - 250000 eb 0 eth1 0 we 0 wn 0 nocache - smpl 16384 2.6942 ms/op 3.6997 ms/op 0.73
vc - 250000 eb 0 eth1 1 we 0 wn 0 - smpl 16384 1.9257 ms/op 2.3638 ms/op 0.81
vc - 250000 eb 0 eth1 1 we 0 wn 0 nocache - smpl 16384 4.9438 ms/op 5.9606 ms/op 0.83
Tree 40 250000 create 439.48 ms/op 503.77 ms/op 0.87
Tree 40 250000 get(125000) 236.76 ns/op 220.27 ns/op 1.07
Tree 40 250000 set(125000) 1.1491 us/op 1.2441 us/op 0.92
Tree 40 250000 toArray() 27.476 ms/op 23.835 ms/op 1.15
Tree 40 250000 iterate all - toArray() + loop 28.095 ms/op 23.811 ms/op 1.18
Tree 40 250000 iterate all - get(i) 86.145 ms/op 82.374 ms/op 1.05
MutableVector 250000 create 11.926 ms/op 13.622 ms/op 0.88
MutableVector 250000 get(125000) 9.2440 ns/op 6.8790 ns/op 1.34
MutableVector 250000 set(125000) 316.67 ns/op 374.30 ns/op 0.85
MutableVector 250000 toArray() 4.0902 ms/op 3.8770 ms/op 1.05
MutableVector 250000 iterate all - toArray() + loop 4.0161 ms/op 4.2178 ms/op 0.95
MutableVector 250000 iterate all - get(i) 2.0017 ms/op 1.8539 ms/op 1.08
Array 250000 create 2.8708 ms/op 3.9587 ms/op 0.73
Array 250000 clone - spread 1.2723 ms/op 1.3246 ms/op 0.96
Array 250000 get(125000) 0.71300 ns/op 0.95000 ns/op 0.75
Array 250000 set(125000) 0.82200 ns/op 0.87800 ns/op 0.94
Array 250000 iterate all - loop 103.26 us/op 121.12 us/op 0.85
effectiveBalanceIncrements clone Uint8Array 300000 35.449 us/op 58.421 us/op 0.61
effectiveBalanceIncrements clone MutableVector 300000 440.00 ns/op 476.00 ns/op 0.92
effectiveBalanceIncrements rw all Uint8Array 300000 266.44 us/op 238.48 us/op 1.12
effectiveBalanceIncrements rw all MutableVector 300000 109.45 ms/op 198.02 ms/op 0.55
phase0 afterProcessEpoch - 250000 vs - 7PWei 139.44 ms/op 140.05 ms/op 1.00
phase0 beforeProcessEpoch - 250000 vs - 7PWei 46.748 ms/op 59.865 ms/op 0.78
altair processEpoch - mainnet_e81889 400.43 ms/op 417.67 ms/op 0.96
mainnet_e81889 - altair beforeProcessEpoch 92.298 ms/op 95.292 ms/op 0.97
mainnet_e81889 - altair processJustificationAndFinalization 20.757 us/op 31.303 us/op 0.66
mainnet_e81889 - altair processInactivityUpdates 7.4924 ms/op 11.799 ms/op 0.64
mainnet_e81889 - altair processRewardsAndPenalties 77.828 ms/op 70.318 ms/op 1.11
mainnet_e81889 - altair processRegistryUpdates 4.7030 us/op 6.4560 us/op 0.73
mainnet_e81889 - altair processSlashings 1.2040 us/op 1.2020 us/op 1.00
mainnet_e81889 - altair processEth1DataReset 538.00 ns/op 1.2320 us/op 0.44
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.7515 ms/op 2.1517 ms/op 0.81
mainnet_e81889 - altair processSlashingsReset 7.7240 us/op 7.2900 us/op 1.06
mainnet_e81889 - altair processRandaoMixesReset 6.7320 us/op 7.4210 us/op 0.91
mainnet_e81889 - altair processHistoricalRootsUpdate 1.6050 us/op 2.2180 us/op 0.72
mainnet_e81889 - altair processParticipationFlagUpdates 5.1990 us/op 4.1630 us/op 1.25
mainnet_e81889 - altair processSyncCommitteeUpdates 1.2620 us/op 858.00 ns/op 1.47
mainnet_e81889 - altair afterProcessEpoch 187.62 ms/op 132.40 ms/op 1.42
phase0 processEpoch - mainnet_e58758 502.77 ms/op 394.91 ms/op 1.27
mainnet_e58758 - phase0 beforeProcessEpoch 172.29 ms/op 152.27 ms/op 1.13
mainnet_e58758 - phase0 processJustificationAndFinalization 28.670 us/op 30.592 us/op 0.94
mainnet_e58758 - phase0 processRewardsAndPenalties 75.097 ms/op 76.691 ms/op 0.98
mainnet_e58758 - phase0 processRegistryUpdates 17.385 us/op 16.213 us/op 1.07
mainnet_e58758 - phase0 processSlashings 948.00 ns/op 1.1040 us/op 0.86
mainnet_e58758 - phase0 processEth1DataReset 632.00 ns/op 848.00 ns/op 0.75
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.4846 ms/op 2.0705 ms/op 0.72
mainnet_e58758 - phase0 processSlashingsReset 7.7040 us/op 5.9190 us/op 1.30
mainnet_e58758 - phase0 processRandaoMixesReset 15.974 us/op 11.156 us/op 1.43
mainnet_e58758 - phase0 processHistoricalRootsUpdate 2.0730 us/op 1.1980 us/op 1.73
mainnet_e58758 - phase0 processParticipationRecordUpdates 13.369 us/op 4.4150 us/op 3.03
mainnet_e58758 - phase0 afterProcessEpoch 121.41 ms/op 103.15 ms/op 1.18
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.4058 ms/op 1.4887 ms/op 0.94
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.2367 ms/op 1.6308 ms/op 1.37
altair processInactivityUpdates - 250000 normalcase 30.921 ms/op 24.987 ms/op 1.24
altair processInactivityUpdates - 250000 worstcase 33.790 ms/op 20.482 ms/op 1.65
phase0 processRegistryUpdates - 250000 normalcase 9.5650 us/op 12.636 us/op 0.76
phase0 processRegistryUpdates - 250000 badcase_full_deposits 382.16 us/op 311.94 us/op 1.23
phase0 processRegistryUpdates - 250000 worstcase 0.5 146.83 ms/op 134.76 ms/op 1.09
altair processRewardsAndPenalties - 250000 normalcase 82.805 ms/op 77.753 ms/op 1.06
altair processRewardsAndPenalties - 250000 worstcase 84.989 ms/op 79.786 ms/op 1.07
phase0 getAttestationDeltas - 250000 normalcase 9.5379 ms/op 9.4624 ms/op 1.01
phase0 getAttestationDeltas - 250000 worstcase 10.750 ms/op 10.866 ms/op 0.99
phase0 processSlashings - 250000 worstcase 4.4033 ms/op 4.6284 ms/op 0.95
altair processSyncCommitteeUpdates - 250000 241.09 ms/op 191.32 ms/op 1.26
BeaconState.hashTreeRoot - No change 370.00 ns/op 285.00 ns/op 1.30
BeaconState.hashTreeRoot - 1 full validator 69.886 us/op 54.694 us/op 1.28
BeaconState.hashTreeRoot - 32 full validator 703.21 us/op 620.05 us/op 1.13
BeaconState.hashTreeRoot - 512 full validator 7.5087 ms/op 5.3965 ms/op 1.39
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 92.751 us/op 65.007 us/op 1.43
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.5352 ms/op 969.17 us/op 1.58
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 15.908 ms/op 13.684 ms/op 1.16
BeaconState.hashTreeRoot - 1 balances 72.468 us/op 52.760 us/op 1.37
BeaconState.hashTreeRoot - 32 balances 662.87 us/op 480.06 us/op 1.38
BeaconState.hashTreeRoot - 512 balances 6.3606 ms/op 4.9311 ms/op 1.29
BeaconState.hashTreeRoot - 250000 balances 98.555 ms/op 73.607 ms/op 1.34
aggregationBits - 2048 els - zipIndexesInBitList 26.050 us/op 19.535 us/op 1.33
regular array get 100000 times 43.885 us/op 35.361 us/op 1.24
wrappedArray get 100000 times 54.189 us/op 35.698 us/op 1.52
arrayWithProxy get 100000 times 20.542 ms/op 16.982 ms/op 1.21
ssz.Root.equals 709.00 ns/op 621.00 ns/op 1.14
byteArrayEquals 833.00 ns/op 621.00 ns/op 1.34
shuffle list - 16384 els 9.5689 ms/op 7.3214 ms/op 1.31
shuffle list - 250000 els 132.18 ms/op 106.09 ms/op 1.25
processSlot - 1 slots 13.776 us/op 9.6370 us/op 1.43
processSlot - 32 slots 1.8068 ms/op 1.4862 ms/op 1.22
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 49.083 ms/op 39.371 ms/op 1.25
getCommitteeAssignments - req 1 vs - 250000 vc 4.5591 ms/op 3.1247 ms/op 1.46
getCommitteeAssignments - req 100 vs - 250000 vc 6.8053 ms/op 4.4587 ms/op 1.53
getCommitteeAssignments - req 1000 vs - 250000 vc 7.8527 ms/op 5.1882 ms/op 1.51
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 6.6100 ns/op 5.2600 ns/op 1.26
state getBlockRootAtSlot - 250000 vs - 7PWei 1.2956 us/op 783.05 ns/op 1.65
computeProposers - vc 250000 13.344 ms/op 11.771 ms/op 1.13
computeEpochShuffling - vc 250000 147.80 ms/op 113.37 ms/op 1.30
getNextSyncCommittee - vc 250000 216.12 ms/op 216.26 ms/op 1.00
computeSigningRoot for AttestationData 16.351 us/op 16.153 us/op 1.01
hash AttestationData serialized data then Buffer.toString(base64) 3.0858 us/op 2.6631 us/op 1.16
toHexString serialized data 1.3664 us/op 1.2823 us/op 1.07
Buffer.toString(base64) 441.67 ns/op 365.91 ns/op 1.21

by benchmarkbot/action

@dapplion dapplion force-pushed the dapplion/network-core-metrics branch from 08b0dd1 to 25e6b96 Compare May 1, 2023 12:38
wemeetagain
wemeetagain previously approved these changes May 1, 2023
@wemeetagain wemeetagain merged commit ed047c3 into unstable May 1, 2023
@wemeetagain wemeetagain deleted the dapplion/network-core-metrics branch May 1, 2023 19:34
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.9.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants