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

feat: improve before process epoch #6979

Merged
merged 6 commits into from
Aug 1, 2024

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Jul 26, 2024

Motivation

Description

  • remove eligibleValidatorIndices: we can just base on flags
  • reuse nextEpochShufflingActiveValidatorIndices by allocating validatorCount items, use totalNextEpochShufflingActiveIndices to control its length
  • do not allocate proposerIndices and inclusionDelays if it's not phase0

Testing

on holesky beforeProcessEpoch could be less than 200ms. Note that it could still spike due to allocating validators array

Screenshot 2024-07-26 at 13 12 27

Copy link
Contributor

github-actions bot commented Jul 26, 2024

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: d706db1 Previous: 42af692 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.8181 ms/op 2.3474 ms/op 0.77
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 40.298 us/op 52.393 us/op 0.77
BLS verify - blst 842.02 us/op 1.4026 ms/op 0.60
BLS verifyMultipleSignatures 3 - blst 1.2636 ms/op 1.5308 ms/op 0.83
BLS verifyMultipleSignatures 8 - blst 2.0093 ms/op 2.0324 ms/op 0.99
BLS verifyMultipleSignatures 32 - blst 4.3980 ms/op 6.7691 ms/op 0.65
BLS verifyMultipleSignatures 64 - blst 8.2157 ms/op 12.422 ms/op 0.66
BLS verifyMultipleSignatures 128 - blst 15.972 ms/op 20.296 ms/op 0.79
BLS deserializing 10000 signatures 627.87 ms/op 749.93 ms/op 0.84
BLS deserializing 100000 signatures 6.3007 s/op 7.0843 s/op 0.89
BLS verifyMultipleSignatures - same message - 3 - blst 953.48 us/op 921.74 us/op 1.03
BLS verifyMultipleSignatures - same message - 8 - blst 1.0008 ms/op 1.1458 ms/op 0.87
BLS verifyMultipleSignatures - same message - 32 - blst 1.6229 ms/op 1.8242 ms/op 0.89
BLS verifyMultipleSignatures - same message - 64 - blst 2.5262 ms/op 2.5115 ms/op 1.01
BLS verifyMultipleSignatures - same message - 128 - blst 4.1778 ms/op 4.2574 ms/op 0.98
BLS aggregatePubkeys 32 - blst 18.203 us/op 21.077 us/op 0.86
BLS aggregatePubkeys 128 - blst 63.852 us/op 71.386 us/op 0.89
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 43.304 ms/op 84.149 ms/op 0.51
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 57.349 ms/op 71.233 ms/op 0.81
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 29.129 ms/op 50.245 ms/op 0.58
getSlashingsAndExits - default max 67.101 us/op 105.10 us/op 0.64
getSlashingsAndExits - 2k 266.63 us/op 363.07 us/op 0.73
proposeBlockBody type=full, size=empty 5.2266 ms/op 7.5239 ms/op 0.69
isKnown best case - 1 super set check 465.00 ns/op 586.00 ns/op 0.79
isKnown normal case - 2 super set checks 449.00 ns/op 609.00 ns/op 0.74
isKnown worse case - 16 super set checks 448.00 ns/op 607.00 ns/op 0.74
InMemoryCheckpointStateCache - add get delete 4.3040 us/op 6.5280 us/op 0.66
validate api signedAggregateAndProof - struct 1.4712 ms/op 1.9668 ms/op 0.75
validate gossip signedAggregateAndProof - struct 1.4743 ms/op 1.6802 ms/op 0.88
validate gossip attestation - vc 640000 972.28 us/op 1.1373 ms/op 0.85
batch validate gossip attestation - vc 640000 - chunk 32 124.31 us/op 140.42 us/op 0.89
batch validate gossip attestation - vc 640000 - chunk 64 109.86 us/op 120.91 us/op 0.91
batch validate gossip attestation - vc 640000 - chunk 128 101.88 us/op 111.35 us/op 0.91
batch validate gossip attestation - vc 640000 - chunk 256 96.648 us/op 107.65 us/op 0.90
pickEth1Vote - no votes 928.23 us/op 1.0206 ms/op 0.91
pickEth1Vote - max votes 8.9523 ms/op 8.3656 ms/op 1.07
pickEth1Vote - Eth1Data hashTreeRoot value x2048 19.616 ms/op 11.973 ms/op 1.64
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 13.389 ms/op 19.490 ms/op 0.69
pickEth1Vote - Eth1Data fastSerialize value x2048 398.12 us/op 480.36 us/op 0.83
pickEth1Vote - Eth1Data fastSerialize tree x2048 5.7526 ms/op 3.6932 ms/op 1.56
bytes32 toHexString 593.00 ns/op 450.00 ns/op 1.32
bytes32 Buffer.toString(hex) 442.00 ns/op 278.00 ns/op 1.59
bytes32 Buffer.toString(hex) from Uint8Array 543.00 ns/op 461.00 ns/op 1.18
bytes32 Buffer.toString(hex) + 0x 439.00 ns/op 270.00 ns/op 1.63
Object access 1 prop 0.32300 ns/op 0.15300 ns/op 2.11
Map access 1 prop 0.32100 ns/op 0.14200 ns/op 2.26
Object get x1000 5.4210 ns/op 6.1230 ns/op 0.89
Map get x1000 6.4760 ns/op 6.7250 ns/op 0.96
Object set x1000 26.169 ns/op 33.281 ns/op 0.79
Map set x1000 19.674 ns/op 24.796 ns/op 0.79
Return object 10000 times 0.29850 ns/op 0.29410 ns/op 1.01
Throw Error 10000 times 2.6997 us/op 3.5235 us/op 0.77
fastMsgIdFn sha256 / 200 bytes 1.9900 us/op 2.2180 us/op 0.90
fastMsgIdFn h32 xxhash / 200 bytes 419.00 ns/op 231.00 ns/op 1.81
fastMsgIdFn h64 xxhash / 200 bytes 472.00 ns/op 270.00 ns/op 1.75
fastMsgIdFn sha256 / 1000 bytes 6.1100 us/op 7.4190 us/op 0.82
fastMsgIdFn h32 xxhash / 1000 bytes 547.00 ns/op 375.00 ns/op 1.46
fastMsgIdFn h64 xxhash / 1000 bytes 529.00 ns/op 350.00 ns/op 1.51
fastMsgIdFn sha256 / 10000 bytes 50.837 us/op 65.725 us/op 0.77
fastMsgIdFn h32 xxhash / 10000 bytes 1.9450 us/op 1.9500 us/op 1.00
fastMsgIdFn h64 xxhash / 10000 bytes 1.3530 us/op 1.2630 us/op 1.07
send data - 1000 256B messages 10.448 ms/op 13.206 ms/op 0.79
send data - 1000 512B messages 13.812 ms/op 17.560 ms/op 0.79
send data - 1000 1024B messages 21.130 ms/op 25.543 ms/op 0.83
send data - 1000 1200B messages 23.569 ms/op 27.962 ms/op 0.84
send data - 1000 2048B messages 28.960 ms/op 34.855 ms/op 0.83
send data - 1000 4096B messages 26.369 ms/op 32.248 ms/op 0.82
send data - 1000 16384B messages 60.888 ms/op 72.367 ms/op 0.84
send data - 1000 65536B messages 269.57 ms/op 216.48 ms/op 1.25
enrSubnets - fastDeserialize 64 bits 1.0760 us/op 1.4690 us/op 0.73
enrSubnets - ssz BitVector 64 bits 495.00 ns/op 455.00 ns/op 1.09
enrSubnets - fastDeserialize 4 bits 315.00 ns/op 180.00 ns/op 1.75
enrSubnets - ssz BitVector 4 bits 491.00 ns/op 409.00 ns/op 1.20
prioritizePeers score -10:0 att 32-0.1 sync 2-0 127.59 us/op 176.11 us/op 0.72
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 137.12 us/op 187.72 us/op 0.73
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 256.61 us/op 258.82 us/op 0.99
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 526.54 us/op 494.98 us/op 1.06
prioritizePeers score 0:0 att 64-1 sync 4-1 537.95 us/op 793.66 us/op 0.68
array of 16000 items push then shift 1.1518 us/op 1.7206 us/op 0.67
LinkedList of 16000 items push then shift 6.8560 ns/op 7.4030 ns/op 0.93
array of 16000 items push then pop 80.587 ns/op 131.91 ns/op 0.61
LinkedList of 16000 items push then pop 5.8270 ns/op 7.5000 ns/op 0.78
array of 24000 items push then shift 1.6931 us/op 2.5220 us/op 0.67
LinkedList of 24000 items push then shift 6.5020 ns/op 7.6280 ns/op 0.85
array of 24000 items push then pop 107.49 ns/op 178.35 ns/op 0.60
LinkedList of 24000 items push then pop 5.7410 ns/op 7.3390 ns/op 0.78
intersect bitArray bitLen 8 4.9110 ns/op 6.6670 ns/op 0.74
intersect array and set length 8 36.808 ns/op 47.851 ns/op 0.77
intersect bitArray bitLen 128 23.982 ns/op 31.102 ns/op 0.77
intersect array and set length 128 530.93 ns/op 702.80 ns/op 0.76
bitArray.getTrueBitIndexes() bitLen 128 2.3610 us/op 2.2080 us/op 1.07
bitArray.getTrueBitIndexes() bitLen 248 3.6820 us/op 3.4250 us/op 1.08
bitArray.getTrueBitIndexes() bitLen 512 6.1690 us/op 8.5160 us/op 0.72
Buffer.concat 32 items 1.0050 us/op 1.0130 us/op 0.99
Uint8Array.set 32 items 1.6890 us/op 1.7080 us/op 0.99
Buffer.copy 1.8540 us/op 1.8120 us/op 1.02
Uint8Array.set - with subarray 2.4310 us/op 2.8390 us/op 0.86
Uint8Array.set - without subarray 1.6120 us/op 1.7890 us/op 0.90
getUint32 - dataview 399.00 ns/op 260.00 ns/op 1.53
getUint32 - manual 338.00 ns/op 174.00 ns/op 1.94
Set add up to 64 items then delete first 1.8476 us/op 2.2585 us/op 0.82
OrderedSet add up to 64 items then delete first 2.8233 us/op 3.3780 us/op 0.84
Set add up to 64 items then delete last 2.0711 us/op 2.6557 us/op 0.78
OrderedSet add up to 64 items then delete last 3.2390 us/op 4.0242 us/op 0.80
Set add up to 64 items then delete middle 2.0953 us/op 2.6208 us/op 0.80
OrderedSet add up to 64 items then delete middle 4.6420 us/op 5.3505 us/op 0.87
Set add up to 128 items then delete first 4.0300 us/op 5.1427 us/op 0.78
OrderedSet add up to 128 items then delete first 6.0241 us/op 7.5641 us/op 0.80
Set add up to 128 items then delete last 4.0255 us/op 5.1160 us/op 0.79
OrderedSet add up to 128 items then delete last 6.2278 us/op 7.8330 us/op 0.80
Set add up to 128 items then delete middle 3.9980 us/op 4.9549 us/op 0.81
OrderedSet add up to 128 items then delete middle 11.067 us/op 14.612 us/op 0.76
Set add up to 256 items then delete first 6.9716 us/op 10.657 us/op 0.65
OrderedSet add up to 256 items then delete first 10.822 us/op 15.474 us/op 0.70
Set add up to 256 items then delete last 7.0527 us/op 10.441 us/op 0.68
OrderedSet add up to 256 items then delete last 11.212 us/op 15.717 us/op 0.71
Set add up to 256 items then delete middle 6.9332 us/op 10.249 us/op 0.68
OrderedSet add up to 256 items then delete middle 31.650 us/op 41.804 us/op 0.76
transfer serialized Status (84 B) 1.4020 us/op 1.5330 us/op 0.91
copy serialized Status (84 B) 1.2140 us/op 1.3220 us/op 0.92
transfer serialized SignedVoluntaryExit (112 B) 1.4990 us/op 1.5100 us/op 0.99
copy serialized SignedVoluntaryExit (112 B) 1.2850 us/op 1.2190 us/op 1.05
transfer serialized ProposerSlashing (416 B) 2.0260 us/op 1.5850 us/op 1.28
copy serialized ProposerSlashing (416 B) 2.0550 us/op 1.7910 us/op 1.15
transfer serialized Attestation (485 B) 2.2890 us/op 2.3080 us/op 0.99
copy serialized Attestation (485 B) 1.9380 us/op 2.0910 us/op 0.93
transfer serialized AttesterSlashing (33232 B) 2.4610 us/op 1.7820 us/op 1.38
copy serialized AttesterSlashing (33232 B) 4.9830 us/op 6.6230 us/op 0.75
transfer serialized Small SignedBeaconBlock (128000 B) 1.5090 us/op 2.5700 us/op 0.59
copy serialized Small SignedBeaconBlock (128000 B) 14.432 us/op 20.669 us/op 0.70
transfer serialized Avg SignedBeaconBlock (200000 B) 2.0390 us/op 3.2230 us/op 0.63
copy serialized Avg SignedBeaconBlock (200000 B) 17.061 us/op 27.794 us/op 0.61
transfer serialized BlobsSidecar (524380 B) 2.0860 us/op 3.3450 us/op 0.62
copy serialized BlobsSidecar (524380 B) 129.01 us/op 82.259 us/op 1.57
transfer serialized Big SignedBeaconBlock (1000000 B) 2.6080 us/op 3.3280 us/op 0.78
copy serialized Big SignedBeaconBlock (1000000 B) 136.33 us/op 174.34 us/op 0.78
pass gossip attestations to forkchoice per slot 2.8744 ms/op 3.4646 ms/op 0.83
forkChoice updateHead vc 100000 bc 64 eq 0 476.62 us/op 653.93 us/op 0.73
forkChoice updateHead vc 600000 bc 64 eq 0 2.2680 ms/op 3.7951 ms/op 0.60
forkChoice updateHead vc 1000000 bc 64 eq 0 3.9627 ms/op 6.5293 ms/op 0.61
forkChoice updateHead vc 600000 bc 320 eq 0 2.7642 ms/op 3.3919 ms/op 0.81
forkChoice updateHead vc 600000 bc 1200 eq 0 2.6088 ms/op 3.3556 ms/op 0.78
forkChoice updateHead vc 600000 bc 7200 eq 0 2.8346 ms/op 5.1566 ms/op 0.55
forkChoice updateHead vc 600000 bc 64 eq 1000 9.5891 ms/op 11.756 ms/op 0.82
forkChoice updateHead vc 600000 bc 64 eq 10000 9.6834 ms/op 12.740 ms/op 0.76
forkChoice updateHead vc 600000 bc 64 eq 300000 11.731 ms/op 16.545 ms/op 0.71
computeDeltas 500000 validators 300 proto nodes 2.9475 ms/op 4.1842 ms/op 0.70
computeDeltas 500000 validators 1200 proto nodes 3.1101 ms/op 4.3095 ms/op 0.72
computeDeltas 500000 validators 7200 proto nodes 2.9834 ms/op 4.0806 ms/op 0.73
computeDeltas 750000 validators 300 proto nodes 4.6338 ms/op 5.7188 ms/op 0.81
computeDeltas 750000 validators 1200 proto nodes 4.5531 ms/op 5.8281 ms/op 0.78
computeDeltas 750000 validators 7200 proto nodes 4.4416 ms/op 6.2052 ms/op 0.72
computeDeltas 1400000 validators 300 proto nodes 8.4313 ms/op 11.131 ms/op 0.76
computeDeltas 1400000 validators 1200 proto nodes 8.2036 ms/op 11.489 ms/op 0.71
computeDeltas 1400000 validators 7200 proto nodes 8.4470 ms/op 11.110 ms/op 0.76
computeDeltas 2100000 validators 300 proto nodes 12.402 ms/op 17.446 ms/op 0.71
computeDeltas 2100000 validators 1200 proto nodes 12.420 ms/op 17.077 ms/op 0.73
computeDeltas 2100000 validators 7200 proto nodes 12.583 ms/op 17.686 ms/op 0.71
altair processAttestation - 250000 vs - 7PWei normalcase 1.4012 ms/op 2.2936 ms/op 0.61
altair processAttestation - 250000 vs - 7PWei worstcase 2.0957 ms/op 2.8880 ms/op 0.73
altair processAttestation - setStatus - 1/6 committees join 63.865 us/op 103.85 us/op 0.61
altair processAttestation - setStatus - 1/3 committees join 135.58 us/op 204.15 us/op 0.66
altair processAttestation - setStatus - 1/2 committees join 194.76 us/op 267.14 us/op 0.73
altair processAttestation - setStatus - 2/3 committees join 239.87 us/op 361.78 us/op 0.66
altair processAttestation - setStatus - 4/5 committees join 387.13 us/op 541.56 us/op 0.71
altair processAttestation - setStatus - 100% committees join 440.31 us/op 652.58 us/op 0.67
altair processBlock - 250000 vs - 7PWei normalcase 4.2395 ms/op 5.1057 ms/op 0.83
altair processBlock - 250000 vs - 7PWei normalcase hashState 25.266 ms/op 27.529 ms/op 0.92
altair processBlock - 250000 vs - 7PWei worstcase 35.224 ms/op 42.934 ms/op 0.82
altair processBlock - 250000 vs - 7PWei worstcase hashState 63.959 ms/op 80.152 ms/op 0.80
phase0 processBlock - 250000 vs - 7PWei normalcase 1.5614 ms/op 2.9595 ms/op 0.53
phase0 processBlock - 250000 vs - 7PWei worstcase 23.385 ms/op 28.804 ms/op 0.81
altair processEth1Data - 250000 vs - 7PWei normalcase 257.99 us/op 330.27 us/op 0.78
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 5.3940 us/op 7.7840 us/op 0.69
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 15.934 us/op 23.250 us/op 0.69
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 9.2340 us/op 8.8200 us/op 1.05
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 4.6260 us/op 5.4020 us/op 0.86
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 77.812 us/op 122.47 us/op 0.64
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 798.88 us/op 709.91 us/op 1.13
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.0185 ms/op 1.2726 ms/op 0.80
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.1055 ms/op 1.4731 ms/op 0.75
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 1.8029 ms/op 2.7460 ms/op 0.66
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.2428 ms/op 2.4570 ms/op 0.51
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.0540 ms/op 3.7750 ms/op 0.81
Tree 40 250000 create 182.44 ms/op 214.83 ms/op 0.85
Tree 40 250000 get(125000) 103.10 ns/op 147.35 ns/op 0.70
Tree 40 250000 set(125000) 491.49 ns/op 638.34 ns/op 0.77
Tree 40 250000 toArray() 12.000 ms/op 17.340 ms/op 0.69
Tree 40 250000 iterate all - toArray() + loop 11.971 ms/op 17.182 ms/op 0.70
Tree 40 250000 iterate all - get(i) 39.126 ms/op 52.504 ms/op 0.75
MutableVector 250000 create 8.4395 ms/op 10.815 ms/op 0.78
MutableVector 250000 get(125000) 5.8580 ns/op 6.7790 ns/op 0.86
MutableVector 250000 set(125000) 178.77 ns/op 183.32 ns/op 0.98
MutableVector 250000 toArray() 2.7276 ms/op 3.3026 ms/op 0.83
MutableVector 250000 iterate all - toArray() + loop 2.8219 ms/op 3.4067 ms/op 0.83
MutableVector 250000 iterate all - get(i) 1.4802 ms/op 1.5456 ms/op 0.96
Array 250000 create 2.3602 ms/op 2.9065 ms/op 0.81
Array 250000 clone - spread 1.3190 ms/op 1.3177 ms/op 1.00
Array 250000 get(125000) 0.58100 ns/op 0.40500 ns/op 1.43
Array 250000 set(125000) 0.59700 ns/op 0.42900 ns/op 1.39
Array 250000 iterate all - loop 77.325 us/op 91.020 us/op 0.85
effectiveBalanceIncrements clone Uint8Array 300000 13.906 us/op 27.830 us/op 0.50
effectiveBalanceIncrements clone MutableVector 300000 317.00 ns/op 123.00 ns/op 2.58
effectiveBalanceIncrements rw all Uint8Array 300000 167.75 us/op 200.01 us/op 0.84
effectiveBalanceIncrements rw all MutableVector 300000 57.576 ms/op 60.339 ms/op 0.95
phase0 afterProcessEpoch - 250000 vs - 7PWei 76.988 ms/op 87.862 ms/op 0.88
Array.fill - length 1000000 2.5977 ms/op 3.4399 ms/op 0.76
Array push - length 1000000 13.722 ms/op 22.563 ms/op 0.61
Array.get 0.25668 ns/op 0.27748 ns/op 0.93
Uint8Array.get 0.34392 ns/op 0.43480 ns/op 0.79
phase0 beforeProcessEpoch - 250000 vs - 7PWei 12.271 ms/op 21.409 ms/op 0.57
altair processEpoch - mainnet_e81889 306.71 ms/op 348.30 ms/op 0.88
mainnet_e81889 - altair beforeProcessEpoch 18.387 ms/op 28.934 ms/op 0.64
mainnet_e81889 - altair processJustificationAndFinalization 11.401 us/op 17.214 us/op 0.66
mainnet_e81889 - altair processInactivityUpdates 4.4017 ms/op 6.2904 ms/op 0.70
mainnet_e81889 - altair processRewardsAndPenalties 56.758 ms/op 57.680 ms/op 0.98
mainnet_e81889 - altair processRegistryUpdates 1.8730 us/op 2.8890 us/op 0.65
mainnet_e81889 - altair processSlashings 729.00 ns/op 605.00 ns/op 1.20
mainnet_e81889 - altair processEth1DataReset 682.00 ns/op 445.00 ns/op 1.53
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.3644 ms/op 2.5017 ms/op 0.55
mainnet_e81889 - altair processSlashingsReset 2.5110 us/op 4.6780 us/op 0.54
mainnet_e81889 - altair processRandaoMixesReset 2.8050 us/op 5.3970 us/op 0.52
mainnet_e81889 - altair processHistoricalRootsUpdate 687.00 ns/op 478.00 ns/op 1.44
mainnet_e81889 - altair processParticipationFlagUpdates 3.0060 us/op 2.5520 us/op 1.18
mainnet_e81889 - altair processSyncCommitteeUpdates 730.00 ns/op 499.00 ns/op 1.46
mainnet_e81889 - altair afterProcessEpoch 79.700 ms/op 95.986 ms/op 0.83
capella processEpoch - mainnet_e217614 1.1625 s/op 1.4730 s/op 0.79
mainnet_e217614 - capella beforeProcessEpoch 64.278 ms/op 112.29 ms/op 0.57
mainnet_e217614 - capella processJustificationAndFinalization 12.877 us/op 20.552 us/op 0.63
mainnet_e217614 - capella processInactivityUpdates 12.548 ms/op 18.781 ms/op 0.67
mainnet_e217614 - capella processRewardsAndPenalties 258.12 ms/op 264.17 ms/op 0.98
mainnet_e217614 - capella processRegistryUpdates 10.911 us/op 14.085 us/op 0.77
mainnet_e217614 - capella processSlashings 705.00 ns/op 491.00 ns/op 1.44
mainnet_e217614 - capella processEth1DataReset 656.00 ns/op 481.00 ns/op 1.36
mainnet_e217614 - capella processEffectiveBalanceUpdates 4.7276 ms/op 8.2658 ms/op 0.57
mainnet_e217614 - capella processSlashingsReset 3.1560 us/op 4.9260 us/op 0.64
mainnet_e217614 - capella processRandaoMixesReset 4.2490 us/op 11.316 us/op 0.38
mainnet_e217614 - capella processHistoricalRootsUpdate 688.00 ns/op 1.0190 us/op 0.68
mainnet_e217614 - capella processParticipationFlagUpdates 1.2670 us/op 2.7090 us/op 0.47
mainnet_e217614 - capella afterProcessEpoch 231.75 ms/op 308.00 ms/op 0.75
phase0 processEpoch - mainnet_e58758 389.53 ms/op 507.08 ms/op 0.77
mainnet_e58758 - phase0 beforeProcessEpoch 75.850 ms/op 119.40 ms/op 0.64
mainnet_e58758 - phase0 processJustificationAndFinalization 13.309 us/op 36.265 us/op 0.37
mainnet_e58758 - phase0 processRewardsAndPenalties 35.165 ms/op 37.605 ms/op 0.94
mainnet_e58758 - phase0 processRegistryUpdates 6.5060 us/op 12.849 us/op 0.51
mainnet_e58758 - phase0 processSlashings 797.00 ns/op 603.00 ns/op 1.32
mainnet_e58758 - phase0 processEth1DataReset 721.00 ns/op 556.00 ns/op 1.30
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.1116 ms/op 1.4158 ms/op 0.79
mainnet_e58758 - phase0 processSlashingsReset 2.1180 us/op 3.5340 us/op 0.60
mainnet_e58758 - phase0 processRandaoMixesReset 3.3150 us/op 4.0600 us/op 0.82
mainnet_e58758 - phase0 processHistoricalRootsUpdate 687.00 ns/op 354.00 ns/op 1.94
mainnet_e58758 - phase0 processParticipationRecordUpdates 2.5430 us/op 4.2150 us/op 0.60
mainnet_e58758 - phase0 afterProcessEpoch 67.835 ms/op 88.266 ms/op 0.77
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.3185 ms/op 1.5230 ms/op 0.87
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.1011 ms/op 2.1332 ms/op 0.52
altair processInactivityUpdates - 250000 normalcase 17.533 ms/op 19.576 ms/op 0.90
altair processInactivityUpdates - 250000 worstcase 16.113 ms/op 18.901 ms/op 0.85
phase0 processRegistryUpdates - 250000 normalcase 3.4620 us/op 9.1320 us/op 0.38
phase0 processRegistryUpdates - 250000 badcase_full_deposits 295.06 us/op 364.18 us/op 0.81
phase0 processRegistryUpdates - 250000 worstcase 0.5 96.797 ms/op 124.43 ms/op 0.78
altair processRewardsAndPenalties - 250000 normalcase 44.553 ms/op 43.576 ms/op 1.02
altair processRewardsAndPenalties - 250000 worstcase 40.165 ms/op 47.142 ms/op 0.85
phase0 getAttestationDeltas - 250000 normalcase 6.8909 ms/op 7.8769 ms/op 0.87
phase0 getAttestationDeltas - 250000 worstcase 6.7527 ms/op 8.3871 ms/op 0.81
phase0 processSlashings - 250000 worstcase 81.811 us/op 93.215 us/op 0.88
altair processSyncCommitteeUpdates - 250000 100.41 ms/op 131.57 ms/op 0.76
BeaconState.hashTreeRoot - No change 468.00 ns/op 332.00 ns/op 1.41
BeaconState.hashTreeRoot - 1 full validator 143.39 us/op 103.93 us/op 1.38
BeaconState.hashTreeRoot - 32 full validator 1.5160 ms/op 857.84 us/op 1.77
BeaconState.hashTreeRoot - 512 full validator 11.734 ms/op 8.7488 ms/op 1.34
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 138.41 us/op 115.89 us/op 1.19
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.0489 ms/op 1.3540 ms/op 1.51
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 25.864 ms/op 19.410 ms/op 1.33
BeaconState.hashTreeRoot - 1 balances 98.700 us/op 78.070 us/op 1.26
BeaconState.hashTreeRoot - 32 balances 973.28 us/op 772.92 us/op 1.26
BeaconState.hashTreeRoot - 512 balances 8.6049 ms/op 7.0051 ms/op 1.23
BeaconState.hashTreeRoot - 250000 balances 141.92 ms/op 153.60 ms/op 0.92
aggregationBits - 2048 els - zipIndexesInBitList 19.510 us/op 24.118 us/op 0.81
byteArrayEquals 32 48.233 ns/op 53.843 ns/op 0.90
Buffer.compare 32 15.907 ns/op 17.783 ns/op 0.89
byteArrayEquals 1024 1.2725 us/op 1.6095 us/op 0.79
Buffer.compare 1024 24.525 ns/op 25.188 ns/op 0.97
byteArrayEquals 16384 20.203 us/op 25.302 us/op 0.80
Buffer.compare 16384 190.52 ns/op 202.24 ns/op 0.94
byteArrayEquals 123687377 152.38 ms/op 203.49 ms/op 0.75
Buffer.compare 123687377 3.7157 ms/op 7.0894 ms/op 0.52
byteArrayEquals 32 - diff last byte 47.571 ns/op 53.647 ns/op 0.89
Buffer.compare 32 - diff last byte 16.521 ns/op 17.545 ns/op 0.94
byteArrayEquals 1024 - diff last byte 1.2673 us/op 1.6195 us/op 0.78
Buffer.compare 1024 - diff last byte 23.511 ns/op 25.946 ns/op 0.91
byteArrayEquals 16384 - diff last byte 20.118 us/op 25.722 us/op 0.78
Buffer.compare 16384 - diff last byte 180.35 ns/op 206.06 ns/op 0.88
byteArrayEquals 123687377 - diff last byte 137.67 ms/op 196.43 ms/op 0.70
Buffer.compare 123687377 - diff last byte 5.3249 ms/op 7.4230 ms/op 0.72
byteArrayEquals 32 - random bytes 4.4150 ns/op 5.5130 ns/op 0.80
Buffer.compare 32 - random bytes 14.213 ns/op 18.080 ns/op 0.79
byteArrayEquals 1024 - random bytes 4.4230 ns/op 5.3980 ns/op 0.82
Buffer.compare 1024 - random bytes 13.961 ns/op 18.013 ns/op 0.78
byteArrayEquals 16384 - random bytes 4.3950 ns/op 5.4160 ns/op 0.81
Buffer.compare 16384 - random bytes 22.337 ns/op 18.156 ns/op 1.23
byteArrayEquals 123687377 - random bytes 7.2700 ns/op 6.8600 ns/op 1.06
Buffer.compare 123687377 - random bytes 17.650 ns/op 19.150 ns/op 0.92
regular array get 100000 times 27.301 us/op 45.311 us/op 0.60
wrappedArray get 100000 times 27.284 us/op 39.131 us/op 0.70
arrayWithProxy get 100000 times 9.6636 ms/op 14.139 ms/op 0.68
ssz.Root.equals 39.694 ns/op 47.853 ns/op 0.83
byteArrayEquals 38.681 ns/op 47.223 ns/op 0.82
Buffer.compare 8.1620 ns/op 10.840 ns/op 0.75
shuffle list - 16384 els 5.5513 ms/op 6.3639 ms/op 0.87
shuffle list - 250000 els 81.953 ms/op 97.067 ms/op 0.84
processSlot - 1 slots 11.871 us/op 14.296 us/op 0.83
processSlot - 32 slots 2.6453 ms/op 2.8610 ms/op 0.92
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 39.735 ms/op 38.787 ms/op 1.02
getCommitteeAssignments - req 1 vs - 250000 vc 1.6308 ms/op 2.1821 ms/op 0.75
getCommitteeAssignments - req 100 vs - 250000 vc 3.2783 ms/op 4.3019 ms/op 0.76
getCommitteeAssignments - req 1000 vs - 250000 vc 3.4636 ms/op 4.7134 ms/op 0.73
findModifiedValidators - 10000 modified validators 228.79 ms/op 302.26 ms/op 0.76
findModifiedValidators - 1000 modified validators 133.18 ms/op 204.60 ms/op 0.65
findModifiedValidators - 100 modified validators 126.92 ms/op 204.92 ms/op 0.62
findModifiedValidators - 10 modified validators 158.29 ms/op 182.10 ms/op 0.87
findModifiedValidators - 1 modified validators 131.85 ms/op 169.47 ms/op 0.78
findModifiedValidators - no difference 151.74 ms/op 208.92 ms/op 0.73
compare ViewDUs 3.2499 s/op 3.6014 s/op 0.90
compare each validator Uint8Array 1.3961 s/op 1.2448 s/op 1.12
compare ViewDU to Uint8Array 636.11 ms/op 1.2078 s/op 0.53
migrate state 1000000 validators, 24 modified, 0 new 581.23 ms/op 646.72 ms/op 0.90
migrate state 1000000 validators, 1700 modified, 1000 new 801.31 ms/op 856.40 ms/op 0.94
migrate state 1000000 validators, 3400 modified, 2000 new 1.0317 s/op 973.32 ms/op 1.06
migrate state 1500000 validators, 24 modified, 0 new 551.68 ms/op 643.10 ms/op 0.86
migrate state 1500000 validators, 1700 modified, 1000 new 826.30 ms/op 1.1579 s/op 0.71
migrate state 1500000 validators, 3400 modified, 2000 new 951.72 ms/op 1.3841 s/op 0.69
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.9800 ns/op 5.7500 ns/op 1.04
state getBlockRootAtSlot - 250000 vs - 7PWei 527.87 ns/op 704.56 ns/op 0.75
computeProposers - vc 250000 5.6627 ms/op 8.9420 ms/op 0.63
computeEpochShuffling - vc 250000 83.120 ms/op 111.34 ms/op 0.75
getNextSyncCommittee - vc 250000 95.022 ms/op 159.30 ms/op 0.60
computeSigningRoot for AttestationData 21.903 us/op 24.495 us/op 0.89
hash AttestationData serialized data then Buffer.toString(base64) 1.0715 us/op 1.8631 us/op 0.58
toHexString serialized data 685.88 ns/op 1.2931 us/op 0.53
Buffer.toString(base64) 129.57 ns/op 248.91 ns/op 0.52

by benchmarkbot/action

@twoeths twoeths marked this pull request as ready for review July 26, 2024 06:22
@twoeths twoeths requested a review from a team as a code owner July 26, 2024 06:22
Copy link

codecov bot commented Jul 26, 2024

Codecov Report

Attention: Patch coverage is 40.90909% with 39 lines in your changes missing coverage. Please review.

Project coverage is 62.48%. Comparing base (2b62754) to head (f48929d).
Report is 10 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #6979      +/-   ##
============================================
- Coverage     62.51%   62.48%   -0.03%     
============================================
  Files           576      576              
  Lines         61170    61217      +47     
  Branches       2140     2135       -5     
============================================
+ Hits          38239    38253      +14     
- Misses        22892    22925      +33     
  Partials         39       39              

@twoeths
Copy link
Contributor Author

twoeths commented Jul 29, 2024

Update test result after 3 days of testing

  • this branch, 1k, 10m rate interval
Screenshot 2024-07-29 at 11 09 01
  • unstable, 1k, 10m rate interval
Screenshot 2024-07-29 at 11 09 23
  • this branch, 1k, 6h rate interval
Screenshot 2024-07-29 at 11 10 06
  • unstable, 1k, 6h rate interval
Screenshot 2024-07-29 at 11 10 48

indicesToSlash,
indicesEligibleForActivationQueue,
indicesEligibleForActivation,
indicesToEject,
nextEpochShufflingActiveValidatorIndices,
totalNextEpochShufflingActiveIndices,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you call this nextEpochShufflingActiveIndicesLength?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be interesting to see how https://github.com/tc39/proposal-resizablearraybuffer performs here

eg:

// in epochTransitionCache.ts

// top-level declaration
const nextEpochShufflingActiveValidatorIndices = new Uint32Array(new ArrayBuffer(0, {maxByteLength: PRACTICAL_MAX_ACTIVE_INDICES_LENGTH}));

// in beforeProcessEpoch
nextEpochShufflingActiveValidatorIndices.buffer.resize(validatorCount * 4);

/////

// in epochShuffling.ts

export function computeEpochShuffling(
  ...,
  activeIndices: Uint32Array,
  activeIndicesLength: number
) {
  ...
  const _activeIndices = activeIndices.slice(0, activeIndicesLength);
  ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes right now the resize is only available for Array not typed array, once it's available we can apply for other places too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it appears that resizable ArrayBuffer is in node 20 already so we may begin experimentation

@twoeths twoeths requested a review from wemeetagain August 1, 2024 07:46
@wemeetagain wemeetagain merged commit 12e1871 into unstable Aug 1, 2024
20 checks passed
@wemeetagain wemeetagain deleted the te/improve_before_process_epoch branch August 1, 2024 17:19
wemeetagain pushed a commit that referenced this pull request Aug 6, 2024
* fix: do not populate proposerIndices and inclusionDelays from altair

* feat: remove eligibleValidatorIndices

* fix: avoid array.slice in processRegistryUpdates()

* fix: reuse nextEpochShufflingActiveValidatorIndices

* fix: state-transition check-types

* chore: rename nextEpochShufflingActiveIndicesLength
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.21.0 🎉

philknows pushed a commit that referenced this pull request Sep 3, 2024
* fix: do not populate proposerIndices and inclusionDelays from altair

* feat: remove eligibleValidatorIndices

* fix: avoid array.slice in processRegistryUpdates()

* fix: reuse nextEpochShufflingActiveValidatorIndices

* fix: state-transition check-types

* chore: rename nextEpochShufflingActiveIndicesLength
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