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: upgrade biomejs to 1.9.4 #7533

Open
wants to merge 8 commits into
base: unstable
Choose a base branch
from
Open

Conversation

nazarhussain
Copy link
Contributor

@nazarhussain nazarhussain commented Mar 5, 2025

Motivation

Keep the tooling updated.

Description

  • Enable different useable new rules.

Steps to test or reproduce

Run all tests.

Please review commit by commit

For reviewers please review commit by commit.

image

@nazarhussain nazarhussain requested a review from a team as a code owner March 5, 2025 19:35
@nazarhussain
Copy link
Contributor Author

Major change in this PR is rule nursery/useAtIndex. But the change is very important as it improves the type safety.

const myArray: number[] = []

// Resolved to type `number`
const lastElement1 = myArray[myArray.length - 1]; 

// Resolved to type `number | undefined`
const lastElement2 = myArray.at(-1);                 

As you notice in the first case, if the array is empty the type for lastElement1 would be invalid. And that may introduce significant logical errors.

@nazarhussain nazarhussain marked this pull request as draft March 5, 2025 19:53
Copy link
Contributor

github-actions bot commented Mar 5, 2025

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 84fe50c Previous: d60218e Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.4566 ms/op 1.2127 ms/op 1.20
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 49.798 us/op 43.825 us/op 1.14
BLS verify - blst 920.13 us/op 1.0255 ms/op 0.90
BLS verifyMultipleSignatures 3 - blst 1.6714 ms/op 1.5817 ms/op 1.06
BLS verifyMultipleSignatures 8 - blst 2.3695 ms/op 2.1987 ms/op 1.08
BLS verifyMultipleSignatures 32 - blst 8.0261 ms/op 5.7233 ms/op 1.40
BLS verifyMultipleSignatures 64 - blst 12.610 ms/op 10.464 ms/op 1.21
BLS verifyMultipleSignatures 128 - blst 21.065 ms/op 20.107 ms/op 1.05
BLS deserializing 10000 signatures 780.71 ms/op 831.44 ms/op 0.94
BLS deserializing 100000 signatures 7.2393 s/op 7.5621 s/op 0.96
BLS verifyMultipleSignatures - same message - 3 - blst 982.04 us/op 944.01 us/op 1.04
BLS verifyMultipleSignatures - same message - 8 - blst 1.1062 ms/op 1.0647 ms/op 1.04
BLS verifyMultipleSignatures - same message - 32 - blst 1.8149 ms/op 1.7382 ms/op 1.04
BLS verifyMultipleSignatures - same message - 64 - blst 2.7511 ms/op 2.6958 ms/op 1.02
BLS verifyMultipleSignatures - same message - 128 - blst 4.7200 ms/op 4.6047 ms/op 1.03
BLS aggregatePubkeys 32 - blst 20.337 us/op 21.840 us/op 0.93
BLS aggregatePubkeys 128 - blst 73.297 us/op 75.165 us/op 0.98
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 53.663 ms/op 51.931 ms/op 1.03
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 53.239 ms/op 52.027 ms/op 1.02
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 35.374 ms/op 35.270 ms/op 1.00
getSlashingsAndExits - default max 76.088 us/op 83.115 us/op 0.92
getSlashingsAndExits - 2k 371.74 us/op 338.42 us/op 1.10
proposeBlockBody type=full, size=empty 5.0661 ms/op 5.2135 ms/op 0.97
isKnown best case - 1 super set check 208.00 ns/op 204.00 ns/op 1.02
isKnown normal case - 2 super set checks 204.00 ns/op 195.00 ns/op 1.05
isKnown worse case - 16 super set checks 208.00 ns/op 195.00 ns/op 1.07
InMemoryCheckpointStateCache - add get delete 2.5240 us/op 2.4130 us/op 1.05
validate api signedAggregateAndProof - struct 1.5440 ms/op 1.3793 ms/op 1.12
validate gossip signedAggregateAndProof - struct 1.5929 ms/op 1.3644 ms/op 1.17
batch validate gossip attestation - vc 640000 - chunk 32 122.71 us/op 119.39 us/op 1.03
batch validate gossip attestation - vc 640000 - chunk 64 106.64 us/op 105.86 us/op 1.01
batch validate gossip attestation - vc 640000 - chunk 128 98.558 us/op 107.80 us/op 0.91
batch validate gossip attestation - vc 640000 - chunk 256 103.61 us/op 109.24 us/op 0.95
pickEth1Vote - no votes 969.59 us/op 1.0250 ms/op 0.95
pickEth1Vote - max votes 6.0989 ms/op 6.1799 ms/op 0.99
pickEth1Vote - Eth1Data hashTreeRoot value x2048 12.346 ms/op 19.800 ms/op 0.62
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 17.926 ms/op 18.619 ms/op 0.96
pickEth1Vote - Eth1Data fastSerialize value x2048 444.83 us/op 449.67 us/op 0.99
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.6088 ms/op 2.6660 ms/op 1.35
bytes32 toHexString 381.00 ns/op 367.00 ns/op 1.04
bytes32 Buffer.toString(hex) 246.00 ns/op 246.00 ns/op 1.00
bytes32 Buffer.toString(hex) from Uint8Array 327.00 ns/op 330.00 ns/op 0.99
bytes32 Buffer.toString(hex) + 0x 247.00 ns/op 250.00 ns/op 0.99
Object access 1 prop 0.13300 ns/op 0.12300 ns/op 1.08
Map access 1 prop 0.12700 ns/op 0.12200 ns/op 1.04
Object get x1000 6.0960 ns/op 5.8640 ns/op 1.04
Map get x1000 6.4990 ns/op 6.2470 ns/op 1.04
Object set x1000 29.288 ns/op 27.348 ns/op 1.07
Map set x1000 20.164 ns/op 18.741 ns/op 1.08
Return object 10000 times 0.29510 ns/op 0.28360 ns/op 1.04
Throw Error 10000 times 4.5198 us/op 4.9554 us/op 0.91
toHex 147.55 ns/op 135.13 ns/op 1.09
Buffer.from 139.84 ns/op 124.84 ns/op 1.12
shared Buffer 84.389 ns/op 80.366 ns/op 1.05
fastMsgIdFn sha256 / 200 bytes 2.2320 us/op 2.1620 us/op 1.03
fastMsgIdFn h32 xxhash / 200 bytes 205.00 ns/op 209.00 ns/op 0.98
fastMsgIdFn h64 xxhash / 200 bytes 270.00 ns/op 273.00 ns/op 0.99
fastMsgIdFn sha256 / 1000 bytes 7.3680 us/op 7.3350 us/op 1.00
fastMsgIdFn h32 xxhash / 1000 bytes 343.00 ns/op 327.00 ns/op 1.05
fastMsgIdFn h64 xxhash / 1000 bytes 351.00 ns/op 347.00 ns/op 1.01
fastMsgIdFn sha256 / 10000 bytes 64.678 us/op 67.340 us/op 0.96
fastMsgIdFn h32 xxhash / 10000 bytes 1.8780 us/op 1.8290 us/op 1.03
fastMsgIdFn h64 xxhash / 10000 bytes 1.2500 us/op 1.2110 us/op 1.03
send data - 1000 256B messages 12.775 ms/op 11.968 ms/op 1.07
send data - 1000 512B messages 17.189 ms/op 20.895 ms/op 0.82
send data - 1000 1024B messages 27.151 ms/op 24.970 ms/op 1.09
send data - 1000 1200B messages 22.618 ms/op 25.161 ms/op 0.90
send data - 1000 2048B messages 23.820 ms/op 27.035 ms/op 0.88
send data - 1000 4096B messages 26.229 ms/op 30.294 ms/op 0.87
send data - 1000 16384B messages 70.752 ms/op 73.264 ms/op 0.97
send data - 1000 65536B messages 212.46 ms/op 244.73 ms/op 0.87
enrSubnets - fastDeserialize 64 bits 893.00 ns/op 951.00 ns/op 0.94
enrSubnets - ssz BitVector 64 bits 323.00 ns/op 340.00 ns/op 0.95
enrSubnets - fastDeserialize 4 bits 128.00 ns/op 132.00 ns/op 0.97
enrSubnets - ssz BitVector 4 bits 323.00 ns/op 343.00 ns/op 0.94
prioritizePeers score -10:0 att 32-0.1 sync 2-0 121.36 us/op 129.38 us/op 0.94
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 144.13 us/op 154.39 us/op 0.93
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 208.92 us/op 219.55 us/op 0.95
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 388.39 us/op 394.43 us/op 0.98
prioritizePeers score 0:0 att 64-1 sync 4-1 469.67 us/op 500.95 us/op 0.94
array of 16000 items push then shift 1.6286 us/op 1.7112 us/op 0.95
LinkedList of 16000 items push then shift 7.5170 ns/op 8.0100 ns/op 0.94
array of 16000 items push then pop 77.039 ns/op 80.878 ns/op 0.95
LinkedList of 16000 items push then pop 7.2450 ns/op 7.3530 ns/op 0.99
array of 24000 items push then shift 2.3858 us/op 2.5319 us/op 0.94
LinkedList of 24000 items push then shift 7.7350 ns/op 7.2290 ns/op 1.07
array of 24000 items push then pop 103.95 ns/op 105.51 ns/op 0.99
LinkedList of 24000 items push then pop 7.0500 ns/op 7.2290 ns/op 0.98
intersect bitArray bitLen 8 6.3440 ns/op 6.5010 ns/op 0.98
intersect array and set length 8 37.973 ns/op 38.556 ns/op 0.98
intersect bitArray bitLen 128 30.335 ns/op 30.382 ns/op 1.00
intersect array and set length 128 635.50 ns/op 635.45 ns/op 1.00
bitArray.getTrueBitIndexes() bitLen 128 1.0760 us/op 1.0620 us/op 1.01
bitArray.getTrueBitIndexes() bitLen 248 1.9210 us/op 1.8780 us/op 1.02
bitArray.getTrueBitIndexes() bitLen 512 3.7840 us/op 3.8070 us/op 0.99
Buffer.concat 32 items 605.00 ns/op 625.00 ns/op 0.97
Uint8Array.set 32 items 1.0070 us/op 1.0530 us/op 0.96
Buffer.copy 2.1290 us/op 2.1910 us/op 0.97
Uint8Array.set - with subarray 1.5950 us/op 2.8690 us/op 0.56
Uint8Array.set - without subarray 955.00 ns/op 1.9010 us/op 0.50
getUint32 - dataview 196.00 ns/op 198.00 ns/op 0.99
getUint32 - manual 123.00 ns/op 120.00 ns/op 1.02
Set add up to 64 items then delete first 2.1072 us/op 2.2710 us/op 0.93
OrderedSet add up to 64 items then delete first 4.3908 us/op 3.4932 us/op 1.26
Set add up to 64 items then delete last 2.5202 us/op 2.6171 us/op 0.96
OrderedSet add up to 64 items then delete last 3.9470 us/op 3.6478 us/op 1.08
Set add up to 64 items then delete middle 2.4947 us/op 2.3923 us/op 1.04
OrderedSet add up to 64 items then delete middle 5.2228 us/op 5.2936 us/op 0.99
Set add up to 128 items then delete first 4.9351 us/op 5.1866 us/op 0.95
OrderedSet add up to 128 items then delete first 7.8315 us/op 8.1366 us/op 0.96
Set add up to 128 items then delete last 4.8875 us/op 5.2571 us/op 0.93
OrderedSet add up to 128 items then delete last 7.1296 us/op 7.6214 us/op 0.94
Set add up to 128 items then delete middle 4.8826 us/op 5.0747 us/op 0.96
OrderedSet add up to 128 items then delete middle 14.057 us/op 14.404 us/op 0.98
Set add up to 256 items then delete first 10.467 us/op 11.512 us/op 0.91
OrderedSet add up to 256 items then delete first 15.984 us/op 18.026 us/op 0.89
Set add up to 256 items then delete last 12.689 us/op 11.961 us/op 1.06
OrderedSet add up to 256 items then delete last 14.689 us/op 18.208 us/op 0.81
Set add up to 256 items then delete middle 9.6463 us/op 10.358 us/op 0.93
OrderedSet add up to 256 items then delete middle 40.982 us/op 41.508 us/op 0.99
transfer serialized Status (84 B) 2.2440 us/op 2.1920 us/op 1.02
copy serialized Status (84 B) 1.1830 us/op 1.1580 us/op 1.02
transfer serialized SignedVoluntaryExit (112 B) 2.2670 us/op 2.2210 us/op 1.02
copy serialized SignedVoluntaryExit (112 B) 1.2160 us/op 1.1690 us/op 1.04
transfer serialized ProposerSlashing (416 B) 2.3300 us/op 2.2400 us/op 1.04
copy serialized ProposerSlashing (416 B) 1.2970 us/op 1.2570 us/op 1.03
transfer serialized Attestation (485 B) 2.3280 us/op 2.2390 us/op 1.04
copy serialized Attestation (485 B) 1.2960 us/op 1.2970 us/op 1.00
transfer serialized AttesterSlashing (33232 B) 2.6710 us/op 2.6410 us/op 1.01
copy serialized AttesterSlashing (33232 B) 4.1210 us/op 4.0380 us/op 1.02
transfer serialized Small SignedBeaconBlock (128000 B) 3.3410 us/op 3.1580 us/op 1.06
copy serialized Small SignedBeaconBlock (128000 B) 9.7260 us/op 9.7550 us/op 1.00
transfer serialized Avg SignedBeaconBlock (200000 B) 3.7240 us/op 3.8320 us/op 0.97
copy serialized Avg SignedBeaconBlock (200000 B) 13.778 us/op 15.748 us/op 0.87
transfer serialized BlobsSidecar (524380 B) 3.6610 us/op 4.5290 us/op 0.81
copy serialized BlobsSidecar (524380 B) 61.522 us/op 63.967 us/op 0.96
transfer serialized Big SignedBeaconBlock (1000000 B) 4.0780 us/op 4.4250 us/op 0.92
copy serialized Big SignedBeaconBlock (1000000 B) 175.05 us/op 245.36 us/op 0.71
pass gossip attestations to forkchoice per slot 2.7931 ms/op 2.7769 ms/op 1.01
forkChoice updateHead vc 100000 bc 64 eq 0 451.85 us/op 472.64 us/op 0.96
forkChoice updateHead vc 600000 bc 64 eq 0 2.7708 ms/op 2.8803 ms/op 0.96
forkChoice updateHead vc 1000000 bc 64 eq 0 4.7989 ms/op 4.9662 ms/op 0.97
forkChoice updateHead vc 600000 bc 320 eq 0 2.8377 ms/op 2.9377 ms/op 0.97
forkChoice updateHead vc 600000 bc 1200 eq 0 2.9076 ms/op 2.9971 ms/op 0.97
forkChoice updateHead vc 600000 bc 7200 eq 0 3.0618 ms/op 3.3168 ms/op 0.92
forkChoice updateHead vc 600000 bc 64 eq 1000 10.332 ms/op 10.885 ms/op 0.95
forkChoice updateHead vc 600000 bc 64 eq 10000 10.298 ms/op 10.940 ms/op 0.94
forkChoice updateHead vc 600000 bc 64 eq 300000 13.698 ms/op 14.984 ms/op 0.91
computeDeltas 500000 validators 300 proto nodes 3.9580 ms/op 4.0379 ms/op 0.98
computeDeltas 500000 validators 1200 proto nodes 3.9560 ms/op 4.0236 ms/op 0.98
computeDeltas 500000 validators 7200 proto nodes 3.9872 ms/op 4.0326 ms/op 0.99
computeDeltas 750000 validators 300 proto nodes 5.8389 ms/op 6.0494 ms/op 0.97
computeDeltas 750000 validators 1200 proto nodes 5.8347 ms/op 6.1874 ms/op 0.94
computeDeltas 750000 validators 7200 proto nodes 5.8654 ms/op 7.0469 ms/op 0.83
computeDeltas 1400000 validators 300 proto nodes 10.989 ms/op 14.079 ms/op 0.78
computeDeltas 1400000 validators 1200 proto nodes 11.196 ms/op 14.008 ms/op 0.80
computeDeltas 1400000 validators 7200 proto nodes 10.988 ms/op 12.325 ms/op 0.89
computeDeltas 2100000 validators 300 proto nodes 16.302 ms/op 16.806 ms/op 0.97
computeDeltas 2100000 validators 1200 proto nodes 16.265 ms/op 20.096 ms/op 0.81
computeDeltas 2100000 validators 7200 proto nodes 16.217 ms/op 17.842 ms/op 0.91
altair processAttestation - 250000 vs - 7PWei normalcase 2.0472 ms/op 2.1407 ms/op 0.96
altair processAttestation - 250000 vs - 7PWei worstcase 3.0027 ms/op 3.3765 ms/op 0.89
altair processAttestation - setStatus - 1/6 committees join 120.28 us/op 136.64 us/op 0.88
altair processAttestation - setStatus - 1/3 committees join 229.53 us/op 257.94 us/op 0.89
altair processAttestation - setStatus - 1/2 committees join 348.51 us/op 371.58 us/op 0.94
altair processAttestation - setStatus - 2/3 committees join 421.61 us/op 450.64 us/op 0.94
altair processAttestation - setStatus - 4/5 committees join 585.64 us/op 687.15 us/op 0.85
altair processAttestation - setStatus - 100% committees join 706.46 us/op 807.17 us/op 0.88
altair processBlock - 250000 vs - 7PWei normalcase 4.1949 ms/op 5.5016 ms/op 0.76
altair processBlock - 250000 vs - 7PWei normalcase hashState 33.915 ms/op 40.170 ms/op 0.84
altair processBlock - 250000 vs - 7PWei worstcase 36.159 ms/op 45.087 ms/op 0.80
altair processBlock - 250000 vs - 7PWei worstcase hashState 78.362 ms/op 108.08 ms/op 0.73
phase0 processBlock - 250000 vs - 7PWei normalcase 1.5703 ms/op 1.9747 ms/op 0.80
phase0 processBlock - 250000 vs - 7PWei worstcase 20.309 ms/op 26.033 ms/op 0.78
altair processEth1Data - 250000 vs - 7PWei normalcase 332.80 us/op 382.60 us/op 0.87
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 6.4630 us/op 6.8750 us/op 0.94
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 41.196 us/op 34.173 us/op 1.21
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 7.6750 us/op 10.412 us/op 0.74
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 5.7400 us/op 6.6370 us/op 0.86
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 122.85 us/op 139.42 us/op 0.88
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 932.45 us/op 1.2045 ms/op 0.77
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.2592 ms/op 1.6200 ms/op 0.78
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.3285 ms/op 1.5886 ms/op 0.84
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 3.3523 ms/op 3.9169 ms/op 0.86
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.3389 ms/op 1.6609 ms/op 0.81
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.4632 ms/op 4.3487 ms/op 0.80
Tree 40 250000 create 449.88 ms/op 716.72 ms/op 0.63
Tree 40 250000 get(125000) 147.73 ns/op 161.55 ns/op 0.91
Tree 40 250000 set(125000) 1.4963 us/op 2.0703 us/op 0.72
Tree 40 250000 toArray() 16.580 ms/op 22.169 ms/op 0.75
Tree 40 250000 iterate all - toArray() + loop 17.870 ms/op 26.649 ms/op 0.67
Tree 40 250000 iterate all - get(i) 56.135 ms/op 68.791 ms/op 0.82
Array 250000 create 2.3972 ms/op 2.8252 ms/op 0.85
Array 250000 clone - spread 796.57 us/op 1.5252 ms/op 0.52
Array 250000 get(125000) 0.41400 ns/op 0.44700 ns/op 0.93
Array 250000 set(125000) 0.44500 ns/op 0.47900 ns/op 0.93
Array 250000 iterate all - loop 96.491 us/op 122.73 us/op 0.79
phase0 afterProcessEpoch - 250000 vs - 7PWei 48.031 ms/op 55.947 ms/op 0.86
Array.fill - length 1000000 3.5165 ms/op 4.3666 ms/op 0.81
Array push - length 1000000 13.039 ms/op 18.222 ms/op 0.72
Array.get 0.28337 ns/op 0.30359 ns/op 0.93
Uint8Array.get 0.44914 ns/op 0.51961 ns/op 0.86
phase0 beforeProcessEpoch - 250000 vs - 7PWei 16.529 ms/op 31.042 ms/op 0.53
altair processEpoch - mainnet_e81889 274.22 ms/op 333.11 ms/op 0.82
mainnet_e81889 - altair beforeProcessEpoch 20.192 ms/op 24.708 ms/op 0.82
mainnet_e81889 - altair processJustificationAndFinalization 5.4100 us/op 8.4110 us/op 0.64
mainnet_e81889 - altair processInactivityUpdates 5.1633 ms/op 8.7842 ms/op 0.59
mainnet_e81889 - altair processRewardsAndPenalties 44.295 ms/op 46.816 ms/op 0.95
mainnet_e81889 - altair processRegistryUpdates 729.00 ns/op 805.00 ns/op 0.91
mainnet_e81889 - altair processSlashings 183.00 ns/op 208.00 ns/op 0.88
mainnet_e81889 - altair processEth1DataReset 177.00 ns/op 194.00 ns/op 0.91
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.2604 ms/op 1.5627 ms/op 0.81
mainnet_e81889 - altair processSlashingsReset 896.00 ns/op 1.3110 us/op 0.68
mainnet_e81889 - altair processRandaoMixesReset 1.1550 us/op 1.5350 us/op 0.75
mainnet_e81889 - altair processHistoricalRootsUpdate 182.00 ns/op 197.00 ns/op 0.92
mainnet_e81889 - altair processParticipationFlagUpdates 528.00 ns/op 613.00 ns/op 0.86
mainnet_e81889 - altair processSyncCommitteeUpdates 141.00 ns/op 155.00 ns/op 0.91
mainnet_e81889 - altair afterProcessEpoch 53.705 ms/op 59.224 ms/op 0.91
capella processEpoch - mainnet_e217614 961.98 ms/op 967.41 ms/op 0.99
mainnet_e217614 - capella beforeProcessEpoch 69.203 ms/op 73.958 ms/op 0.94
mainnet_e217614 - capella processJustificationAndFinalization 6.8840 us/op 5.6890 us/op 1.21
mainnet_e217614 - capella processInactivityUpdates 16.979 ms/op 17.388 ms/op 0.98
mainnet_e217614 - capella processRewardsAndPenalties 192.28 ms/op 189.17 ms/op 1.02
mainnet_e217614 - capella processRegistryUpdates 10.195 us/op 6.8250 us/op 1.49
mainnet_e217614 - capella processSlashings 251.00 ns/op 179.00 ns/op 1.40
mainnet_e217614 - capella processEth1DataReset 380.00 ns/op 175.00 ns/op 2.17
mainnet_e217614 - capella processEffectiveBalanceUpdates 18.414 ms/op 14.071 ms/op 1.31
mainnet_e217614 - capella processSlashingsReset 1.1860 us/op 884.00 ns/op 1.34
mainnet_e217614 - capella processRandaoMixesReset 1.8760 us/op 1.1590 us/op 1.62
mainnet_e217614 - capella processHistoricalRootsUpdate 371.00 ns/op 179.00 ns/op 2.07
mainnet_e217614 - capella processParticipationFlagUpdates 1.0190 us/op 540.00 ns/op 1.89
mainnet_e217614 - capella afterProcessEpoch 138.14 ms/op 138.33 ms/op 1.00
phase0 processEpoch - mainnet_e58758 452.36 ms/op 436.59 ms/op 1.04
mainnet_e58758 - phase0 beforeProcessEpoch 116.60 ms/op 120.33 ms/op 0.97
mainnet_e58758 - phase0 processJustificationAndFinalization 8.8150 us/op 6.7380 us/op 1.31
mainnet_e58758 - phase0 processRewardsAndPenalties 47.852 ms/op 43.118 ms/op 1.11
mainnet_e58758 - phase0 processRegistryUpdates 3.5510 us/op 5.2160 us/op 0.68
mainnet_e58758 - phase0 processSlashings 265.00 ns/op 243.00 ns/op 1.09
mainnet_e58758 - phase0 processEth1DataReset 191.00 ns/op 189.00 ns/op 1.01
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 4.2164 ms/op 1.1058 ms/op 3.81
mainnet_e58758 - phase0 processSlashingsReset 1.2650 us/op 1.1980 us/op 1.06
mainnet_e58758 - phase0 processRandaoMixesReset 1.2670 us/op 1.7280 us/op 0.73
mainnet_e58758 - phase0 processHistoricalRootsUpdate 253.00 ns/op 192.00 ns/op 1.32
mainnet_e58758 - phase0 processParticipationRecordUpdates 1.0030 us/op 1.0210 us/op 0.98
mainnet_e58758 - phase0 afterProcessEpoch 45.707 ms/op 44.489 ms/op 1.03
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.9361 ms/op 1.3982 ms/op 1.38
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.9349 ms/op 1.9690 ms/op 0.98
altair processInactivityUpdates - 250000 normalcase 23.640 ms/op 18.280 ms/op 1.29
altair processInactivityUpdates - 250000 worstcase 25.943 ms/op 19.854 ms/op 1.31
phase0 processRegistryUpdates - 250000 normalcase 13.085 us/op 5.5600 us/op 2.35
phase0 processRegistryUpdates - 250000 badcase_full_deposits 331.70 us/op 265.09 us/op 1.25
phase0 processRegistryUpdates - 250000 worstcase 0.5 165.94 ms/op 109.37 ms/op 1.52
altair processRewardsAndPenalties - 250000 normalcase 63.012 ms/op 40.480 ms/op 1.56
altair processRewardsAndPenalties - 250000 worstcase 62.917 ms/op 29.377 ms/op 2.14
phase0 getAttestationDeltas - 250000 normalcase 19.327 ms/op 7.9058 ms/op 2.44
phase0 getAttestationDeltas - 250000 worstcase 22.055 ms/op 13.437 ms/op 1.64
phase0 processSlashings - 250000 worstcase 157.31 us/op 88.492 us/op 1.78
altair processSyncCommitteeUpdates - 250000 178.44 ms/op 119.47 ms/op 1.49
BeaconState.hashTreeRoot - No change 307.00 ns/op 220.00 ns/op 1.40
BeaconState.hashTreeRoot - 1 full validator 111.30 us/op 79.148 us/op 1.41
BeaconState.hashTreeRoot - 32 full validator 1.9505 ms/op 790.76 us/op 2.47
BeaconState.hashTreeRoot - 512 full validator 17.316 ms/op 9.0584 ms/op 1.91
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 153.01 us/op 92.807 us/op 1.65
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 3.1523 ms/op 1.5508 ms/op 2.03
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 44.604 ms/op 19.927 ms/op 2.24
BeaconState.hashTreeRoot - 1 balances 117.15 us/op 76.346 us/op 1.53
BeaconState.hashTreeRoot - 32 balances 1.6589 ms/op 682.76 us/op 2.43
BeaconState.hashTreeRoot - 512 balances 13.124 ms/op 7.5840 ms/op 1.73
BeaconState.hashTreeRoot - 250000 balances 228.75 ms/op 146.56 ms/op 1.56
aggregationBits - 2048 els - zipIndexesInBitList 37.040 us/op 22.973 us/op 1.61
byteArrayEquals 32 61.419 ns/op 57.439 ns/op 1.07
Buffer.compare 32 20.327 ns/op 19.132 ns/op 1.06
byteArrayEquals 1024 1.8101 us/op 1.7017 us/op 1.06
Buffer.compare 1024 36.483 ns/op 28.678 ns/op 1.27
byteArrayEquals 16384 28.844 us/op 27.043 us/op 1.07
Buffer.compare 16384 204.80 ns/op 214.18 ns/op 0.96
byteArrayEquals 123687377 245.13 ms/op 198.51 ms/op 1.23
Buffer.compare 123687377 16.667 ms/op 6.9537 ms/op 2.40
byteArrayEquals 32 - diff last byte 70.088 ns/op 55.274 ns/op 1.27
Buffer.compare 32 - diff last byte 20.239 ns/op 17.534 ns/op 1.15
byteArrayEquals 1024 - diff last byte 1.8027 us/op 1.5890 us/op 1.13
Buffer.compare 1024 - diff last byte 28.948 ns/op 25.920 ns/op 1.12
byteArrayEquals 16384 - diff last byte 29.065 us/op 26.234 us/op 1.11
Buffer.compare 16384 - diff last byte 251.25 ns/op 211.43 ns/op 1.19
byteArrayEquals 123687377 - diff last byte 257.14 ms/op 204.45 ms/op 1.26
Buffer.compare 123687377 - diff last byte 17.763 ms/op 7.8507 ms/op 2.26
byteArrayEquals 32 - random bytes 6.8290 ns/op 5.4290 ns/op 1.26
Buffer.compare 32 - random bytes 25.754 ns/op 18.595 ns/op 1.38
byteArrayEquals 1024 - random bytes 7.8170 ns/op 5.3920 ns/op 1.45
Buffer.compare 1024 - random bytes 20.695 ns/op 18.833 ns/op 1.10
byteArrayEquals 16384 - random bytes 8.2130 ns/op 5.5100 ns/op 1.49
Buffer.compare 16384 - random bytes 37.719 ns/op 18.746 ns/op 2.01
byteArrayEquals 123687377 - random bytes 13.660 ns/op 8.1300 ns/op 1.68
Buffer.compare 123687377 - random bytes 40.950 ns/op 19.070 ns/op 2.15
regular array get 100000 times 57.722 us/op 34.496 us/op 1.67
wrappedArray get 100000 times 51.356 us/op 34.341 us/op 1.50
arrayWithProxy get 100000 times 17.608 ms/op 14.886 ms/op 1.18
ssz.Root.equals 89.902 ns/op 49.461 ns/op 1.82
byteArrayEquals 91.874 ns/op 48.562 ns/op 1.89
Buffer.compare 12.379 ns/op 11.347 ns/op 1.09
processSlot - 1 slots 22.400 us/op 10.618 us/op 2.11
processSlot - 32 slots 6.1817 ms/op 2.1083 ms/op 2.93
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 85.685 ms/op 56.181 ms/op 1.53
getCommitteeAssignments - req 1 vs - 250000 vc 2.8001 ms/op 2.2586 ms/op 1.24
getCommitteeAssignments - req 100 vs - 250000 vc 4.9223 ms/op 4.5254 ms/op 1.09
getCommitteeAssignments - req 1000 vs - 250000 vc 4.9197 ms/op 4.8567 ms/op 1.01
findModifiedValidators - 10000 modified validators 1.1018 s/op 830.14 ms/op 1.33
findModifiedValidators - 1000 modified validators 748.80 ms/op 831.69 ms/op 0.90
findModifiedValidators - 100 modified validators 365.05 ms/op 289.68 ms/op 1.26
findModifiedValidators - 10 modified validators 373.26 ms/op 184.55 ms/op 2.02
findModifiedValidators - 1 modified validators 235.18 ms/op 293.87 ms/op 0.80
findModifiedValidators - no difference 326.10 ms/op 176.80 ms/op 1.84
compare ViewDUs 10.316 s/op 7.5312 s/op 1.37
compare each validator Uint8Array 2.3548 s/op 1.9129 s/op 1.23
compare ViewDU to Uint8Array 2.2681 s/op 1.5658 s/op 1.45
migrate state 1000000 validators, 24 modified, 0 new 1.3266 s/op 950.70 ms/op 1.40
migrate state 1000000 validators, 1700 modified, 1000 new 1.7467 s/op 1.2061 s/op 1.45
migrate state 1000000 validators, 3400 modified, 2000 new 2.0622 s/op 1.5815 s/op 1.30
migrate state 1500000 validators, 24 modified, 0 new 1.4783 s/op 1.1940 s/op 1.24
migrate state 1500000 validators, 1700 modified, 1000 new 1.4376 s/op 1.4832 s/op 0.97
migrate state 1500000 validators, 3400 modified, 2000 new 1.7329 s/op 1.6042 s/op 1.08
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 6.4400 ns/op 4.9300 ns/op 1.31
state getBlockRootAtSlot - 250000 vs - 7PWei 882.75 ns/op 590.92 ns/op 1.49
naive computeProposerIndex 100000 validators 67.904 ms/op 60.222 ms/op 1.13
computeProposerIndex 100000 validators 11.306 ms/op 10.516 ms/op 1.08
naiveGetNextSyncCommitteeIndices 1000 validators 9.8193 s/op 8.3008 s/op 1.18
getNextSyncCommitteeIndices 1000 validators 517.37 ms/op 335.60 ms/op 1.54
naiveGetNextSyncCommitteeIndices 10000 validators 9.5695 s/op 9.1576 s/op 1.04
getNextSyncCommitteeIndices 10000 validators 317.17 ms/op 292.91 ms/op 1.08
naiveGetNextSyncCommitteeIndices 100000 validators 9.0468 s/op 8.2386 s/op 1.10
getNextSyncCommitteeIndices 100000 validators 460.72 ms/op 255.72 ms/op 1.80
naive computeShuffledIndex 100000 validators 28.494 s/op 26.054 s/op 1.09
cached computeShuffledIndex 100000 validators 650.78 ms/op 578.25 ms/op 1.13
naive computeShuffledIndex 2000000 validators 460.56 s/op 549.02 s/op 0.84
cached computeShuffledIndex 2000000 validators 37.758 s/op 37.775 s/op 1.00
computeProposers - vc 250000 9.4319 ms/op 10.473 ms/op 0.90
computeEpochShuffling - vc 250000 42.487 ms/op 43.911 ms/op 0.97
getNextSyncCommittee - vc 250000 138.08 ms/op 232.97 ms/op 0.59
computeSigningRoot for AttestationData 20.686 us/op 31.384 us/op 0.66
hash AttestationData serialized data then Buffer.toString(base64) 1.5540 us/op 1.7253 us/op 0.90
toHexString serialized data 1.1075 us/op 1.4976 us/op 0.74
Buffer.toString(base64) 153.94 ns/op 180.37 ns/op 0.85
nodejs block root to RootHex using toHex 145.12 ns/op 162.66 ns/op 0.89
nodejs block root to RootHex using toRootHex 82.827 ns/op 92.073 ns/op 0.90
browser block root to RootHex using the deprecated toHexString 210.03 ns/op 251.98 ns/op 0.83
browser block root to RootHex using toHex 175.71 ns/op 185.59 ns/op 0.95
browser block root to RootHex using toRootHex 157.51 ns/op 175.05 ns/op 0.90

by benchmarkbot/action

@nazarhussain nazarhussain marked this pull request as ready for review March 6, 2025 18:03
Copy link

codecov bot commented Mar 7, 2025

Codecov Report

Attention: Patch coverage is 31.34328% with 46 lines in your changes missing coverage. Please review.

Project coverage is 50.15%. Comparing base (d60218e) to head (5310066).

Additional details and impacted files
@@            Coverage Diff            @@
##           unstable    #7533   +/-   ##
=========================================
  Coverage     50.14%   50.15%           
=========================================
  Files           603      603           
  Lines         40454    40442   -12     
  Branches       2226     2227    +1     
=========================================
- Hits          20285    20282    -3     
+ Misses        20129    20118   -11     
- Partials         40       42    +2     
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -272,7 +272,7 @@ export function getBeaconPoolApi({
chain.syncCommitteeMessagePool.add(subnet, signature, indexInSubcommittee);

// Cheap de-duplication code to avoid using a Set. indexesInCommittee is always sorted
if (subnets.length === 0 || subnets[subnets.length - 1] !== subnet) {
if (subnets.length === 0 || subnets.at(-1) !== subnet) {
Copy link
Member

Choose a reason for hiding this comment

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

so -1 seems to be last item in the array, this is very confusing syntax

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 negative indexes are treated backwards. Which is also consistently used in other JS functions. e.g. arr.slice(-2); returns last two items.

Copy link
Member

@nflaig nflaig Mar 7, 2025

Choose a reason for hiding this comment

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

arr.slice(-2); returns last two items.

yeah I know, somehow it makes more sense to me there, it's probably just a matter of getting used to it, if that's what needed to make array access more type safe I am all for it

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 .at give type-safety compared to index access of the array. In case of under index or over index access the array returns undefined but the type for index access is always without undefined. Which is resolved with .at, so you must check if what you accessed is available or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But that also need a careful review because if(!arr.at(-1)) such usages may fail if last value exists but is some falsy.

@nazarhussain nazarhussain requested a review from nflaig March 7, 2025 09:31
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.

generally lgtm

Copy link
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

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

seems fine to me, however we might wanna hold off merging stuff to unstable for now which is not critical to have in the next release.... just to make our lives easier in case there is a regression somewhere

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.

3 participants