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: avoid ssz toHexString #7036

Closed
wants to merge 5 commits into from
Closed

fix: avoid ssz toHexString #7036

wants to merge 5 commits into from

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Aug 19, 2024

Motivation

since switching to toRootHex() it reduced gc time a lot (from ~2.9% to <2.3% on the unstable mainnet node)

Screenshot 2024-08-19 at 15 28 18

so we should continue with similar improvement

  • ssz toHexString() is not memory efficient so should not use it. There's an issue to improve it toHexString util: try String.fromCharCode api ssz#277
  • lodestar util toHexString() also uses string concatenation so should not use it. It's a duplicate to ssz version so remove it and use ssz version if needed (which will be improved in the above issue)

Description

  • do not use ssz toHexString() api
  • remove lodestar util toHexString()
  • replace by:
    • if 32 bytes: toRootHex()
    • if pubkey: toPubkeyHex() (this is new api)
    • else toHex()

Copy link
Contributor

⚠️ Performance Alert ⚠️

Possible performance regression was detected for some benchmarks.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold.

Benchmark suite Current: 7a237f7 Previous: 6f470f8 Ratio
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 7.9060 us/op 2.5970 us/op 3.04
Full benchmark results
Benchmark suite Current: 7a237f7 Previous: 6f470f8 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.8468 ms/op 1.7230 ms/op 1.07
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 39.755 us/op 40.122 us/op 0.99
BLS verify - blst 894.35 us/op 867.07 us/op 1.03
BLS verifyMultipleSignatures 3 - blst 1.7025 ms/op 1.3004 ms/op 1.31
BLS verifyMultipleSignatures 8 - blst 2.1769 ms/op 2.0663 ms/op 1.05
BLS verifyMultipleSignatures 32 - blst 4.4762 ms/op 4.3748 ms/op 1.02
BLS verifyMultipleSignatures 64 - blst 8.4141 ms/op 8.1234 ms/op 1.04
BLS verifyMultipleSignatures 128 - blst 16.101 ms/op 15.546 ms/op 1.04
BLS deserializing 10000 signatures 614.97 ms/op 585.11 ms/op 1.05
BLS deserializing 100000 signatures 6.1918 s/op 5.9947 s/op 1.03
BLS verifyMultipleSignatures - same message - 3 - blst 946.96 us/op 922.43 us/op 1.03
BLS verifyMultipleSignatures - same message - 8 - blst 1.1010 ms/op 1.0358 ms/op 1.06
BLS verifyMultipleSignatures - same message - 32 - blst 1.7043 ms/op 1.5911 ms/op 1.07
BLS verifyMultipleSignatures - same message - 64 - blst 2.6318 ms/op 2.5011 ms/op 1.05
BLS verifyMultipleSignatures - same message - 128 - blst 4.2806 ms/op 3.9425 ms/op 1.09
BLS aggregatePubkeys 32 - blst 18.312 us/op 16.978 us/op 1.08
BLS aggregatePubkeys 128 - blst 63.498 us/op 59.489 us/op 1.07
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 42.960 ms/op 66.801 ms/op 0.64
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 56.177 ms/op 57.223 ms/op 0.98
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 28.678 ms/op 28.951 ms/op 0.99
getSlashingsAndExits - default max 69.653 us/op 65.160 us/op 1.07
getSlashingsAndExits - 2k 364.12 us/op 217.06 us/op 1.68
proposeBlockBody type=full, size=empty 5.1398 ms/op 5.1930 ms/op 0.99
isKnown best case - 1 super set check 594.00 ns/op 454.00 ns/op 1.31
isKnown normal case - 2 super set checks 595.00 ns/op 442.00 ns/op 1.35
isKnown worse case - 16 super set checks 634.00 ns/op 437.00 ns/op 1.45
InMemoryCheckpointStateCache - add get delete 4.7260 us/op 2.5990 us/op 1.82
validate api signedAggregateAndProof - struct 1.6323 ms/op 1.4219 ms/op 1.15
validate gossip signedAggregateAndProof - struct 1.5856 ms/op 1.4060 ms/op 1.13
validate gossip attestation - vc 640000 999.47 us/op 963.58 us/op 1.04
batch validate gossip attestation - vc 640000 - chunk 32 138.37 us/op 115.14 us/op 1.20
batch validate gossip attestation - vc 640000 - chunk 64 121.89 us/op 102.74 us/op 1.19
batch validate gossip attestation - vc 640000 - chunk 128 114.89 us/op 93.769 us/op 1.23
batch validate gossip attestation - vc 640000 - chunk 256 112.39 us/op 91.242 us/op 1.23
pickEth1Vote - no votes 996.01 us/op 794.01 us/op 1.25
pickEth1Vote - max votes 5.0762 ms/op 5.3306 ms/op 0.95
pickEth1Vote - Eth1Data hashTreeRoot value x2048 14.080 ms/op 12.904 ms/op 1.09
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 15.514 ms/op 19.538 ms/op 0.79
pickEth1Vote - Eth1Data fastSerialize value x2048 368.61 us/op 366.75 us/op 1.01
pickEth1Vote - Eth1Data fastSerialize tree x2048 2.0991 ms/op 3.2083 ms/op 0.65
bytes32 toHexString 639.00 ns/op 531.00 ns/op 1.20
bytes32 Buffer.toString(hex) 525.00 ns/op 402.00 ns/op 1.31
bytes32 Buffer.toString(hex) from Uint8Array 664.00 ns/op 491.00 ns/op 1.35
bytes32 Buffer.toString(hex) + 0x 573.00 ns/op 403.00 ns/op 1.42
Object access 1 prop 0.38000 ns/op 0.29500 ns/op 1.29
Map access 1 prop 0.36000 ns/op 0.29600 ns/op 1.22
Object get x1000 5.2370 ns/op 4.7520 ns/op 1.10
Map get x1000 5.9070 ns/op 5.3080 ns/op 1.11
Object set x1000 24.239 ns/op 24.958 ns/op 0.97
Map set x1000 20.701 ns/op 18.701 ns/op 1.11
Return object 10000 times 0.31430 ns/op 0.29250 ns/op 1.07
Throw Error 10000 times 2.9452 us/op 2.6753 us/op 1.10
toHex 114.23 ns/op 109.96 ns/op 1.04
Buffer.from 105.25 ns/op 101.73 ns/op 1.03
shared Buffer 76.580 ns/op 69.298 ns/op 1.11
fastMsgIdFn sha256 / 200 bytes 2.1770 us/op 1.9960 us/op 1.09
fastMsgIdFn h32 xxhash / 200 bytes 509.00 ns/op 392.00 ns/op 1.30
fastMsgIdFn h64 xxhash / 200 bytes 523.00 ns/op 436.00 ns/op 1.20
fastMsgIdFn sha256 / 1000 bytes 6.2470 us/op 5.9750 us/op 1.05
fastMsgIdFn h32 xxhash / 1000 bytes 654.00 ns/op 511.00 ns/op 1.28
fastMsgIdFn h64 xxhash / 1000 bytes 602.00 ns/op 504.00 ns/op 1.19
fastMsgIdFn sha256 / 10000 bytes 50.309 us/op 50.143 us/op 1.00
fastMsgIdFn h32 xxhash / 10000 bytes 2.0840 us/op 1.8670 us/op 1.12
fastMsgIdFn h64 xxhash / 10000 bytes 1.4370 us/op 1.3140 us/op 1.09
send data - 1000 256B messages 10.840 ms/op 9.8582 ms/op 1.10
send data - 1000 512B messages 13.939 ms/op 12.812 ms/op 1.09
send data - 1000 1024B messages 24.668 ms/op 22.796 ms/op 1.08
send data - 1000 1200B messages 25.020 ms/op 22.767 ms/op 1.10
send data - 1000 2048B messages 30.667 ms/op 28.392 ms/op 1.08
send data - 1000 4096B messages 29.579 ms/op 18.502 ms/op 1.60
send data - 1000 16384B messages 73.408 ms/op 65.496 ms/op 1.12
send data - 1000 65536B messages 290.30 ms/op 221.83 ms/op 1.31
enrSubnets - fastDeserialize 64 bits 1.3270 us/op 1.1860 us/op 1.12
enrSubnets - ssz BitVector 64 bits 597.00 ns/op 496.00 ns/op 1.20
enrSubnets - fastDeserialize 4 bits 398.00 ns/op 322.00 ns/op 1.24
enrSubnets - ssz BitVector 4 bits 615.00 ns/op 505.00 ns/op 1.22
prioritizePeers score -10:0 att 32-0.1 sync 2-0 139.89 us/op 121.32 us/op 1.15
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 127.32 us/op 175.39 us/op 0.73
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 326.89 us/op 228.50 us/op 1.43
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 556.46 us/op 445.77 us/op 1.25
prioritizePeers score 0:0 att 64-1 sync 4-1 986.20 us/op 643.43 us/op 1.53
array of 16000 items push then shift 1.3581 us/op 1.2746 us/op 1.07
LinkedList of 16000 items push then shift 10.047 ns/op 6.3080 ns/op 1.59
array of 16000 items push then pop 148.91 ns/op 75.226 ns/op 1.98
LinkedList of 16000 items push then pop 8.6620 ns/op 6.1320 ns/op 1.41
array of 24000 items push then shift 1.8581 us/op 1.8632 us/op 1.00
LinkedList of 24000 items push then shift 7.2190 ns/op 6.3330 ns/op 1.14
array of 24000 items push then pop 123.76 ns/op 105.28 ns/op 1.18
LinkedList of 24000 items push then pop 6.0720 ns/op 6.2060 ns/op 0.98
intersect bitArray bitLen 8 5.2970 ns/op 5.3500 ns/op 0.99
intersect array and set length 8 41.561 ns/op 38.388 ns/op 1.08
intersect bitArray bitLen 128 28.965 ns/op 26.008 ns/op 1.11
intersect array and set length 128 579.54 ns/op 576.60 ns/op 1.01
bitArray.getTrueBitIndexes() bitLen 128 2.4710 us/op 2.0390 us/op 1.21
bitArray.getTrueBitIndexes() bitLen 248 3.2840 us/op 3.1710 us/op 1.04
bitArray.getTrueBitIndexes() bitLen 512 7.6410 us/op 6.2680 us/op 1.22
Buffer.concat 32 items 972.00 ns/op 1.0850 us/op 0.90
Uint8Array.set 32 items 1.4220 us/op 1.8660 us/op 0.76
Buffer.copy 1.6100 us/op 2.3930 us/op 0.67
Uint8Array.set - with subarray 1.9120 us/op 2.9930 us/op 0.64
Uint8Array.set - without subarray 1.4080 us/op 1.6280 us/op 0.86
getUint32 - dataview 426.00 ns/op 388.00 ns/op 1.10
getUint32 - manual 341.00 ns/op 328.00 ns/op 1.04
Set add up to 64 items then delete first 1.7851 us/op 1.7660 us/op 1.01
OrderedSet add up to 64 items then delete first 2.7998 us/op 2.7551 us/op 1.02
Set add up to 64 items then delete last 2.0186 us/op 2.0117 us/op 1.00
OrderedSet add up to 64 items then delete last 3.1070 us/op 3.0392 us/op 1.02
Set add up to 64 items then delete middle 2.1439 us/op 2.0226 us/op 1.06
OrderedSet add up to 64 items then delete middle 4.7393 us/op 4.4184 us/op 1.07
Set add up to 128 items then delete first 4.0129 us/op 3.9663 us/op 1.01
OrderedSet add up to 128 items then delete first 6.7107 us/op 6.2235 us/op 1.08
Set add up to 128 items then delete last 3.9425 us/op 3.4869 us/op 1.13
OrderedSet add up to 128 items then delete last 6.9348 us/op 5.3086 us/op 1.31
Set add up to 128 items then delete middle 4.1658 us/op 3.4707 us/op 1.20
OrderedSet add up to 128 items then delete middle 13.981 us/op 10.755 us/op 1.30
Set add up to 256 items then delete first 10.158 us/op 7.0650 us/op 1.44
OrderedSet add up to 256 items then delete first 12.903 us/op 11.371 us/op 1.13
Set add up to 256 items then delete last 7.5125 us/op 6.8329 us/op 1.10
OrderedSet add up to 256 items then delete last 11.851 us/op 10.743 us/op 1.10
Set add up to 256 items then delete middle 8.0911 us/op 6.8301 us/op 1.18
OrderedSet add up to 256 items then delete middle 35.676 us/op 31.546 us/op 1.13
transfer serialized Status (84 B) 1.6620 us/op 1.4400 us/op 1.15
copy serialized Status (84 B) 1.3550 us/op 1.2210 us/op 1.11
transfer serialized SignedVoluntaryExit (112 B) 1.7010 us/op 1.7270 us/op 0.98
copy serialized SignedVoluntaryExit (112 B) 1.4310 us/op 1.3770 us/op 1.04
transfer serialized ProposerSlashing (416 B) 2.0160 us/op 2.6950 us/op 0.75
copy serialized ProposerSlashing (416 B) 1.5060 us/op 1.6620 us/op 0.91
transfer serialized Attestation (485 B) 1.6560 us/op 2.1890 us/op 0.76
copy serialized Attestation (485 B) 1.5100 us/op 1.9610 us/op 0.77
transfer serialized AttesterSlashing (33232 B) 2.0800 us/op 2.7740 us/op 0.75
copy serialized AttesterSlashing (33232 B) 4.4180 us/op 4.3320 us/op 1.02
transfer serialized Small SignedBeaconBlock (128000 B) 2.4410 us/op 2.4690 us/op 0.99
copy serialized Small SignedBeaconBlock (128000 B) 10.288 us/op 13.923 us/op 0.74
transfer serialized Avg SignedBeaconBlock (200000 B) 3.1150 us/op 2.7070 us/op 1.15
copy serialized Avg SignedBeaconBlock (200000 B) 14.073 us/op 11.745 us/op 1.20
transfer serialized BlobsSidecar (524380 B) 3.5750 us/op 2.3510 us/op 1.52
copy serialized BlobsSidecar (524380 B) 75.969 us/op 65.908 us/op 1.15
transfer serialized Big SignedBeaconBlock (1000000 B) 4.1340 us/op 2.8160 us/op 1.47
copy serialized Big SignedBeaconBlock (1000000 B) 145.60 us/op 341.00 us/op 0.43
pass gossip attestations to forkchoice per slot 2.5140 ms/op 2.3937 ms/op 1.05
forkChoice updateHead vc 100000 bc 64 eq 0 395.97 us/op 432.83 us/op 0.91
forkChoice updateHead vc 600000 bc 64 eq 0 2.6033 ms/op 2.5778 ms/op 1.01
forkChoice updateHead vc 1000000 bc 64 eq 0 4.4638 ms/op 4.3047 ms/op 1.04
forkChoice updateHead vc 600000 bc 320 eq 0 2.6621 ms/op 2.5355 ms/op 1.05
forkChoice updateHead vc 600000 bc 1200 eq 0 2.9706 ms/op 2.5918 ms/op 1.15
forkChoice updateHead vc 600000 bc 7200 eq 0 3.8356 ms/op 2.8401 ms/op 1.35
forkChoice updateHead vc 600000 bc 64 eq 1000 9.9921 ms/op 9.6062 ms/op 1.04
forkChoice updateHead vc 600000 bc 64 eq 10000 9.6939 ms/op 8.8903 ms/op 1.09
forkChoice updateHead vc 600000 bc 64 eq 300000 13.477 ms/op 11.477 ms/op 1.17
computeDeltas 500000 validators 300 proto nodes 3.0688 ms/op 3.0184 ms/op 1.02
computeDeltas 500000 validators 1200 proto nodes 3.1335 ms/op 2.9966 ms/op 1.05
computeDeltas 500000 validators 7200 proto nodes 3.0790 ms/op 3.0632 ms/op 1.01
computeDeltas 750000 validators 300 proto nodes 4.5670 ms/op 4.4998 ms/op 1.01
computeDeltas 750000 validators 1200 proto nodes 4.4348 ms/op 4.5118 ms/op 0.98
computeDeltas 750000 validators 7200 proto nodes 4.4195 ms/op 4.4856 ms/op 0.99
computeDeltas 1400000 validators 300 proto nodes 8.2572 ms/op 7.9338 ms/op 1.04
computeDeltas 1400000 validators 1200 proto nodes 7.9622 ms/op 7.9885 ms/op 1.00
computeDeltas 1400000 validators 7200 proto nodes 8.3769 ms/op 8.0274 ms/op 1.04
computeDeltas 2100000 validators 300 proto nodes 12.263 ms/op 12.015 ms/op 1.02
computeDeltas 2100000 validators 1200 proto nodes 12.100 ms/op 12.113 ms/op 1.00
computeDeltas 2100000 validators 7200 proto nodes 12.661 ms/op 11.918 ms/op 1.06
altair processAttestation - 250000 vs - 7PWei normalcase 1.5737 ms/op 1.4207 ms/op 1.11
altair processAttestation - 250000 vs - 7PWei worstcase 2.3367 ms/op 2.1389 ms/op 1.09
altair processAttestation - setStatus - 1/6 committees join 92.335 us/op 64.253 us/op 1.44
altair processAttestation - setStatus - 1/3 committees join 185.13 us/op 123.95 us/op 1.49
altair processAttestation - setStatus - 1/2 committees join 280.15 us/op 177.78 us/op 1.58
altair processAttestation - setStatus - 2/3 committees join 387.55 us/op 240.83 us/op 1.61
altair processAttestation - setStatus - 4/5 committees join 547.90 us/op 368.96 us/op 1.48
altair processAttestation - setStatus - 100% committees join 655.21 us/op 451.79 us/op 1.45
altair processBlock - 250000 vs - 7PWei normalcase 3.7155 ms/op 4.3658 ms/op 0.85
altair processBlock - 250000 vs - 7PWei normalcase hashState 30.297 ms/op 30.590 ms/op 0.99
altair processBlock - 250000 vs - 7PWei worstcase 37.530 ms/op 35.940 ms/op 1.04
altair processBlock - 250000 vs - 7PWei worstcase hashState 102.57 ms/op 71.731 ms/op 1.43
phase0 processBlock - 250000 vs - 7PWei normalcase 2.7817 ms/op 1.7533 ms/op 1.59
phase0 processBlock - 250000 vs - 7PWei worstcase 28.130 ms/op 21.387 ms/op 1.32
altair processEth1Data - 250000 vs - 7PWei normalcase 614.67 us/op 229.66 us/op 2.68
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 7.9060 us/op 2.5970 us/op 3.04
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 23.536 us/op 31.606 us/op 0.74
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 9.1540 us/op 6.9750 us/op 1.31
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 7.4930 us/op 2.8620 us/op 2.62
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 116.46 us/op 42.950 us/op 2.71
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 550.61 us/op 884.32 us/op 0.62
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.2495 ms/op 1.0760 ms/op 1.16
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.0593 ms/op 1.0863 ms/op 0.98
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 2.7636 ms/op 2.0191 ms/op 1.37
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.6877 ms/op 1.2009 ms/op 1.41
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.7587 ms/op 3.1219 ms/op 1.20
Tree 40 250000 create 297.15 ms/op 173.63 ms/op 1.71
Tree 40 250000 get(125000) 147.62 ns/op 117.77 ns/op 1.25
Tree 40 250000 set(125000) 738.80 ns/op 520.17 ns/op 1.42
Tree 40 250000 toArray() 20.114 ms/op 9.8801 ms/op 2.04
Tree 40 250000 iterate all - toArray() + loop 20.137 ms/op 10.166 ms/op 1.98
Tree 40 250000 iterate all - get(i) 50.770 ms/op 39.952 ms/op 1.27
MutableVector 250000 create 10.946 ms/op 7.7771 ms/op 1.41
MutableVector 250000 get(125000) 5.8740 ns/op 5.7940 ns/op 1.01
MutableVector 250000 set(125000) 210.41 ns/op 180.00 ns/op 1.17
MutableVector 250000 toArray() 4.3519 ms/op 2.6594 ms/op 1.64
MutableVector 250000 iterate all - toArray() + loop 4.6505 ms/op 2.7521 ms/op 1.69
MutableVector 250000 iterate all - get(i) 1.5618 ms/op 1.4511 ms/op 1.08
Array 250000 create 3.9216 ms/op 2.3101 ms/op 1.70
Array 250000 clone - spread 1.6229 ms/op 1.3123 ms/op 1.24
Array 250000 get(125000) 0.65400 ns/op 0.57700 ns/op 1.13
Array 250000 set(125000) 0.68000 ns/op 0.59000 ns/op 1.15
Array 250000 iterate all - loop 81.304 us/op 76.317 us/op 1.07
effectiveBalanceIncrements clone Uint8Array 300000 17.746 us/op 14.135 us/op 1.26
effectiveBalanceIncrements clone MutableVector 300000 337.00 ns/op 312.00 ns/op 1.08
effectiveBalanceIncrements rw all Uint8Array 300000 175.01 us/op 165.53 us/op 1.06
effectiveBalanceIncrements rw all MutableVector 300000 59.475 ms/op 58.184 ms/op 1.02
phase0 afterProcessEpoch - 250000 vs - 7PWei 80.437 ms/op 69.310 ms/op 1.16
Array.fill - length 1000000 2.7904 ms/op 2.5099 ms/op 1.11
Array push - length 1000000 15.087 ms/op 14.083 ms/op 1.07
Array.get 0.27273 ns/op 0.25945 ns/op 1.05
Uint8Array.get 0.35637 ns/op 0.34172 ns/op 1.04
phase0 beforeProcessEpoch - 250000 vs - 7PWei 15.224 ms/op 12.319 ms/op 1.24
altair processEpoch - mainnet_e81889 341.75 ms/op 299.99 ms/op 1.14
mainnet_e81889 - altair beforeProcessEpoch 18.330 ms/op 15.511 ms/op 1.18
mainnet_e81889 - altair processJustificationAndFinalization 11.954 us/op 9.7310 us/op 1.23
mainnet_e81889 - altair processInactivityUpdates 6.3337 ms/op 3.9139 ms/op 1.62
mainnet_e81889 - altair processRewardsAndPenalties 48.546 ms/op 54.952 ms/op 0.88
mainnet_e81889 - altair processRegistryUpdates 3.0310 us/op 1.9990 us/op 1.52
mainnet_e81889 - altair processSlashings 977.00 ns/op 758.00 ns/op 1.29
mainnet_e81889 - altair processEth1DataReset 937.00 ns/op 712.00 ns/op 1.32
mainnet_e81889 - altair processEffectiveBalanceUpdates 892.64 us/op 1.3482 ms/op 0.66
mainnet_e81889 - altair processSlashingsReset 4.0320 us/op 2.3830 us/op 1.69
mainnet_e81889 - altair processRandaoMixesReset 3.7730 us/op 2.6860 us/op 1.40
mainnet_e81889 - altair processHistoricalRootsUpdate 999.00 ns/op 678.00 ns/op 1.47
mainnet_e81889 - altair processParticipationFlagUpdates 3.3270 us/op 1.5650 us/op 2.13
mainnet_e81889 - altair processSyncCommitteeUpdates 982.00 ns/op 609.00 ns/op 1.61
mainnet_e81889 - altair afterProcessEpoch 80.078 ms/op 76.011 ms/op 1.05
capella processEpoch - mainnet_e217614 1.1140 s/op 1.1192 s/op 1.00
mainnet_e217614 - capella beforeProcessEpoch 71.575 ms/op 59.625 ms/op 1.20
mainnet_e217614 - capella processJustificationAndFinalization 12.551 us/op 6.9760 us/op 1.80
mainnet_e217614 - capella processInactivityUpdates 15.303 ms/op 12.167 ms/op 1.26
mainnet_e217614 - capella processRewardsAndPenalties 245.93 ms/op 253.02 ms/op 0.97
mainnet_e217614 - capella processRegistryUpdates 12.491 us/op 11.447 us/op 1.09
mainnet_e217614 - capella processSlashings 722.00 ns/op 771.00 ns/op 0.94
mainnet_e217614 - capella processEth1DataReset 879.00 ns/op 763.00 ns/op 1.15
mainnet_e217614 - capella processEffectiveBalanceUpdates 13.532 ms/op 11.474 ms/op 1.18
mainnet_e217614 - capella processSlashingsReset 1.4110 us/op 1.6440 us/op 0.86
mainnet_e217614 - capella processRandaoMixesReset 2.5180 us/op 2.3140 us/op 1.09
mainnet_e217614 - capella processHistoricalRootsUpdate 765.00 ns/op 484.00 ns/op 1.58
mainnet_e217614 - capella processParticipationFlagUpdates 2.1570 us/op 1.1520 us/op 1.87
mainnet_e217614 - capella afterProcessEpoch 200.96 ms/op 200.43 ms/op 1.00
phase0 processEpoch - mainnet_e58758 370.68 ms/op 337.12 ms/op 1.10
mainnet_e58758 - phase0 beforeProcessEpoch 88.388 ms/op 77.293 ms/op 1.14
mainnet_e58758 - phase0 processJustificationAndFinalization 15.314 us/op 10.281 us/op 1.49
mainnet_e58758 - phase0 processRewardsAndPenalties 30.453 ms/op 38.278 ms/op 0.80
mainnet_e58758 - phase0 processRegistryUpdates 6.2740 us/op 6.4480 us/op 0.97
mainnet_e58758 - phase0 processSlashings 675.00 ns/op 760.00 ns/op 0.89
mainnet_e58758 - phase0 processEth1DataReset 688.00 ns/op 738.00 ns/op 0.93
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.1397 ms/op 1.1130 ms/op 1.02
mainnet_e58758 - phase0 processSlashingsReset 2.2940 us/op 2.1960 us/op 1.04
mainnet_e58758 - phase0 processRandaoMixesReset 3.7240 us/op 3.2600 us/op 1.14
mainnet_e58758 - phase0 processHistoricalRootsUpdate 694.00 ns/op 679.00 ns/op 1.02
mainnet_e58758 - phase0 processParticipationRecordUpdates 3.2190 us/op 3.2260 us/op 1.00
mainnet_e58758 - phase0 afterProcessEpoch 67.544 ms/op 64.347 ms/op 1.05
phase0 processEffectiveBalanceUpdates - 250000 normalcase 793.47 us/op 1.1624 ms/op 0.68
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5858 ms/op 1.1979 ms/op 1.32
altair processInactivityUpdates - 250000 normalcase 17.341 ms/op 16.631 ms/op 1.04
altair processInactivityUpdates - 250000 worstcase 17.504 ms/op 16.814 ms/op 1.04
phase0 processRegistryUpdates - 250000 normalcase 6.7450 us/op 3.3700 us/op 2.00
phase0 processRegistryUpdates - 250000 badcase_full_deposits 313.82 us/op 293.46 us/op 1.07
phase0 processRegistryUpdates - 250000 worstcase 0.5 90.300 ms/op 104.45 ms/op 0.86
altair processRewardsAndPenalties - 250000 normalcase 31.189 ms/op 47.136 ms/op 0.66
altair processRewardsAndPenalties - 250000 worstcase 30.759 ms/op 33.519 ms/op 0.92
phase0 getAttestationDeltas - 250000 normalcase 5.9299 ms/op 5.4802 ms/op 1.08
phase0 getAttestationDeltas - 250000 worstcase 5.9134 ms/op 5.8786 ms/op 1.01
phase0 processSlashings - 250000 worstcase 94.175 us/op 81.854 us/op 1.15
altair processSyncCommitteeUpdates - 250000 94.359 ms/op 100.19 ms/op 0.94
BeaconState.hashTreeRoot - No change 462.00 ns/op 500.00 ns/op 0.92
BeaconState.hashTreeRoot - 1 full validator 72.133 us/op 110.54 us/op 0.65
BeaconState.hashTreeRoot - 32 full validator 734.22 us/op 1.0940 ms/op 0.67
BeaconState.hashTreeRoot - 512 full validator 8.2742 ms/op 12.920 ms/op 0.64
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 87.020 us/op 144.40 us/op 0.60
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.2730 ms/op 1.9813 ms/op 0.64
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 15.281 ms/op 22.122 ms/op 0.69
BeaconState.hashTreeRoot - 1 balances 77.647 us/op 101.88 us/op 0.76
BeaconState.hashTreeRoot - 32 balances 639.82 us/op 958.76 us/op 0.67
BeaconState.hashTreeRoot - 512 balances 5.8632 ms/op 9.6294 ms/op 0.61
BeaconState.hashTreeRoot - 250000 balances 119.12 ms/op 172.15 ms/op 0.69
aggregationBits - 2048 els - zipIndexesInBitList 25.026 us/op 20.613 us/op 1.21
byteArrayEquals 32 49.689 ns/op 45.652 ns/op 1.09
Buffer.compare 32 15.360 ns/op 14.623 ns/op 1.05
byteArrayEquals 1024 1.2643 us/op 1.1932 us/op 1.06
Buffer.compare 1024 22.420 ns/op 22.827 ns/op 0.98
byteArrayEquals 16384 19.705 us/op 18.972 us/op 1.04
Buffer.compare 16384 192.54 ns/op 168.08 ns/op 1.15
byteArrayEquals 123687377 154.63 ms/op 149.12 ms/op 1.04
Buffer.compare 123687377 6.3572 ms/op 4.6518 ms/op 1.37
byteArrayEquals 32 - diff last byte 57.066 ns/op 46.503 ns/op 1.23
Buffer.compare 32 - diff last byte 16.295 ns/op 16.673 ns/op 0.98
byteArrayEquals 1024 - diff last byte 1.3582 us/op 1.2462 us/op 1.09
Buffer.compare 1024 - diff last byte 28.967 ns/op 23.739 ns/op 1.22
byteArrayEquals 16384 - diff last byte 20.209 us/op 19.683 us/op 1.03
Buffer.compare 16384 - diff last byte 185.25 ns/op 196.76 ns/op 0.94
byteArrayEquals 123687377 - diff last byte 147.99 ms/op 143.07 ms/op 1.03
Buffer.compare 123687377 - diff last byte 5.0931 ms/op 5.4120 ms/op 0.94
byteArrayEquals 32 - random bytes 5.0450 ns/op 4.4150 ns/op 1.14
Buffer.compare 32 - random bytes 16.016 ns/op 14.254 ns/op 1.12
byteArrayEquals 1024 - random bytes 5.0520 ns/op 7.5410 ns/op 0.67
Buffer.compare 1024 - random bytes 15.867 ns/op 22.070 ns/op 0.72
byteArrayEquals 16384 - random bytes 5.0130 ns/op 4.4310 ns/op 1.13
Buffer.compare 16384 - random bytes 15.880 ns/op 14.041 ns/op 1.13
byteArrayEquals 123687377 - random bytes 7.8800 ns/op 7.1200 ns/op 1.11
Buffer.compare 123687377 - random bytes 18.750 ns/op 16.710 ns/op 1.12
regular array get 100000 times 31.494 us/op 27.403 us/op 1.15
wrappedArray get 100000 times 31.365 us/op 27.297 us/op 1.15
arrayWithProxy get 100000 times 10.716 ms/op 9.8341 ms/op 1.09
ssz.Root.equals 44.779 ns/op 39.475 ns/op 1.13
byteArrayEquals 44.141 ns/op 39.578 ns/op 1.12
Buffer.compare 9.2340 ns/op 8.2710 ns/op 1.12
shuffle list - 16384 els 5.3708 ms/op 4.8922 ms/op 1.10
shuffle list - 250000 els 79.579 ms/op 72.968 ms/op 1.09
processSlot - 1 slots 14.726 us/op 10.899 us/op 1.35
processSlot - 32 slots 2.1223 ms/op 3.4710 ms/op 0.61
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 30.424 ms/op 41.540 ms/op 0.73
getCommitteeAssignments - req 1 vs - 250000 vc 1.7665 ms/op 1.8263 ms/op 0.97
getCommitteeAssignments - req 100 vs - 250000 vc 3.4938 ms/op 3.5400 ms/op 0.99
getCommitteeAssignments - req 1000 vs - 250000 vc 3.7730 ms/op 3.8066 ms/op 0.99
findModifiedValidators - 10000 modified validators 267.24 ms/op 229.89 ms/op 1.16
findModifiedValidators - 1000 modified validators 160.45 ms/op 142.22 ms/op 1.13
findModifiedValidators - 100 modified validators 141.21 ms/op 141.50 ms/op 1.00
findModifiedValidators - 10 modified validators 167.33 ms/op 145.53 ms/op 1.15
findModifiedValidators - 1 modified validators 161.74 ms/op 141.62 ms/op 1.14
findModifiedValidators - no difference 171.90 ms/op 134.80 ms/op 1.28
compare ViewDUs 3.2752 s/op 3.2241 s/op 1.02
compare each validator Uint8Array 1.2951 s/op 1.6117 s/op 0.80
compare ViewDU to Uint8Array 820.37 ms/op 671.66 ms/op 1.22
migrate state 1000000 validators, 24 modified, 0 new 572.74 ms/op 516.60 ms/op 1.11
migrate state 1000000 validators, 1700 modified, 1000 new 704.31 ms/op 675.78 ms/op 1.04
migrate state 1000000 validators, 3400 modified, 2000 new 992.20 ms/op 994.68 ms/op 1.00
migrate state 1500000 validators, 24 modified, 0 new 739.21 ms/op 582.64 ms/op 1.27
migrate state 1500000 validators, 1700 modified, 1000 new 797.46 ms/op 657.86 ms/op 1.21
migrate state 1500000 validators, 3400 modified, 2000 new 998.40 ms/op 1.0258 s/op 0.97
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 6.0600 ns/op 6.1700 ns/op 0.98
state getBlockRootAtSlot - 250000 vs - 7PWei 373.73 ns/op 705.95 ns/op 0.53
computeProposers - vc 250000 5.5099 ms/op 6.0855 ms/op 0.91
computeEpochShuffling - vc 250000 82.212 ms/op 81.575 ms/op 1.01
getNextSyncCommittee - vc 250000 91.125 ms/op 106.30 ms/op 0.86
computeSigningRoot for AttestationData 26.906 us/op 16.614 us/op 1.62
hash AttestationData serialized data then Buffer.toString(base64) 1.1523 us/op 1.1850 us/op 0.97
toHexString serialized data 730.50 ns/op 792.96 ns/op 0.92
Buffer.toString(base64) 132.17 ns/op 133.79 ns/op 0.99
block root to RootHex using toHex 105.59 ns/op 116.37 ns/op 0.91
block root to RootHex using toRootHex 69.561 ns/op 78.181 ns/op 0.89

by benchmarkbot/action

Copy link

codecov bot commented Aug 19, 2024

Codecov Report

Attention: Patch coverage is 66.01942% with 35 lines in your changes missing coverage. Please review.

Project coverage is 49.24%. Comparing base (6f470f8) to head (6609ccb).
Report is 90 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #7036      +/-   ##
============================================
- Coverage     49.25%   49.24%   -0.01%     
============================================
  Files           578      578              
  Lines         37443    37444       +1     
  Branches       2172     2163       -9     
============================================
- Hits          18441    18438       -3     
- Misses        18962    18966       +4     
  Partials         40       40              

@@ -45,7 +46,7 @@ export function getDefinitions(_config: ChainForkConfig): RouteDefinitions<Endpo
url: "/eth/v0/beacon/proof/state/{state_id}",
method: "GET",
req: {
writeReq: ({stateId, descriptor}) => ({params: {state_id: stateId}, query: {format: toHexString(descriptor)}}),
writeReq: ({stateId, descriptor}) => ({params: {state_id: stateId}, query: {format: toHex(descriptor)}}),
Copy link
Member

Choose a reason for hiding this comment

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

We can't use this here, otherwise the api package is no longer browser compatible, we need a switchable implementation, there is also another issue on ssz repo ChainSafe/ssz#283.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will switch to using ssz toHexString() for api for now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@twoeths twoeths changed the title fix: avoid toHexString fix: avoid ssz toHexString Aug 20, 2024
@twoeths twoeths mentioned this pull request Sep 2, 2024
@twoeths
Copy link
Contributor Author

twoeths commented Sep 11, 2024

replaced by #7075

@twoeths twoeths closed this Sep 11, 2024
@twoeths twoeths deleted the te/avoid_to_hex_string branch September 11, 2024 09:00
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