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

chore: reduce call stack in http client #6934

Merged
merged 4 commits into from
Jul 5, 2024

Conversation

nflaig
Copy link
Member

@nflaig nflaig commented Jul 4, 2024

Motivation

Makes call stack slightly easier to read if there are http errors

Description

Reduce call stack in http client by only calling requestFallbackToJson if request wireformat is ssz

@nflaig nflaig requested a review from a team as a code owner July 4, 2024 17:51
Copy link

codecov bot commented Jul 4, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 62.51%. Comparing base (dbaa46e) to head (d8392fb).
Report is 7 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #6934      +/-   ##
============================================
- Coverage     62.52%   62.51%   -0.01%     
============================================
  Files           575      575              
  Lines         60986    61014      +28     
  Branches       2118     2123       +5     
============================================
+ Hits          38129    38141      +12     
- Misses        22818    22834      +16     
  Partials         39       39              

Copy link
Contributor

github-actions bot commented Jul 4, 2024

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 915e4b8 Previous: 1aba391 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 646.98 us/op 676.62 us/op 0.96
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 37.994 us/op 58.939 us/op 0.64
BLS verify - blst-native 1.1204 ms/op 1.2402 ms/op 0.90
BLS verifyMultipleSignatures 3 - blst-native 2.3920 ms/op 2.6419 ms/op 0.91
BLS verifyMultipleSignatures 8 - blst-native 5.2779 ms/op 5.8176 ms/op 0.91
BLS verifyMultipleSignatures 32 - blst-native 19.403 ms/op 21.160 ms/op 0.92
BLS verifyMultipleSignatures 64 - blst-native 38.183 ms/op 41.344 ms/op 0.92
BLS verifyMultipleSignatures 128 - blst-native 75.896 ms/op 81.765 ms/op 0.93
BLS deserializing 10000 signatures 783.43 ms/op 858.49 ms/op 0.91
BLS deserializing 100000 signatures 7.7173 s/op 8.7461 s/op 0.88
BLS verifyMultipleSignatures - same message - 3 - blst-native 1.1317 ms/op 1.2731 ms/op 0.89
BLS verifyMultipleSignatures - same message - 8 - blst-native 1.2128 ms/op 1.4337 ms/op 0.85
BLS verifyMultipleSignatures - same message - 32 - blst-native 1.9016 ms/op 2.2408 ms/op 0.85
BLS verifyMultipleSignatures - same message - 64 - blst-native 2.8153 ms/op 3.3193 ms/op 0.85
BLS verifyMultipleSignatures - same message - 128 - blst-native 5.8705 ms/op 6.4826 ms/op 0.91
BLS aggregatePubkeys 32 - blst-native 22.336 us/op 25.128 us/op 0.89
BLS aggregatePubkeys 128 - blst-native 89.465 us/op 99.447 us/op 0.90
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 72.919 ms/op 61.049 ms/op 1.19
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 59.367 ms/op 57.443 ms/op 1.03
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 30.497 ms/op 37.498 ms/op 0.81
getSlashingsAndExits - default max 84.208 us/op 95.728 us/op 0.88
getSlashingsAndExits - 2k 257.36 us/op 289.21 us/op 0.89
proposeBlockBody type=full, size=empty 4.9401 ms/op 6.4453 ms/op 0.77
isKnown best case - 1 super set check 485.00 ns/op 312.00 ns/op 1.55
isKnown normal case - 2 super set checks 498.00 ns/op 278.00 ns/op 1.79
isKnown worse case - 16 super set checks 469.00 ns/op 266.00 ns/op 1.76
InMemoryCheckpointStateCache - add get delete 4.1000 us/op 4.9540 us/op 0.83
validate api signedAggregateAndProof - struct 2.3866 ms/op 2.6993 ms/op 0.88
validate gossip signedAggregateAndProof - struct 2.3979 ms/op 2.6619 ms/op 0.90
validate gossip attestation - vc 640000 1.1330 ms/op 1.2742 ms/op 0.89
batch validate gossip attestation - vc 640000 - chunk 32 131.33 us/op 151.94 us/op 0.86
batch validate gossip attestation - vc 640000 - chunk 64 118.81 us/op 134.51 us/op 0.88
batch validate gossip attestation - vc 640000 - chunk 128 109.28 us/op 128.05 us/op 0.85
batch validate gossip attestation - vc 640000 - chunk 256 107.71 us/op 122.01 us/op 0.88
pickEth1Vote - no votes 839.49 us/op 1.1484 ms/op 0.73
pickEth1Vote - max votes 6.0984 ms/op 6.7697 ms/op 0.90
pickEth1Vote - Eth1Data hashTreeRoot value x2048 11.581 ms/op 11.855 ms/op 0.98
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 14.816 ms/op 16.235 ms/op 0.91
pickEth1Vote - Eth1Data fastSerialize value x2048 383.13 us/op 492.00 us/op 0.78
pickEth1Vote - Eth1Data fastSerialize tree x2048 4.0440 ms/op 3.6717 ms/op 1.10
bytes32 toHexString 594.00 ns/op 433.00 ns/op 1.37
bytes32 Buffer.toString(hex) 460.00 ns/op 258.00 ns/op 1.78
bytes32 Buffer.toString(hex) from Uint8Array 591.00 ns/op 374.00 ns/op 1.58
bytes32 Buffer.toString(hex) + 0x 439.00 ns/op 282.00 ns/op 1.56
Object access 1 prop 0.31900 ns/op 0.13700 ns/op 2.33
Map access 1 prop 0.31900 ns/op 0.13300 ns/op 2.40
Object get x1000 5.2010 ns/op 5.8740 ns/op 0.89
Map get x1000 6.0560 ns/op 6.6350 ns/op 0.91
Object set x1000 22.417 ns/op 32.364 ns/op 0.69
Map set x1000 19.430 ns/op 22.076 ns/op 0.88
Return object 10000 times 0.29700 ns/op 0.29540 ns/op 1.01
Throw Error 10000 times 2.6708 us/op 3.3580 us/op 0.80
fastMsgIdFn sha256 / 200 bytes 2.0130 us/op 2.1810 us/op 0.92
fastMsgIdFn h32 xxhash / 200 bytes 398.00 ns/op 240.00 ns/op 1.66
fastMsgIdFn h64 xxhash / 200 bytes 458.00 ns/op 279.00 ns/op 1.64
fastMsgIdFn sha256 / 1000 bytes 5.8790 us/op 7.2480 us/op 0.81
fastMsgIdFn h32 xxhash / 1000 bytes 521.00 ns/op 363.00 ns/op 1.44
fastMsgIdFn h64 xxhash / 1000 bytes 524.00 ns/op 345.00 ns/op 1.52
fastMsgIdFn sha256 / 10000 bytes 50.668 us/op 63.076 us/op 0.80
fastMsgIdFn h32 xxhash / 10000 bytes 1.8940 us/op 1.8720 us/op 1.01
fastMsgIdFn h64 xxhash / 10000 bytes 1.3210 us/op 1.2290 us/op 1.07
send data - 1000 256B messages 12.163 ms/op 11.424 ms/op 1.06
send data - 1000 512B messages 14.739 ms/op 16.496 ms/op 0.89
send data - 1000 1024B messages 22.136 ms/op 24.577 ms/op 0.90
send data - 1000 1200B messages 13.883 ms/op 17.727 ms/op 0.78
send data - 1000 2048B messages 27.688 ms/op 30.350 ms/op 0.91
send data - 1000 4096B messages 26.039 ms/op 30.068 ms/op 0.87
send data - 1000 16384B messages 66.155 ms/op 70.200 ms/op 0.94
send data - 1000 65536B messages 257.02 ms/op 209.22 ms/op 1.23
enrSubnets - fastDeserialize 64 bits 1.6790 us/op 1.1130 us/op 1.51
enrSubnets - ssz BitVector 64 bits 595.00 ns/op 350.00 ns/op 1.70
enrSubnets - fastDeserialize 4 bits 370.00 ns/op 140.00 ns/op 2.64
enrSubnets - ssz BitVector 4 bits 542.00 ns/op 347.00 ns/op 1.56
prioritizePeers score -10:0 att 32-0.1 sync 2-0 139.16 us/op 154.63 us/op 0.90
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 146.80 us/op 144.58 us/op 1.02
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 319.61 us/op 238.82 us/op 1.34
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 498.21 us/op 388.22 us/op 1.28
prioritizePeers score 0:0 att 64-1 sync 4-1 960.20 us/op 591.21 us/op 1.62
array of 16000 items push then shift 1.3352 us/op 1.6202 us/op 0.82
LinkedList of 16000 items push then shift 8.2620 ns/op 7.3010 ns/op 1.13
array of 16000 items push then pop 120.22 ns/op 110.36 ns/op 1.09
LinkedList of 16000 items push then pop 6.7750 ns/op 7.1740 ns/op 0.94
array of 24000 items push then shift 1.8412 us/op 2.4152 us/op 0.76
LinkedList of 24000 items push then shift 7.3800 ns/op 7.1640 ns/op 1.03
array of 24000 items push then pop 162.72 ns/op 138.63 ns/op 1.17
LinkedList of 24000 items push then pop 6.0750 ns/op 6.8980 ns/op 0.88
intersect bitArray bitLen 8 5.2770 ns/op 6.2810 ns/op 0.84
intersect array and set length 8 40.114 ns/op 43.594 ns/op 0.92
intersect bitArray bitLen 128 27.509 ns/op 29.533 ns/op 0.93
intersect array and set length 128 611.27 ns/op 644.62 ns/op 0.95
bitArray.getTrueBitIndexes() bitLen 128 2.8020 us/op 1.7190 us/op 1.63
bitArray.getTrueBitIndexes() bitLen 248 4.3000 us/op 3.0730 us/op 1.40
bitArray.getTrueBitIndexes() bitLen 512 8.7020 us/op 6.5920 us/op 1.32
Buffer.concat 32 items 1.0900 us/op 878.00 ns/op 1.24
Uint8Array.set 32 items 1.8650 us/op 1.2820 us/op 1.45
Buffer.copy 2.0960 us/op 1.4670 us/op 1.43
Uint8Array.set - with subarray 3.3950 us/op 1.9520 us/op 1.74
Uint8Array.set - without subarray 1.8600 us/op 1.2300 us/op 1.51
Set add up to 64 items then delete first 1.8914 us/op 2.1911 us/op 0.86
OrderedSet add up to 64 items then delete first 4.0035 us/op 3.2533 us/op 1.23
Set add up to 64 items then delete last 2.7621 us/op 2.4645 us/op 1.12
OrderedSet add up to 64 items then delete last 4.2993 us/op 3.5968 us/op 1.20
Set add up to 64 items then delete middle 2.7682 us/op 2.4966 us/op 1.11
OrderedSet add up to 64 items then delete middle 5.7866 us/op 5.1336 us/op 1.13
Set add up to 128 items then delete first 5.4623 us/op 5.0120 us/op 1.09
OrderedSet add up to 128 items then delete first 8.9249 us/op 7.8673 us/op 1.13
Set add up to 128 items then delete last 5.6011 us/op 4.8832 us/op 1.15
OrderedSet add up to 128 items then delete last 8.7896 us/op 7.2366 us/op 1.21
Set add up to 128 items then delete middle 5.3657 us/op 4.8548 us/op 1.11
OrderedSet add up to 128 items then delete middle 14.563 us/op 13.518 us/op 1.08
Set add up to 256 items then delete first 11.106 us/op 10.401 us/op 1.07
OrderedSet add up to 256 items then delete first 18.816 us/op 16.465 us/op 1.14
Set add up to 256 items then delete last 11.006 us/op 9.8638 us/op 1.12
OrderedSet add up to 256 items then delete last 17.489 us/op 14.675 us/op 1.19
Set add up to 256 items then delete middle 10.374 us/op 9.5538 us/op 1.09
OrderedSet add up to 256 items then delete middle 40.057 us/op 41.111 us/op 0.97
transfer serialized Status (84 B) 1.5020 us/op 1.3910 us/op 1.08
copy serialized Status (84 B) 1.4480 us/op 1.1060 us/op 1.31
transfer serialized SignedVoluntaryExit (112 B) 1.7150 us/op 1.3870 us/op 1.24
copy serialized SignedVoluntaryExit (112 B) 1.4370 us/op 1.1260 us/op 1.28
transfer serialized ProposerSlashing (416 B) 2.0690 us/op 1.5560 us/op 1.33
copy serialized ProposerSlashing (416 B) 2.3260 us/op 1.3680 us/op 1.70
transfer serialized Attestation (485 B) 2.0500 us/op 1.5240 us/op 1.35
copy serialized Attestation (485 B) 2.1170 us/op 1.3650 us/op 1.55
transfer serialized AttesterSlashing (33232 B) 2.3310 us/op 1.7970 us/op 1.30
copy serialized AttesterSlashing (33232 B) 8.5030 us/op 4.5340 us/op 1.88
transfer serialized Small SignedBeaconBlock (128000 B) 3.2670 us/op 1.9380 us/op 1.69
copy serialized Small SignedBeaconBlock (128000 B) 25.330 us/op 13.288 us/op 1.91
transfer serialized Avg SignedBeaconBlock (200000 B) 2.9700 us/op 2.3400 us/op 1.27
copy serialized Avg SignedBeaconBlock (200000 B) 37.155 us/op 18.400 us/op 2.02
transfer serialized BlobsSidecar (524380 B) 3.7870 us/op 2.5130 us/op 1.51
copy serialized BlobsSidecar (524380 B) 190.96 us/op 164.63 us/op 1.16
transfer serialized Big SignedBeaconBlock (1000000 B) 4.8660 us/op 2.7000 us/op 1.80
copy serialized Big SignedBeaconBlock (1000000 B) 195.91 us/op 358.83 us/op 0.55
pass gossip attestations to forkchoice per slot 2.6941 ms/op 3.0586 ms/op 0.88
forkChoice updateHead vc 100000 bc 64 eq 0 416.34 us/op 498.11 us/op 0.84
forkChoice updateHead vc 600000 bc 64 eq 0 2.4932 ms/op 3.3951 ms/op 0.73
forkChoice updateHead vc 1000000 bc 64 eq 0 4.3481 ms/op 5.6085 ms/op 0.78
forkChoice updateHead vc 600000 bc 320 eq 0 2.5173 ms/op 3.1600 ms/op 0.80
forkChoice updateHead vc 600000 bc 1200 eq 0 2.6217 ms/op 3.2479 ms/op 0.81
forkChoice updateHead vc 600000 bc 7200 eq 0 3.2042 ms/op 4.1115 ms/op 0.78
forkChoice updateHead vc 600000 bc 64 eq 1000 9.9876 ms/op 10.870 ms/op 0.92
forkChoice updateHead vc 600000 bc 64 eq 10000 9.8914 ms/op 11.166 ms/op 0.89
forkChoice updateHead vc 600000 bc 64 eq 300000 13.015 ms/op 15.596 ms/op 0.83
computeDeltas 500000 validators 300 proto nodes 3.1231 ms/op 3.7713 ms/op 0.83
computeDeltas 500000 validators 1200 proto nodes 3.1683 ms/op 3.6808 ms/op 0.86
computeDeltas 500000 validators 7200 proto nodes 3.2056 ms/op 3.7356 ms/op 0.86
computeDeltas 750000 validators 300 proto nodes 4.9322 ms/op 5.5345 ms/op 0.89
computeDeltas 750000 validators 1200 proto nodes 4.6359 ms/op 5.5522 ms/op 0.83
computeDeltas 750000 validators 7200 proto nodes 4.6582 ms/op 5.5319 ms/op 0.84
computeDeltas 1400000 validators 300 proto nodes 8.3881 ms/op 10.316 ms/op 0.81
computeDeltas 1400000 validators 1200 proto nodes 8.1935 ms/op 10.322 ms/op 0.79
computeDeltas 1400000 validators 7200 proto nodes 8.2684 ms/op 10.169 ms/op 0.81
computeDeltas 2100000 validators 300 proto nodes 12.504 ms/op 14.962 ms/op 0.84
computeDeltas 2100000 validators 1200 proto nodes 12.212 ms/op 14.752 ms/op 0.83
computeDeltas 2100000 validators 7200 proto nodes 12.711 ms/op 14.333 ms/op 0.89
altair processAttestation - 250000 vs - 7PWei normalcase 1.4651 ms/op 1.6589 ms/op 0.88
altair processAttestation - 250000 vs - 7PWei worstcase 2.0534 ms/op 2.4211 ms/op 0.85
altair processAttestation - setStatus - 1/6 committees join 73.354 us/op 88.629 us/op 0.83
altair processAttestation - setStatus - 1/3 committees join 142.15 us/op 172.74 us/op 0.82
altair processAttestation - setStatus - 1/2 committees join 202.36 us/op 243.89 us/op 0.83
altair processAttestation - setStatus - 2/3 committees join 265.94 us/op 318.20 us/op 0.84
altair processAttestation - setStatus - 4/5 committees join 391.51 us/op 450.39 us/op 0.87
altair processAttestation - setStatus - 100% committees join 489.08 us/op 537.29 us/op 0.91
altair processBlock - 250000 vs - 7PWei normalcase 4.6594 ms/op 4.0024 ms/op 1.16
altair processBlock - 250000 vs - 7PWei normalcase hashState 20.492 ms/op 25.700 ms/op 0.80
altair processBlock - 250000 vs - 7PWei worstcase 35.335 ms/op 42.778 ms/op 0.83
altair processBlock - 250000 vs - 7PWei worstcase hashState 68.403 ms/op 71.980 ms/op 0.95
phase0 processBlock - 250000 vs - 7PWei normalcase 1.7015 ms/op 1.7417 ms/op 0.98
phase0 processBlock - 250000 vs - 7PWei worstcase 22.718 ms/op 25.313 ms/op 0.90
altair processEth1Data - 250000 vs - 7PWei normalcase 244.63 us/op 277.25 us/op 0.88
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 4.7990 us/op 5.2940 us/op 0.91
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 17.729 us/op 18.454 us/op 0.96
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 6.9440 us/op 7.7130 us/op 0.90
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 2.8200 us/op 5.1970 us/op 0.54
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 80.204 us/op 77.094 us/op 1.04
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 765.91 us/op 692.80 us/op 1.11
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.0489 ms/op 901.67 us/op 1.16
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 689.58 us/op 898.36 us/op 0.77
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 2.0765 ms/op 2.4635 ms/op 0.84
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.1860 ms/op 1.5424 ms/op 0.77
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 2.9411 ms/op 3.7676 ms/op 0.78
Tree 40 250000 create 175.14 ms/op 220.35 ms/op 0.79
Tree 40 250000 get(125000) 115.99 ns/op 142.36 ns/op 0.81
Tree 40 250000 set(125000) 530.66 ns/op 618.88 ns/op 0.86
Tree 40 250000 toArray() 9.8725 ms/op 15.818 ms/op 0.62
Tree 40 250000 iterate all - toArray() + loop 9.8333 ms/op 15.166 ms/op 0.65
Tree 40 250000 iterate all - get(i) 41.046 ms/op 49.795 ms/op 0.82
MutableVector 250000 create 8.3439 ms/op 8.9511 ms/op 0.93
MutableVector 250000 get(125000) 5.8590 ns/op 6.0640 ns/op 0.97
MutableVector 250000 set(125000) 179.73 ns/op 214.02 ns/op 0.84
MutableVector 250000 toArray() 2.6399 ms/op 3.6736 ms/op 0.72
MutableVector 250000 iterate all - toArray() + loop 2.7272 ms/op 3.9243 ms/op 0.69
MutableVector 250000 iterate all - get(i) 1.4020 ms/op 1.7816 ms/op 0.79
Array 250000 create 2.3642 ms/op 3.0446 ms/op 0.78
Array 250000 clone - spread 1.3162 ms/op 1.3372 ms/op 0.98
Array 250000 get(125000) 0.56500 ns/op 0.40800 ns/op 1.38
Array 250000 set(125000) 0.57500 ns/op 0.43000 ns/op 1.34
Array 250000 iterate all - loop 76.544 us/op 90.267 us/op 0.85
effectiveBalanceIncrements clone Uint8Array 300000 13.758 us/op 25.370 us/op 0.54
effectiveBalanceIncrements clone MutableVector 300000 302.00 ns/op 133.00 ns/op 2.27
effectiveBalanceIncrements rw all Uint8Array 300000 165.84 us/op 170.81 us/op 0.97
effectiveBalanceIncrements rw all MutableVector 300000 58.049 ms/op 60.676 ms/op 0.96
phase0 afterProcessEpoch - 250000 vs - 7PWei 70.981 ms/op 86.331 ms/op 0.82
phase0 beforeProcessEpoch - 250000 vs - 7PWei 30.976 ms/op 38.626 ms/op 0.80
altair processEpoch - mainnet_e81889 359.70 ms/op 349.27 ms/op 1.03
mainnet_e81889 - altair beforeProcessEpoch 42.697 ms/op 61.957 ms/op 0.69
mainnet_e81889 - altair processJustificationAndFinalization 9.2610 us/op 12.088 us/op 0.77
mainnet_e81889 - altair processInactivityUpdates 5.6191 ms/op 5.5274 ms/op 1.02
mainnet_e81889 - altair processRewardsAndPenalties 53.837 ms/op 44.589 ms/op 1.21
mainnet_e81889 - altair processRegistryUpdates 1.8590 us/op 1.6150 us/op 1.15
mainnet_e81889 - altair processSlashings 817.00 ns/op 333.00 ns/op 2.45
mainnet_e81889 - altair processEth1DataReset 752.00 ns/op 332.00 ns/op 2.27
mainnet_e81889 - altair processEffectiveBalanceUpdates 825.35 us/op 1.0934 ms/op 0.75
mainnet_e81889 - altair processSlashingsReset 2.0690 us/op 2.9980 us/op 0.69
mainnet_e81889 - altair processRandaoMixesReset 2.6600 us/op 3.3160 us/op 0.80
mainnet_e81889 - altair processHistoricalRootsUpdate 1.4930 us/op 291.00 ns/op 5.13
mainnet_e81889 - altair processParticipationFlagUpdates 1.8920 us/op 2.7740 us/op 0.68
mainnet_e81889 - altair processSyncCommitteeUpdates 725.00 ns/op 568.00 ns/op 1.28
mainnet_e81889 - altair afterProcessEpoch 85.467 ms/op 92.112 ms/op 0.93
capella processEpoch - mainnet_e217614 1.2393 s/op 1.2363 s/op 1.00
mainnet_e217614 - capella beforeProcessEpoch 220.89 ms/op 248.73 ms/op 0.89
mainnet_e217614 - capella processJustificationAndFinalization 6.0640 us/op 12.797 us/op 0.47
mainnet_e217614 - capella processInactivityUpdates 15.110 ms/op 17.984 ms/op 0.84
mainnet_e217614 - capella processRewardsAndPenalties 257.34 ms/op 234.98 ms/op 1.10
mainnet_e217614 - capella processRegistryUpdates 6.5220 us/op 13.459 us/op 0.48
mainnet_e217614 - capella processSlashings 784.00 ns/op 363.00 ns/op 2.16
mainnet_e217614 - capella processEth1DataReset 710.00 ns/op 311.00 ns/op 2.28
mainnet_e217614 - capella processEffectiveBalanceUpdates 4.2281 ms/op 14.562 ms/op 0.29
mainnet_e217614 - capella processSlashingsReset 1.5020 us/op 4.6040 us/op 0.33
mainnet_e217614 - capella processRandaoMixesReset 3.0420 us/op 7.0630 us/op 0.43
mainnet_e217614 - capella processHistoricalRootsUpdate 681.00 ns/op 643.00 ns/op 1.06
mainnet_e217614 - capella processParticipationFlagUpdates 4.1850 us/op 1.7140 us/op 2.44
mainnet_e217614 - capella afterProcessEpoch 198.72 ms/op 260.65 ms/op 0.76
phase0 processEpoch - mainnet_e58758 352.78 ms/op 370.05 ms/op 0.95
mainnet_e58758 - phase0 beforeProcessEpoch 106.90 ms/op 120.05 ms/op 0.89
mainnet_e58758 - phase0 processJustificationAndFinalization 11.517 us/op 12.817 us/op 0.90
mainnet_e58758 - phase0 processRewardsAndPenalties 30.808 ms/op 34.167 ms/op 0.90
mainnet_e58758 - phase0 processRegistryUpdates 3.7700 us/op 15.648 us/op 0.24
mainnet_e58758 - phase0 processSlashings 702.00 ns/op 835.00 ns/op 0.84
mainnet_e58758 - phase0 processEth1DataReset 709.00 ns/op 976.00 ns/op 0.73
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.1071 ms/op 1.8378 ms/op 0.60
mainnet_e58758 - phase0 processSlashingsReset 2.1680 us/op 6.4850 us/op 0.33
mainnet_e58758 - phase0 processRandaoMixesReset 2.6360 us/op 8.8060 us/op 0.30
mainnet_e58758 - phase0 processHistoricalRootsUpdate 701.00 ns/op 977.00 ns/op 0.72
mainnet_e58758 - phase0 processParticipationRecordUpdates 2.4120 us/op 3.5510 us/op 0.68
mainnet_e58758 - phase0 afterProcessEpoch 63.825 ms/op 90.525 ms/op 0.71
phase0 processEffectiveBalanceUpdates - 250000 normalcase 807.29 us/op 1.3113 ms/op 0.62
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.3029 ms/op 1.9348 ms/op 0.67
altair processInactivityUpdates - 250000 normalcase 15.607 ms/op 20.868 ms/op 0.75
altair processInactivityUpdates - 250000 worstcase 17.397 ms/op 20.376 ms/op 0.85
phase0 processRegistryUpdates - 250000 normalcase 4.5770 us/op 10.997 us/op 0.42
phase0 processRegistryUpdates - 250000 badcase_full_deposits 294.34 us/op 312.90 us/op 0.94
phase0 processRegistryUpdates - 250000 worstcase 0.5 112.52 ms/op 129.01 ms/op 0.87
altair processRewardsAndPenalties - 250000 normalcase 49.097 ms/op 45.295 ms/op 1.08
altair processRewardsAndPenalties - 250000 worstcase 50.258 ms/op 41.723 ms/op 1.20
phase0 getAttestationDeltas - 250000 normalcase 5.6245 ms/op 7.5782 ms/op 0.74
phase0 getAttestationDeltas - 250000 worstcase 6.1178 ms/op 7.5610 ms/op 0.81
phase0 processSlashings - 250000 worstcase 83.282 us/op 88.274 us/op 0.94
altair processSyncCommitteeUpdates - 250000 99.307 ms/op 129.23 ms/op 0.77
BeaconState.hashTreeRoot - No change 467.00 ns/op 266.00 ns/op 1.76
BeaconState.hashTreeRoot - 1 full validator 142.92 us/op 86.676 us/op 1.65
BeaconState.hashTreeRoot - 32 full validator 1.4678 ms/op 920.51 us/op 1.59
BeaconState.hashTreeRoot - 512 full validator 10.991 ms/op 9.4301 ms/op 1.17
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 152.98 us/op 111.25 us/op 1.38
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.8812 ms/op 1.5119 ms/op 1.24
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 23.955 ms/op 27.156 ms/op 0.88
BeaconState.hashTreeRoot - 1 balances 82.421 us/op 113.47 us/op 0.73
BeaconState.hashTreeRoot - 32 balances 920.54 us/op 1.1428 ms/op 0.81
BeaconState.hashTreeRoot - 512 balances 11.799 ms/op 9.2909 ms/op 1.27
BeaconState.hashTreeRoot - 250000 balances 180.12 ms/op 180.34 ms/op 1.00
aggregationBits - 2048 els - zipIndexesInBitList 19.890 us/op 26.051 us/op 0.76
byteArrayEquals 32 45.452 ns/op 53.986 ns/op 0.84
Buffer.compare 32 14.682 ns/op 17.786 ns/op 0.83
byteArrayEquals 1024 1.1871 us/op 1.6063 us/op 0.74
Buffer.compare 1024 22.647 ns/op 26.264 ns/op 0.86
byteArrayEquals 16384 18.894 us/op 25.759 us/op 0.73
Buffer.compare 16384 195.71 ns/op 210.91 ns/op 0.93
byteArrayEquals 123687377 150.80 ms/op 191.30 ms/op 0.79
Buffer.compare 123687377 5.2220 ms/op 7.6482 ms/op 0.68
byteArrayEquals 32 - diff last byte 45.414 ns/op 53.175 ns/op 0.85
Buffer.compare 32 - diff last byte 15.038 ns/op 21.486 ns/op 0.70
byteArrayEquals 1024 - diff last byte 1.2145 us/op 1.5984 us/op 0.76
Buffer.compare 1024 - diff last byte 21.659 ns/op 26.350 ns/op 0.82
byteArrayEquals 16384 - diff last byte 19.322 us/op 25.515 us/op 0.76
Buffer.compare 16384 - diff last byte 195.84 ns/op 198.78 ns/op 0.99
byteArrayEquals 123687377 - diff last byte 149.85 ms/op 192.15 ms/op 0.78
Buffer.compare 123687377 - diff last byte 4.4913 ms/op 6.8334 ms/op 0.66
byteArrayEquals 32 - random bytes 5.1550 ns/op 5.2210 ns/op 0.99
Buffer.compare 32 - random bytes 16.066 ns/op 17.553 ns/op 0.92
byteArrayEquals 1024 - random bytes 4.8420 ns/op 5.2280 ns/op 0.93
Buffer.compare 1024 - random bytes 16.089 ns/op 17.420 ns/op 0.92
byteArrayEquals 16384 - random bytes 4.8530 ns/op 5.1950 ns/op 0.93
Buffer.compare 16384 - random bytes 16.028 ns/op 17.445 ns/op 0.92
byteArrayEquals 123687377 - random bytes 7.7700 ns/op 6.4500 ns/op 1.20
Buffer.compare 123687377 - random bytes 17.700 ns/op 18.800 ns/op 0.94
regular array get 100000 times 29.334 us/op 44.299 us/op 0.66
wrappedArray get 100000 times 29.904 us/op 33.283 us/op 0.90
arrayWithProxy get 100000 times 8.7730 ms/op 13.844 ms/op 0.63
ssz.Root.equals 42.899 ns/op 46.387 ns/op 0.92
byteArrayEquals 40.996 ns/op 45.593 ns/op 0.90
Buffer.compare 8.5150 ns/op 10.536 ns/op 0.81
shuffle list - 16384 els 5.5724 ms/op 6.3509 ms/op 0.88
shuffle list - 250000 els 83.344 ms/op 92.994 ms/op 0.90
processSlot - 1 slots 11.026 us/op 12.624 us/op 0.87
processSlot - 32 slots 3.0220 ms/op 2.5085 ms/op 1.20
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 42.498 ms/op 36.334 ms/op 1.17
getCommitteeAssignments - req 1 vs - 250000 vc 1.7948 ms/op 2.1716 ms/op 0.83
getCommitteeAssignments - req 100 vs - 250000 vc 3.4994 ms/op 4.1311 ms/op 0.85
getCommitteeAssignments - req 1000 vs - 250000 vc 3.7675 ms/op 4.4371 ms/op 0.85
findModifiedValidators - 10000 modified validators 233.57 ms/op 267.46 ms/op 0.87
findModifiedValidators - 1000 modified validators 174.85 ms/op 192.74 ms/op 0.91
findModifiedValidators - 100 modified validators 139.77 ms/op 187.13 ms/op 0.75
findModifiedValidators - 10 modified validators 149.19 ms/op 186.96 ms/op 0.80
findModifiedValidators - 1 modified validators 158.64 ms/op 173.21 ms/op 0.92
findModifiedValidators - no difference 148.34 ms/op 159.14 ms/op 0.93
compare ViewDUs 2.9621 s/op 3.0398 s/op 0.97
compare each validator Uint8Array 1.1705 s/op 1.2959 s/op 0.90
compare ViewDU to Uint8Array 749.82 ms/op 1.0615 s/op 0.71
migrate state 1000000 validators, 24 modified, 0 new 588.20 ms/op 559.79 ms/op 1.05
migrate state 1000000 validators, 1700 modified, 1000 new 823.83 ms/op 844.83 ms/op 0.98
migrate state 1000000 validators, 3400 modified, 2000 new 987.38 ms/op 987.98 ms/op 1.00
migrate state 1500000 validators, 24 modified, 0 new 609.13 ms/op 594.38 ms/op 1.02
migrate state 1500000 validators, 1700 modified, 1000 new 775.33 ms/op 821.59 ms/op 0.94
migrate state 1500000 validators, 3400 modified, 2000 new 922.18 ms/op 1.0072 s/op 0.92
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 6.0500 ns/op 4.4500 ns/op 1.36
state getBlockRootAtSlot - 250000 vs - 7PWei 722.77 ns/op 728.26 ns/op 0.99
computeProposers - vc 250000 5.7204 ms/op 7.1731 ms/op 0.80
computeEpochShuffling - vc 250000 81.373 ms/op 93.604 ms/op 0.87
getNextSyncCommittee - vc 250000 91.998 ms/op 123.92 ms/op 0.74
computeSigningRoot for AttestationData 13.837 us/op 18.865 us/op 0.73
hash AttestationData serialized data then Buffer.toString(base64) 1.1998 us/op 1.5486 us/op 0.77
toHexString serialized data 768.92 ns/op 907.62 ns/op 0.85
Buffer.toString(base64) 143.78 ns/op 185.06 ns/op 0.78

by benchmarkbot/action

@@ -394,6 +396,10 @@ export class HttpClient implements IHttpClient {
abortSignals.forEach((s) => s?.removeEventListener("abort", onSignalAbort));
}
}

private getRequestMethod(requestFormat: `${WireFormat}`): typeof this._request {
Copy link
Member

Choose a reason for hiding this comment

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

that is this ${} syntax in the method signature? First I've seen it used there

Copy link
Member Author

Choose a reason for hiding this comment

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

If we use the enum type it is too strict as it only allows to pass values from the enum and not the same value as string literal

same type as we have for request options

requestWireFormat?: `${WireFormat}`;

This allows the following

await api.beacon.getGenesis({responseWireFormat: "ssz"})

// instead of having to do
await api.beacon.getGenesis({responseWireFormat: WireFormat.ssz})

and you also get nice intellisense
image

More or less just a devex improvement

@wemeetagain wemeetagain merged commit dc5b68d into unstable Jul 5, 2024
20 checks passed
@wemeetagain wemeetagain deleted the nflaig/http-reduce-callstack branch July 5, 2024 18:13
@wemeetagain
Copy link
Member

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