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

fix: improve forkchoice #7142

Merged
merged 7 commits into from
Oct 11, 2024
Merged

fix: improve forkchoice #7142

merged 7 commits into from
Oct 11, 2024

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Oct 9, 2024

Motivation

Improve forkchoice

Description

Some different small optimizations for forkchoice:

  • updateTime() is designed to called once per slot and we do that per clock slot, so no need to do that again when producing block. No need to process queued attestations again in the same slot because:
    • current slot attestations keeps staying in the queue
    • old attestations should be applied to the votes already
  • improve processAttestationQueue():
    • right now we delete queued attestations one by one in a Set, as metrics show there could be more than 30k of them per slot on the test mainnet node
    • instead of that just partition queued attestations by slot then root, then we can delete them way more efficiently. This also helps save us a little memory
  • improve metrics: right now we label get_head() metric by entry point and we have no idea for the time to recompute head for prepare_next_slot vs import_block, we should label by "caller" instead
  • improve computeDeltas():
    • reuse deltas array over time
    • handle newBalances === oldBalances to speed up the computation a little bit

Metric look like (will add in a separate PR):
Screenshot 2024-10-09 at 14 26 01

Copy link
Contributor

github-actions bot commented Oct 9, 2024

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 64e1f7b Previous: 955f456 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.9019 ms/op 2.6992 ms/op 0.70
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 47.453 us/op 83.623 us/op 0.57
BLS verify - blst 772.41 us/op 1.2138 ms/op 0.64
BLS verifyMultipleSignatures 3 - blst 1.1391 ms/op 1.6246 ms/op 0.70
BLS verifyMultipleSignatures 8 - blst 1.6054 ms/op 2.6909 ms/op 0.60
BLS verifyMultipleSignatures 32 - blst 4.6378 ms/op 7.3591 ms/op 0.63
BLS verifyMultipleSignatures 64 - blst 8.7910 ms/op 12.645 ms/op 0.70
BLS verifyMultipleSignatures 128 - blst 16.523 ms/op 21.444 ms/op 0.77
BLS deserializing 10000 signatures 661.99 ms/op 780.55 ms/op 0.85
BLS deserializing 100000 signatures 6.6069 s/op 7.5982 s/op 0.87
BLS verifyMultipleSignatures - same message - 3 - blst 843.23 us/op 982.25 us/op 0.86
BLS verifyMultipleSignatures - same message - 8 - blst 988.95 us/op 1.0561 ms/op 0.94
BLS verifyMultipleSignatures - same message - 32 - blst 1.6448 ms/op 1.8045 ms/op 0.91
BLS verifyMultipleSignatures - same message - 64 - blst 2.4716 ms/op 2.7555 ms/op 0.90
BLS verifyMultipleSignatures - same message - 128 - blst 4.1512 ms/op 5.0303 ms/op 0.83
BLS aggregatePubkeys 32 - blst 18.956 us/op 22.495 us/op 0.84
BLS aggregatePubkeys 128 - blst 67.493 us/op 78.506 us/op 0.86
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 55.658 ms/op 72.670 ms/op 0.77
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 52.604 ms/op 71.417 ms/op 0.74
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 31.876 ms/op 38.668 ms/op 0.82
getSlashingsAndExits - default max 86.363 us/op 136.74 us/op 0.63
getSlashingsAndExits - 2k 267.68 us/op 569.73 us/op 0.47
proposeBlockBody type=full, size=empty 5.6679 ms/op 6.9997 ms/op 0.81
isKnown best case - 1 super set check 285.00 ns/op 599.00 ns/op 0.48
isKnown normal case - 2 super set checks 286.00 ns/op 659.00 ns/op 0.43
isKnown worse case - 16 super set checks 280.00 ns/op 657.00 ns/op 0.43
InMemoryCheckpointStateCache - add get delete 2.9800 us/op 3.7290 us/op 0.80
updateUnfinalizedPubkeys - updating 10 pubkeys 698.96 us/op 1.5876 ms/op 0.44
updateUnfinalizedPubkeys - updating 100 pubkeys 3.6377 ms/op 5.5220 ms/op 0.66
updateUnfinalizedPubkeys - updating 1000 pubkeys 47.869 ms/op 71.001 ms/op 0.67
validate api signedAggregateAndProof - struct 1.4327 ms/op 1.7179 ms/op 0.83
validate gossip signedAggregateAndProof - struct 1.3958 ms/op 1.8043 ms/op 0.77
batch validate gossip attestation - vc 640000 - chunk 32 121.75 us/op 149.80 us/op 0.81
batch validate gossip attestation - vc 640000 - chunk 64 111.17 us/op 132.88 us/op 0.84
batch validate gossip attestation - vc 640000 - chunk 128 103.57 us/op 124.15 us/op 0.83
batch validate gossip attestation - vc 640000 - chunk 256 96.885 us/op 120.17 us/op 0.81
pickEth1Vote - no votes 1.0114 ms/op 1.2757 ms/op 0.79
pickEth1Vote - max votes 6.3746 ms/op 8.0565 ms/op 0.79
pickEth1Vote - Eth1Data hashTreeRoot value x2048 18.647 ms/op 18.072 ms/op 1.03
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 19.146 ms/op 21.410 ms/op 0.89
pickEth1Vote - Eth1Data fastSerialize value x2048 445.43 us/op 590.20 us/op 0.75
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.2142 ms/op 4.0914 ms/op 0.79
bytes32 toHexString 423.00 ns/op 580.00 ns/op 0.73
bytes32 Buffer.toString(hex) 244.00 ns/op 269.00 ns/op 0.91
bytes32 Buffer.toString(hex) from Uint8Array 361.00 ns/op 466.00 ns/op 0.77
bytes32 Buffer.toString(hex) + 0x 250.00 ns/op 269.00 ns/op 0.93
Object access 1 prop 0.13500 ns/op 0.19800 ns/op 0.68
Map access 1 prop 0.13100 ns/op 0.14300 ns/op 0.92
Object get x1000 5.7790 ns/op 6.2200 ns/op 0.93
Map get x1000 6.4360 ns/op 6.7160 ns/op 0.96
Object set x1000 32.283 ns/op 46.023 ns/op 0.70
Map set x1000 21.347 ns/op 31.104 ns/op 0.69
Return object 10000 times 0.28270 ns/op 0.31420 ns/op 0.90
Throw Error 10000 times 3.2746 us/op 3.5402 us/op 0.92
toHex 144.05 ns/op 192.93 ns/op 0.75
Buffer.from 129.56 ns/op 174.08 ns/op 0.74
shared Buffer 83.773 ns/op 101.89 ns/op 0.82
fastMsgIdFn sha256 / 200 bytes 2.1680 us/op 2.4260 us/op 0.89
fastMsgIdFn h32 xxhash / 200 bytes 224.00 ns/op 294.00 ns/op 0.76
fastMsgIdFn h64 xxhash / 200 bytes 257.00 ns/op 274.00 ns/op 0.94
fastMsgIdFn sha256 / 1000 bytes 7.1470 us/op 7.6810 us/op 0.93
fastMsgIdFn h32 xxhash / 1000 bytes 345.00 ns/op 432.00 ns/op 0.80
fastMsgIdFn h64 xxhash / 1000 bytes 328.00 ns/op 364.00 ns/op 0.90
fastMsgIdFn sha256 / 10000 bytes 63.181 us/op 66.101 us/op 0.96
fastMsgIdFn h32 xxhash / 10000 bytes 1.8120 us/op 1.9100 us/op 0.95
fastMsgIdFn h64 xxhash / 10000 bytes 1.2030 us/op 1.2340 us/op 0.97
send data - 1000 256B messages 11.322 ms/op 14.963 ms/op 0.76
send data - 1000 512B messages 15.395 ms/op 19.967 ms/op 0.77
send data - 1000 1024B messages 24.642 ms/op 33.145 ms/op 0.74
send data - 1000 1200B messages 24.194 ms/op 32.082 ms/op 0.75
send data - 1000 2048B messages 30.827 ms/op 36.532 ms/op 0.84
send data - 1000 4096B messages 30.261 ms/op 39.694 ms/op 0.76
send data - 1000 16384B messages 68.499 ms/op 82.822 ms/op 0.83
send data - 1000 65536B messages 204.53 ms/op 241.41 ms/op 0.85
enrSubnets - fastDeserialize 64 bits 1.0700 us/op 1.5430 us/op 0.69
enrSubnets - ssz BitVector 64 bits 348.00 ns/op 477.00 ns/op 0.73
enrSubnets - fastDeserialize 4 bits 146.00 ns/op 212.00 ns/op 0.69
enrSubnets - ssz BitVector 4 bits 355.00 ns/op 481.00 ns/op 0.74
prioritizePeers score -10:0 att 32-0.1 sync 2-0 124.17 us/op 206.39 us/op 0.60
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 150.95 us/op 232.66 us/op 0.65
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 212.41 us/op 312.48 us/op 0.68
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 382.47 us/op 516.73 us/op 0.74
prioritizePeers score 0:0 att 64-1 sync 4-1 477.81 us/op 931.36 us/op 0.51
array of 16000 items push then shift 1.6147 us/op 1.7495 us/op 0.92
LinkedList of 16000 items push then shift 7.0380 ns/op 8.3800 ns/op 0.84
array of 16000 items push then pop 116.78 ns/op 140.97 ns/op 0.83
LinkedList of 16000 items push then pop 7.2610 ns/op 7.6830 ns/op 0.95
array of 24000 items push then shift 2.4077 us/op 2.5900 us/op 0.93
LinkedList of 24000 items push then shift 7.0820 ns/op 8.4230 ns/op 0.84
array of 24000 items push then pop 143.55 ns/op 196.82 ns/op 0.73
LinkedList of 24000 items push then pop 6.8240 ns/op 8.5480 ns/op 0.80
intersect bitArray bitLen 8 6.2490 ns/op 6.7910 ns/op 0.92
intersect array and set length 8 42.571 ns/op 68.412 ns/op 0.62
intersect bitArray bitLen 128 29.341 ns/op 31.175 ns/op 0.94
intersect array and set length 128 639.92 ns/op 978.64 ns/op 0.65
bitArray.getTrueBitIndexes() bitLen 128 1.3160 us/op 2.3820 us/op 0.55
bitArray.getTrueBitIndexes() bitLen 248 2.1790 us/op 4.5330 us/op 0.48
bitArray.getTrueBitIndexes() bitLen 512 4.2020 us/op 10.675 us/op 0.39
Buffer.concat 32 items 915.00 ns/op 1.1300 us/op 0.81
Uint8Array.set 32 items 2.2380 us/op 1.7500 us/op 1.28
Buffer.copy 2.0360 us/op 1.9550 us/op 1.04
Uint8Array.set - with subarray 2.9390 us/op 3.0170 us/op 0.97
Uint8Array.set - without subarray 1.8270 us/op 1.5520 us/op 1.18
getUint32 - dataview 238.00 ns/op 301.00 ns/op 0.79
getUint32 - manual 151.00 ns/op 216.00 ns/op 0.70
Set add up to 64 items then delete first 2.1862 us/op 2.7978 us/op 0.78
OrderedSet add up to 64 items then delete first 3.3994 us/op 4.2687 us/op 0.80
Set add up to 64 items then delete last 2.4991 us/op 3.2033 us/op 0.78
OrderedSet add up to 64 items then delete last 3.5005 us/op 4.6594 us/op 0.75
Set add up to 64 items then delete middle 2.4772 us/op 3.2741 us/op 0.76
OrderedSet add up to 64 items then delete middle 5.0889 us/op 6.5774 us/op 0.77
Set add up to 128 items then delete first 4.9413 us/op 6.5325 us/op 0.76
OrderedSet add up to 128 items then delete first 7.3416 us/op 10.231 us/op 0.72
Set add up to 128 items then delete last 4.9539 us/op 6.4133 us/op 0.77
OrderedSet add up to 128 items then delete last 7.1327 us/op 9.7123 us/op 0.73
Set add up to 128 items then delete middle 4.8710 us/op 6.1692 us/op 0.79
OrderedSet add up to 128 items then delete middle 13.670 us/op 16.703 us/op 0.82
Set add up to 256 items then delete first 10.116 us/op 13.521 us/op 0.75
OrderedSet add up to 256 items then delete first 15.391 us/op 21.222 us/op 0.73
Set add up to 256 items then delete last 9.6022 us/op 12.403 us/op 0.77
OrderedSet add up to 256 items then delete last 14.563 us/op 16.901 us/op 0.86
Set add up to 256 items then delete middle 9.6874 us/op 11.884 us/op 0.82
OrderedSet add up to 256 items then delete middle 41.843 us/op 47.955 us/op 0.87
transfer serialized Status (84 B) 1.3130 us/op 1.5470 us/op 0.85
copy serialized Status (84 B) 1.0970 us/op 1.3170 us/op 0.83
transfer serialized SignedVoluntaryExit (112 B) 1.3770 us/op 1.6140 us/op 0.85
copy serialized SignedVoluntaryExit (112 B) 1.2370 us/op 1.3850 us/op 0.89
transfer serialized ProposerSlashing (416 B) 1.5690 us/op 2.1460 us/op 0.73
copy serialized ProposerSlashing (416 B) 1.6570 us/op 1.8480 us/op 0.90
transfer serialized Attestation (485 B) 1.5690 us/op 2.1090 us/op 0.74
copy serialized Attestation (485 B) 1.8110 us/op 1.9650 us/op 0.92
transfer serialized AttesterSlashing (33232 B) 2.6060 us/op 2.0930 us/op 1.25
copy serialized AttesterSlashing (33232 B) 6.7230 us/op 10.179 us/op 0.66
transfer serialized Small SignedBeaconBlock (128000 B) 3.6260 us/op 3.9160 us/op 0.93
copy serialized Small SignedBeaconBlock (128000 B) 15.787 us/op 26.182 us/op 0.60
transfer serialized Avg SignedBeaconBlock (200000 B) 3.5150 us/op 3.9210 us/op 0.90
copy serialized Avg SignedBeaconBlock (200000 B) 20.759 us/op 30.642 us/op 0.68
transfer serialized BlobsSidecar (524380 B) 3.4510 us/op 5.5580 us/op 0.62
copy serialized BlobsSidecar (524380 B) 104.78 us/op 228.31 us/op 0.46
transfer serialized Big SignedBeaconBlock (1000000 B) 3.2910 us/op 5.5020 us/op 0.60
copy serialized Big SignedBeaconBlock (1000000 B) 156.31 us/op 201.94 us/op 0.77
pass gossip attestations to forkchoice per slot 2.8598 ms/op 3.1845 ms/op 0.90
forkChoice updateHead vc 100000 bc 64 eq 0 453.50 us/op 541.70 us/op 0.84
forkChoice updateHead vc 600000 bc 64 eq 0 3.6327 ms/op 5.2734 ms/op 0.69
forkChoice updateHead vc 1000000 bc 64 eq 0 5.2501 ms/op 6.2213 ms/op 0.84
forkChoice updateHead vc 600000 bc 320 eq 0 2.9896 ms/op 3.4941 ms/op 0.86
forkChoice updateHead vc 600000 bc 1200 eq 0 3.2609 ms/op 3.8238 ms/op 0.85
forkChoice updateHead vc 600000 bc 7200 eq 0 4.6618 ms/op 4.1405 ms/op 1.13
forkChoice updateHead vc 600000 bc 64 eq 1000 10.576 ms/op 11.632 ms/op 0.91
forkChoice updateHead vc 600000 bc 64 eq 10000 10.428 ms/op 11.876 ms/op 0.88
forkChoice updateHead vc 600000 bc 64 eq 300000 15.412 ms/op 21.898 ms/op 0.70
computeDeltas 500000 validators 300 proto nodes 4.4203 ms/op 3.9925 ms/op 1.11
computeDeltas 500000 validators 1200 proto nodes 4.1655 ms/op 3.8194 ms/op 1.09
computeDeltas 500000 validators 7200 proto nodes 4.0827 ms/op 3.8255 ms/op 1.07
computeDeltas 750000 validators 300 proto nodes 6.1871 ms/op 5.6028 ms/op 1.10
computeDeltas 750000 validators 1200 proto nodes 6.1066 ms/op 5.2703 ms/op 1.16
computeDeltas 750000 validators 7200 proto nodes 6.0094 ms/op 5.4725 ms/op 1.10
computeDeltas 1400000 validators 300 proto nodes 11.206 ms/op 11.326 ms/op 0.99
computeDeltas 1400000 validators 1200 proto nodes 11.835 ms/op 11.345 ms/op 1.04
computeDeltas 1400000 validators 7200 proto nodes 11.746 ms/op 10.578 ms/op 1.11
computeDeltas 2100000 validators 300 proto nodes 17.598 ms/op 18.161 ms/op 0.97
computeDeltas 2100000 validators 1200 proto nodes 17.850 ms/op 20.763 ms/op 0.86
computeDeltas 2100000 validators 7200 proto nodes 18.543 ms/op 19.405 ms/op 0.96
altair processAttestation - 250000 vs - 7PWei normalcase 2.1859 ms/op 2.0769 ms/op 1.05
altair processAttestation - 250000 vs - 7PWei worstcase 3.3302 ms/op 2.9500 ms/op 1.13
altair processAttestation - setStatus - 1/6 committees join 144.38 us/op 89.186 us/op 1.62
altair processAttestation - setStatus - 1/3 committees join 297.01 us/op 197.81 us/op 1.50
altair processAttestation - setStatus - 1/2 committees join 386.00 us/op 273.77 us/op 1.41
altair processAttestation - setStatus - 2/3 committees join 516.62 us/op 372.59 us/op 1.39
altair processAttestation - setStatus - 4/5 committees join 783.21 us/op 503.82 us/op 1.55
altair processAttestation - setStatus - 100% committees join 789.00 us/op 606.59 us/op 1.30
altair processBlock - 250000 vs - 7PWei normalcase 4.7615 ms/op 4.6375 ms/op 1.03
altair processBlock - 250000 vs - 7PWei normalcase hashState 33.307 ms/op 28.975 ms/op 1.15
altair processBlock - 250000 vs - 7PWei worstcase 43.735 ms/op 44.338 ms/op 0.99
altair processBlock - 250000 vs - 7PWei worstcase hashState 93.849 ms/op 73.275 ms/op 1.28
phase0 processBlock - 250000 vs - 7PWei normalcase 3.4665 ms/op 1.9194 ms/op 1.81
phase0 processBlock - 250000 vs - 7PWei worstcase 29.433 ms/op 23.576 ms/op 1.25
altair processEth1Data - 250000 vs - 7PWei normalcase 633.13 us/op 321.73 us/op 1.97
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 11.192 us/op 4.2930 us/op 2.61
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 55.915 us/op 45.727 us/op 1.22
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 19.032 us/op 10.883 us/op 1.75
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 13.594 us/op 5.3800 us/op 2.53
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 198.11 us/op 194.82 us/op 1.02
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.6210 ms/op 2.1534 ms/op 0.75
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.2373 ms/op 2.1520 ms/op 1.04
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.2925 ms/op 2.3633 ms/op 0.97
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 5.7793 ms/op 3.6653 ms/op 1.58
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.0687 ms/op 2.3727 ms/op 0.87
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 5.5057 ms/op 4.0687 ms/op 1.35
Tree 40 250000 create 406.31 ms/op 255.35 ms/op 1.59
Tree 40 250000 get(125000) 195.87 ns/op 147.71 ns/op 1.33
Tree 40 250000 set(125000) 899.33 ns/op 725.67 ns/op 1.24
Tree 40 250000 toArray() 26.077 ms/op 20.899 ms/op 1.25
Tree 40 250000 iterate all - toArray() + loop 23.418 ms/op 20.446 ms/op 1.15
Tree 40 250000 iterate all - get(i) 62.947 ms/op 63.814 ms/op 0.99
Array 250000 create 4.3086 ms/op 3.4939 ms/op 1.23
Array 250000 clone - spread 1.5886 ms/op 1.6056 ms/op 0.99
Array 250000 get(125000) 0.45300 ns/op 0.44100 ns/op 1.03
Array 250000 set(125000) 0.48400 ns/op 0.44900 ns/op 1.08
Array 250000 iterate all - loop 90.671 us/op 107.96 us/op 0.84
phase0 afterProcessEpoch - 250000 vs - 7PWei 102.19 ms/op 103.03 ms/op 0.99
Array.fill - length 1000000 6.0706 ms/op 3.9829 ms/op 1.52
Array push - length 1000000 25.199 ms/op 19.235 ms/op 1.31
Array.get 0.30002 ns/op 0.30119 ns/op 1.00
Uint8Array.get 0.46674 ns/op 0.46587 ns/op 1.00
phase0 beforeProcessEpoch - 250000 vs - 7PWei 23.790 ms/op 21.443 ms/op 1.11
altair processEpoch - mainnet_e81889 360.92 ms/op 383.45 ms/op 0.94
mainnet_e81889 - altair beforeProcessEpoch 20.605 ms/op 21.916 ms/op 0.94
mainnet_e81889 - altair processJustificationAndFinalization 15.050 us/op 17.536 us/op 0.86
mainnet_e81889 - altair processInactivityUpdates 7.3038 ms/op 6.3149 ms/op 1.16
mainnet_e81889 - altair processRewardsAndPenalties 56.231 ms/op 46.394 ms/op 1.21
mainnet_e81889 - altair processRegistryUpdates 3.0840 us/op 2.0400 us/op 1.51
mainnet_e81889 - altair processSlashings 520.00 ns/op 496.00 ns/op 1.05
mainnet_e81889 - altair processEth1DataReset 516.00 ns/op 366.00 ns/op 1.41
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.9620 ms/op 1.9469 ms/op 1.01
mainnet_e81889 - altair processSlashingsReset 2.7690 us/op 5.6070 us/op 0.49
mainnet_e81889 - altair processRandaoMixesReset 8.1100 us/op 6.7980 us/op 1.19
mainnet_e81889 - altair processHistoricalRootsUpdate 680.00 ns/op 786.00 ns/op 0.87
mainnet_e81889 - altair processParticipationFlagUpdates 4.1630 us/op 2.4910 us/op 1.67
mainnet_e81889 - altair processSyncCommitteeUpdates 472.00 ns/op 692.00 ns/op 0.68
mainnet_e81889 - altair afterProcessEpoch 105.32 ms/op 100.12 ms/op 1.05
capella processEpoch - mainnet_e217614 1.3857 s/op 1.3787 s/op 1.01
mainnet_e217614 - capella beforeProcessEpoch 80.104 ms/op 89.419 ms/op 0.90
mainnet_e217614 - capella processJustificationAndFinalization 21.006 us/op 36.957 us/op 0.57
mainnet_e217614 - capella processInactivityUpdates 19.616 ms/op 22.899 ms/op 0.86
mainnet_e217614 - capella processRewardsAndPenalties 222.16 ms/op 260.52 ms/op 0.85
mainnet_e217614 - capella processRegistryUpdates 18.966 us/op 21.824 us/op 0.87
mainnet_e217614 - capella processSlashings 440.00 ns/op 847.00 ns/op 0.52
mainnet_e217614 - capella processEth1DataReset 320.00 ns/op 781.00 ns/op 0.41
mainnet_e217614 - capella processEffectiveBalanceUpdates 12.380 ms/op 19.327 ms/op 0.64
mainnet_e217614 - capella processSlashingsReset 4.9850 us/op 13.662 us/op 0.36
mainnet_e217614 - capella processRandaoMixesReset 5.1260 us/op 11.736 us/op 0.44
mainnet_e217614 - capella processHistoricalRootsUpdate 1.5130 us/op 1.2010 us/op 1.26
mainnet_e217614 - capella processParticipationFlagUpdates 5.5760 us/op 5.2070 us/op 1.07
mainnet_e217614 - capella afterProcessEpoch 323.36 ms/op 299.55 ms/op 1.08
phase0 processEpoch - mainnet_e58758 458.39 ms/op 619.57 ms/op 0.74
mainnet_e58758 - phase0 beforeProcessEpoch 85.744 ms/op 149.90 ms/op 0.57
mainnet_e58758 - phase0 processJustificationAndFinalization 20.937 us/op 35.665 us/op 0.59
mainnet_e58758 - phase0 processRewardsAndPenalties 38.336 ms/op 53.966 ms/op 0.71
mainnet_e58758 - phase0 processRegistryUpdates 19.633 us/op 21.931 us/op 0.90
mainnet_e58758 - phase0 processSlashings 1.5250 us/op 1.1580 us/op 1.32
mainnet_e58758 - phase0 processEth1DataReset 1.4060 us/op 891.00 ns/op 1.58
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.5339 ms/op 2.0086 ms/op 1.26
mainnet_e58758 - phase0 processSlashingsReset 7.8760 us/op 7.8480 us/op 1.00
mainnet_e58758 - phase0 processRandaoMixesReset 12.058 us/op 18.442 us/op 0.65
mainnet_e58758 - phase0 processHistoricalRootsUpdate 1.1560 us/op 1.3150 us/op 0.88
mainnet_e58758 - phase0 processParticipationRecordUpdates 9.9180 us/op 11.698 us/op 0.85
mainnet_e58758 - phase0 afterProcessEpoch 125.69 ms/op 108.20 ms/op 1.16
phase0 processEffectiveBalanceUpdates - 250000 normalcase 3.2516 ms/op 2.9970 ms/op 1.08
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 5.0617 ms/op 4.3195 ms/op 1.17
altair processInactivityUpdates - 250000 normalcase 38.082 ms/op 27.712 ms/op 1.37
altair processInactivityUpdates - 250000 worstcase 28.632 ms/op 30.270 ms/op 0.95
phase0 processRegistryUpdates - 250000 normalcase 18.720 us/op 17.334 us/op 1.08
phase0 processRegistryUpdates - 250000 badcase_full_deposits 475.65 us/op 482.31 us/op 0.99
phase0 processRegistryUpdates - 250000 worstcase 0.5 234.16 ms/op 281.47 ms/op 0.83
altair processRewardsAndPenalties - 250000 normalcase 78.684 ms/op 55.808 ms/op 1.41
altair processRewardsAndPenalties - 250000 worstcase 64.202 ms/op 49.132 ms/op 1.31
phase0 getAttestationDeltas - 250000 normalcase 11.625 ms/op 10.406 ms/op 1.12
phase0 getAttestationDeltas - 250000 worstcase 9.8404 ms/op 9.6373 ms/op 1.02
phase0 processSlashings - 250000 worstcase 129.12 us/op 118.56 us/op 1.09
altair processSyncCommitteeUpdates - 250000 143.94 ms/op 157.93 ms/op 0.91
BeaconState.hashTreeRoot - No change 236.00 ns/op 271.00 ns/op 0.87
BeaconState.hashTreeRoot - 1 full validator 91.738 us/op 146.61 us/op 0.63
BeaconState.hashTreeRoot - 32 full validator 955.62 us/op 1.3878 ms/op 0.69
BeaconState.hashTreeRoot - 512 full validator 10.466 ms/op 14.720 ms/op 0.71
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 118.34 us/op 175.66 us/op 0.67
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.6259 ms/op 2.5143 ms/op 0.65
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 21.616 ms/op 37.911 ms/op 0.57
BeaconState.hashTreeRoot - 1 balances 87.379 us/op 166.37 us/op 0.53
BeaconState.hashTreeRoot - 32 balances 868.86 us/op 1.2470 ms/op 0.70
BeaconState.hashTreeRoot - 512 balances 7.2702 ms/op 13.686 ms/op 0.53
BeaconState.hashTreeRoot - 250000 balances 154.53 ms/op 259.81 ms/op 0.59
aggregationBits - 2048 els - zipIndexesInBitList 26.043 us/op 42.815 us/op 0.61
byteArrayEquals 32 55.451 ns/op 61.558 ns/op 0.90
Buffer.compare 32 17.789 ns/op 20.071 ns/op 0.89
byteArrayEquals 1024 1.6571 us/op 1.7422 us/op 0.95
Buffer.compare 1024 25.999 ns/op 31.362 ns/op 0.83
byteArrayEquals 16384 26.123 us/op 29.834 us/op 0.88
Buffer.compare 16384 202.03 ns/op 249.29 ns/op 0.81
byteArrayEquals 123687377 195.01 ms/op 232.09 ms/op 0.84
Buffer.compare 123687377 7.3001 ms/op 12.033 ms/op 0.61
byteArrayEquals 32 - diff last byte 53.123 ns/op 58.707 ns/op 0.90
Buffer.compare 32 - diff last byte 17.269 ns/op 19.520 ns/op 0.88
byteArrayEquals 1024 - diff last byte 1.6044 us/op 1.8377 us/op 0.87
Buffer.compare 1024 - diff last byte 26.803 ns/op 32.649 ns/op 0.82
byteArrayEquals 16384 - diff last byte 25.476 us/op 29.322 us/op 0.87
Buffer.compare 16384 - diff last byte 194.26 ns/op 232.58 ns/op 0.84
byteArrayEquals 123687377 - diff last byte 193.01 ms/op 206.71 ms/op 0.93
Buffer.compare 123687377 - diff last byte 7.1336 ms/op 8.6365 ms/op 0.83
byteArrayEquals 32 - random bytes 5.1880 ns/op 5.6910 ns/op 0.91
Buffer.compare 32 - random bytes 17.399 ns/op 19.325 ns/op 0.90
byteArrayEquals 1024 - random bytes 5.1810 ns/op 5.5020 ns/op 0.94
Buffer.compare 1024 - random bytes 17.357 ns/op 18.968 ns/op 0.92
byteArrayEquals 16384 - random bytes 5.1640 ns/op 5.4570 ns/op 0.95
Buffer.compare 16384 - random bytes 17.450 ns/op 18.556 ns/op 0.94
byteArrayEquals 123687377 - random bytes 6.6100 ns/op 6.8000 ns/op 0.97
Buffer.compare 123687377 - random bytes 18.750 ns/op 20.330 ns/op 0.92
regular array get 100000 times 43.312 us/op 34.977 us/op 1.24
wrappedArray get 100000 times 38.087 us/op 34.533 us/op 1.10
arrayWithProxy get 100000 times 16.025 ms/op 14.612 ms/op 1.10
ssz.Root.equals 48.627 ns/op 50.925 ns/op 0.95
byteArrayEquals 48.353 ns/op 50.450 ns/op 0.96
Buffer.compare 10.838 ns/op 11.439 ns/op 0.95
shuffle list - 16384 els 6.6103 ms/op 6.8278 ms/op 0.97
shuffle list - 250000 els 96.919 ms/op 101.76 ms/op 0.95
processSlot - 1 slots 15.094 us/op 14.441 us/op 1.05
processSlot - 32 slots 2.4434 ms/op 3.6121 ms/op 0.68
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 36.836 ms/op 37.794 ms/op 0.97
getCommitteeAssignments - req 1 vs - 250000 vc 2.2911 ms/op 2.2400 ms/op 1.02
getCommitteeAssignments - req 100 vs - 250000 vc 4.2448 ms/op 4.3516 ms/op 0.98
getCommitteeAssignments - req 1000 vs - 250000 vc 4.6572 ms/op 4.6781 ms/op 1.00
findModifiedValidators - 10000 modified validators 272.50 ms/op 260.21 ms/op 1.05
findModifiedValidators - 1000 modified validators 188.76 ms/op 193.68 ms/op 0.97
findModifiedValidators - 100 modified validators 175.92 ms/op 222.48 ms/op 0.79
findModifiedValidators - 10 modified validators 180.51 ms/op 203.71 ms/op 0.89
findModifiedValidators - 1 modified validators 169.31 ms/op 181.92 ms/op 0.93
findModifiedValidators - no difference 199.08 ms/op 161.48 ms/op 1.23
compare ViewDUs 3.3036 s/op 3.1113 s/op 1.06
compare each validator Uint8Array 1.2954 s/op 1.3995 s/op 0.93
compare ViewDU to Uint8Array 1.1433 s/op 1.0815 s/op 1.06
migrate state 1000000 validators, 24 modified, 0 new 895.21 ms/op 896.31 ms/op 1.00
migrate state 1000000 validators, 1700 modified, 1000 new 1.1555 s/op 1.0928 s/op 1.06
migrate state 1000000 validators, 3400 modified, 2000 new 1.3394 s/op 1.3073 s/op 1.02
migrate state 1500000 validators, 24 modified, 0 new 895.45 ms/op 953.91 ms/op 0.94
migrate state 1500000 validators, 1700 modified, 1000 new 1.0726 s/op 1.1992 s/op 0.89
migrate state 1500000 validators, 3400 modified, 2000 new 1.3020 s/op 1.4831 s/op 0.88
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.4200 ns/op 5.1000 ns/op 0.87
state getBlockRootAtSlot - 250000 vs - 7PWei 706.20 ns/op 693.59 ns/op 1.02
computeProposers - vc 250000 8.4774 ms/op 8.4409 ms/op 1.00
computeEpochShuffling - vc 250000 94.300 ms/op 105.68 ms/op 0.89
getNextSyncCommittee - vc 250000 134.71 ms/op 146.38 ms/op 0.92
computeSigningRoot for AttestationData 21.072 us/op 26.228 us/op 0.80
hash AttestationData serialized data then Buffer.toString(base64) 1.5945 us/op 1.7090 us/op 0.93
toHexString serialized data 882.44 ns/op 1.1483 us/op 0.77
Buffer.toString(base64) 170.12 ns/op 247.35 ns/op 0.69
nodejs block root to RootHex using toHex 158.67 ns/op 194.47 ns/op 0.82
nodejs block root to RootHex using toRootHex 97.393 ns/op 117.65 ns/op 0.83
browser block root to RootHex using the deprecated toHexString 235.28 ns/op 299.25 ns/op 0.79
browser block root to RootHex using toHex 191.32 ns/op 271.23 ns/op 0.71
browser block root to RootHex using toRootHex 166.00 ns/op 187.71 ns/op 0.88

by benchmarkbot/action

@twoeths twoeths marked this pull request as ready for review October 9, 2024 07:27
@twoeths twoeths requested a review from a team as a code owner October 9, 2024 07:27
Copy link

codecov bot commented Oct 9, 2024

Codecov Report

Attention: Patch coverage is 24.24242% with 25 lines in your changes missing coverage. Please review.

Project coverage is 49.15%. Comparing base (0d1fd9c) to head (42af173).
Report is 12 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #7142      +/-   ##
============================================
+ Coverage     49.04%   49.15%   +0.10%     
============================================
  Files           596      596              
  Lines         39743    39711      -32     
  Branches       2065     2058       -7     
============================================
+ Hits          19493    19519      +26     
+ Misses        20209    20151      -58     
  Partials         41       41              

Copy link
Member

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

changes lgtm

@twoeths twoeths merged commit a570048 into unstable Oct 11, 2024
20 checks passed
@twoeths twoeths deleted the te/improve_fork_choice branch October 11, 2024 02:37
philknows pushed a commit that referenced this pull request Oct 18, 2024
* fix: reuse deltas in computeDeltas

* fix: remodel queuedAttestations

* fix: call forkchoice.updateTime() once per clock slot

* fix: recomputeForkChoiceHead() at slot boundary

* fix: improve computeDeltas() - handle newBalances = oldBalances

* fix: do not compute forkchoice head at slot boundary

* fix: prepareNextSlot unit test
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.23.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