Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: separate lodestar utils to node and browser #7039

Closed
wants to merge 14 commits into from

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Aug 20, 2024

Motivation

Description

  • Separate @lodestar/utils to @lodestar/utils/node for node and @lodestar/utils/browser for browser
    • still can use @lodestar/utils for common apis
  • Update import paths of consumers

a prerequisite for #7036

cc @nflaig

Copy link

codecov bot commented Aug 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.12%. Comparing base (6f470f8) to head (8acdbbf).
Report is 80 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #7039      +/-   ##
============================================
- Coverage     49.25%   49.12%   -0.13%     
============================================
  Files           578      577       -1     
  Lines         37443    37333     -110     
  Branches       2172     2159      -13     
============================================
- Hits          18441    18339     -102     
+ Misses        18962    18954       -8     
  Partials         40       40              

Copy link
Contributor

Performance Report

✔️ no performance regression detected

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 20312ec Previous: 4ea7edd Ratio
Object set x1000 23.475 ns/op 74.306 ns/op 0.32
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 191.69 us/op 658.98 us/op 0.29
prioritizePeers score 0:0 att 64-1 sync 4-1 407.92 us/op 1.2916 ms/op 0.32
bitArray.getTrueBitIndexes() bitLen 248 2.0300 us/op 7.2390 us/op 0.28
bitArray.getTrueBitIndexes() bitLen 512 3.7570 us/op 13.361 us/op 0.28
Full benchmark results
Benchmark suite Current: 20312ec Previous: 4ea7edd Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.7904 ms/op 2.6055 ms/op 0.69
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 41.909 us/op 80.209 us/op 0.52
BLS verify - blst 901.46 us/op 1.1234 ms/op 0.80
BLS verifyMultipleSignatures 3 - blst 1.4071 ms/op 1.7285 ms/op 0.81
BLS verifyMultipleSignatures 8 - blst 1.9710 ms/op 2.4733 ms/op 0.80
BLS verifyMultipleSignatures 32 - blst 4.4097 ms/op 7.4787 ms/op 0.59
BLS verifyMultipleSignatures 64 - blst 8.2945 ms/op 12.507 ms/op 0.66
BLS verifyMultipleSignatures 128 - blst 15.978 ms/op 21.076 ms/op 0.76
BLS deserializing 10000 signatures 608.00 ms/op 792.81 ms/op 0.77
BLS deserializing 100000 signatures 6.2001 s/op 7.8729 s/op 0.79
BLS verifyMultipleSignatures - same message - 3 - blst 898.18 us/op 1.1819 ms/op 0.76
BLS verifyMultipleSignatures - same message - 8 - blst 1.0696 ms/op 1.3040 ms/op 0.82
BLS verifyMultipleSignatures - same message - 32 - blst 1.7019 ms/op 2.0659 ms/op 0.82
BLS verifyMultipleSignatures - same message - 64 - blst 2.4878 ms/op 3.1542 ms/op 0.79
BLS verifyMultipleSignatures - same message - 128 - blst 4.1922 ms/op 5.0196 ms/op 0.84
BLS aggregatePubkeys 32 - blst 18.013 us/op 22.129 us/op 0.81
BLS aggregatePubkeys 128 - blst 63.576 us/op 80.153 us/op 0.79
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 55.998 ms/op 102.57 ms/op 0.55
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 55.801 ms/op 75.357 ms/op 0.74
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 29.413 ms/op 47.173 ms/op 0.62
getSlashingsAndExits - default max 69.748 us/op 143.79 us/op 0.49
getSlashingsAndExits - 2k 333.06 us/op 382.02 us/op 0.87
proposeBlockBody type=full, size=empty 5.0585 ms/op 7.1536 ms/op 0.71
isKnown best case - 1 super set check 598.00 ns/op 652.00 ns/op 0.92
isKnown normal case - 2 super set checks 572.00 ns/op 672.00 ns/op 0.85
isKnown worse case - 16 super set checks 529.00 ns/op 660.00 ns/op 0.80
InMemoryCheckpointStateCache - add get delete 2.6070 us/op 3.9210 us/op 0.66
validate api signedAggregateAndProof - struct 1.8060 ms/op 1.9821 ms/op 0.91
validate gossip signedAggregateAndProof - struct 1.5753 ms/op 1.9275 ms/op 0.82
validate gossip attestation - vc 640000 979.01 us/op 1.2416 ms/op 0.79
batch validate gossip attestation - vc 640000 - chunk 32 122.56 us/op 161.92 us/op 0.76
batch validate gossip attestation - vc 640000 - chunk 64 108.37 us/op 143.08 us/op 0.76
batch validate gossip attestation - vc 640000 - chunk 128 100.21 us/op 145.04 us/op 0.69
batch validate gossip attestation - vc 640000 - chunk 256 96.522 us/op 151.30 us/op 0.64
pickEth1Vote - no votes 843.60 us/op 1.5792 ms/op 0.53
pickEth1Vote - max votes 4.7580 ms/op 12.616 ms/op 0.38
pickEth1Vote - Eth1Data hashTreeRoot value x2048 13.039 ms/op 19.847 ms/op 0.66
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 17.843 ms/op 32.458 ms/op 0.55
pickEth1Vote - Eth1Data fastSerialize value x2048 362.85 us/op 700.45 us/op 0.52
pickEth1Vote - Eth1Data fastSerialize tree x2048 2.7494 ms/op 4.3902 ms/op 0.63
bytes32 toHexString 626.00 ns/op 909.00 ns/op 0.69
bytes32 Buffer.toString(hex) 484.00 ns/op 318.00 ns/op 1.52
bytes32 Buffer.toString(hex) from Uint8Array 663.00 ns/op 592.00 ns/op 1.12
bytes32 Buffer.toString(hex) + 0x 465.00 ns/op 336.00 ns/op 1.38
Object access 1 prop 0.36000 ns/op 0.23100 ns/op 1.56
Map access 1 prop 0.33700 ns/op 0.20200 ns/op 1.67
Object get x1000 5.2410 ns/op 8.0370 ns/op 0.65
Map get x1000 5.8840 ns/op 9.1740 ns/op 0.64
Object set x1000 23.475 ns/op 74.306 ns/op 0.32
Map set x1000 19.694 ns/op 52.721 ns/op 0.37
Return object 10000 times 0.30830 ns/op 0.36870 ns/op 0.84
Throw Error 10000 times 2.8101 us/op 4.3599 us/op 0.64
toHex 112.53 ns/op 224.30 ns/op 0.50
Buffer.from 101.49 ns/op 222.01 ns/op 0.46
shared Buffer 71.247 ns/op 121.41 ns/op 0.59
fastMsgIdFn sha256 / 200 bytes 2.1580 us/op 2.8420 us/op 0.76
fastMsgIdFn h32 xxhash / 200 bytes 482.00 ns/op 365.00 ns/op 1.32
fastMsgIdFn h64 xxhash / 200 bytes 484.00 ns/op 338.00 ns/op 1.43
fastMsgIdFn sha256 / 1000 bytes 6.1050 us/op 9.3670 us/op 0.65
fastMsgIdFn h32 xxhash / 1000 bytes 608.00 ns/op 561.00 ns/op 1.08
fastMsgIdFn h64 xxhash / 1000 bytes 554.00 ns/op 550.00 ns/op 1.01
fastMsgIdFn sha256 / 10000 bytes 50.205 us/op 93.243 us/op 0.54
fastMsgIdFn h32 xxhash / 10000 bytes 2.0200 us/op 3.0740 us/op 0.66
fastMsgIdFn h64 xxhash / 10000 bytes 1.3850 us/op 1.7500 us/op 0.79
send data - 1000 256B messages 11.870 ms/op 22.575 ms/op 0.53
send data - 1000 512B messages 16.597 ms/op 26.438 ms/op 0.63
send data - 1000 1024B messages 22.321 ms/op 36.652 ms/op 0.61
send data - 1000 1200B messages 26.951 ms/op 45.039 ms/op 0.60
send data - 1000 2048B messages 33.014 ms/op 54.344 ms/op 0.61
send data - 1000 4096B messages 30.743 ms/op 51.949 ms/op 0.59
send data - 1000 16384B messages 75.591 ms/op 137.14 ms/op 0.55
send data - 1000 65536B messages 268.93 ms/op 273.17 ms/op 0.98
enrSubnets - fastDeserialize 64 bits 1.4760 us/op 1.7130 us/op 0.86
enrSubnets - ssz BitVector 64 bits 612.00 ns/op 550.00 ns/op 1.11
enrSubnets - fastDeserialize 4 bits 390.00 ns/op 251.00 ns/op 1.55
enrSubnets - ssz BitVector 4 bits 645.00 ns/op 600.00 ns/op 1.07
prioritizePeers score -10:0 att 32-0.1 sync 2-0 120.72 us/op 230.61 us/op 0.52
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 133.91 us/op 262.09 us/op 0.51
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 191.69 us/op 658.98 us/op 0.29
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 333.38 us/op 693.32 us/op 0.48
prioritizePeers score 0:0 att 64-1 sync 4-1 407.92 us/op 1.2916 ms/op 0.32
array of 16000 items push then shift 1.2436 us/op 2.2201 us/op 0.56
LinkedList of 16000 items push then shift 7.0810 ns/op 14.804 ns/op 0.48
array of 16000 items push then pop 77.481 ns/op 222.07 ns/op 0.35
LinkedList of 16000 items push then pop 6.4510 ns/op 12.847 ns/op 0.50
array of 24000 items push then shift 1.9134 us/op 3.5852 us/op 0.53
LinkedList of 24000 items push then shift 6.8480 ns/op 14.791 ns/op 0.46
array of 24000 items push then pop 106.42 ns/op 298.84 ns/op 0.36
LinkedList of 24000 items push then pop 6.3910 ns/op 13.118 ns/op 0.49
intersect bitArray bitLen 8 5.5240 ns/op 10.865 ns/op 0.51
intersect array and set length 8 38.539 ns/op 110.78 ns/op 0.35
intersect bitArray bitLen 128 27.446 ns/op 42.524 ns/op 0.65
intersect array and set length 128 583.43 ns/op 1.4796 us/op 0.39
bitArray.getTrueBitIndexes() bitLen 128 1.3190 us/op 3.6980 us/op 0.36
bitArray.getTrueBitIndexes() bitLen 248 2.0300 us/op 7.2390 us/op 0.28
bitArray.getTrueBitIndexes() bitLen 512 3.7570 us/op 13.361 us/op 0.28
Buffer.concat 32 items 988.00 ns/op 1.6800 us/op 0.59
Uint8Array.set 32 items 1.2620 us/op 2.4630 us/op 0.51
Buffer.copy 1.3800 us/op 2.3540 us/op 0.59
Uint8Array.set - with subarray 1.8250 us/op 3.8280 us/op 0.48
Uint8Array.set - without subarray 1.2220 us/op 2.1610 us/op 0.57
getUint32 - dataview 412.00 ns/op 337.00 ns/op 1.22
getUint32 - manual 339.00 ns/op 298.00 ns/op 1.14
Set add up to 64 items then delete first 1.7997 us/op 3.4253 us/op 0.53
OrderedSet add up to 64 items then delete first 2.7972 us/op 4.9565 us/op 0.56
Set add up to 64 items then delete last 2.0562 us/op 3.6756 us/op 0.56
OrderedSet add up to 64 items then delete last 3.1798 us/op 6.1651 us/op 0.52
Set add up to 64 items then delete middle 2.0415 us/op 3.7004 us/op 0.55
OrderedSet add up to 64 items then delete middle 4.5654 us/op 7.2982 us/op 0.63
Set add up to 128 items then delete first 4.0698 us/op 6.4096 us/op 0.63
OrderedSet add up to 128 items then delete first 5.9372 us/op 10.673 us/op 0.56
Set add up to 128 items then delete last 3.9338 us/op 7.0393 us/op 0.56
OrderedSet add up to 128 items then delete last 6.1069 us/op 10.605 us/op 0.58
Set add up to 128 items then delete middle 3.9191 us/op 6.8816 us/op 0.57
OrderedSet add up to 128 items then delete middle 11.643 us/op 17.925 us/op 0.65
Set add up to 256 items then delete first 7.7508 us/op 14.073 us/op 0.55
OrderedSet add up to 256 items then delete first 11.916 us/op 21.095 us/op 0.56
Set add up to 256 items then delete last 7.8766 us/op 13.986 us/op 0.56
OrderedSet add up to 256 items then delete last 12.577 us/op 21.995 us/op 0.57
Set add up to 256 items then delete middle 7.8747 us/op 13.388 us/op 0.59
OrderedSet add up to 256 items then delete middle 39.874 us/op 48.485 us/op 0.82
transfer serialized Status (84 B) 1.4290 us/op 1.5680 us/op 0.91
copy serialized Status (84 B) 1.3280 us/op 1.4160 us/op 0.94
transfer serialized SignedVoluntaryExit (112 B) 1.5210 us/op 1.6670 us/op 0.91
copy serialized SignedVoluntaryExit (112 B) 1.3540 us/op 1.4610 us/op 0.93
transfer serialized ProposerSlashing (416 B) 1.6690 us/op 2.6000 us/op 0.64
copy serialized ProposerSlashing (416 B) 1.8140 us/op 2.0190 us/op 0.90
transfer serialized Attestation (485 B) 1.6520 us/op 2.1290 us/op 0.78
copy serialized Attestation (485 B) 1.5930 us/op 1.9710 us/op 0.81
transfer serialized AttesterSlashing (33232 B) 1.7870 us/op 2.2040 us/op 0.81
copy serialized AttesterSlashing (33232 B) 4.0800 us/op 7.9320 us/op 0.51
transfer serialized Small SignedBeaconBlock (128000 B) 2.0830 us/op 2.6260 us/op 0.79
copy serialized Small SignedBeaconBlock (128000 B) 9.5780 us/op 27.324 us/op 0.35
transfer serialized Avg SignedBeaconBlock (200000 B) 2.3830 us/op 3.4160 us/op 0.70
copy serialized Avg SignedBeaconBlock (200000 B) 12.842 us/op 34.377 us/op 0.37
transfer serialized BlobsSidecar (524380 B) 2.7600 us/op 4.4150 us/op 0.63
copy serialized BlobsSidecar (524380 B) 72.014 us/op 101.64 us/op 0.71
transfer serialized Big SignedBeaconBlock (1000000 B) 2.9550 us/op 4.5380 us/op 0.65
copy serialized Big SignedBeaconBlock (1000000 B) 146.68 us/op 423.22 us/op 0.35
pass gossip attestations to forkchoice per slot 2.5195 ms/op 3.2007 ms/op 0.79
forkChoice updateHead vc 100000 bc 64 eq 0 436.14 us/op 568.20 us/op 0.77
forkChoice updateHead vc 600000 bc 64 eq 0 2.7298 ms/op 3.8148 ms/op 0.72
forkChoice updateHead vc 1000000 bc 64 eq 0 4.1614 ms/op 6.2877 ms/op 0.66
forkChoice updateHead vc 600000 bc 320 eq 0 2.4778 ms/op 3.4152 ms/op 0.73
forkChoice updateHead vc 600000 bc 1200 eq 0 2.4913 ms/op 3.3435 ms/op 0.75
forkChoice updateHead vc 600000 bc 7200 eq 0 3.0594 ms/op 4.4148 ms/op 0.69
forkChoice updateHead vc 600000 bc 64 eq 1000 9.7757 ms/op 11.242 ms/op 0.87
forkChoice updateHead vc 600000 bc 64 eq 10000 9.5191 ms/op 11.358 ms/op 0.84
forkChoice updateHead vc 600000 bc 64 eq 300000 11.871 ms/op 18.408 ms/op 0.64
computeDeltas 500000 validators 300 proto nodes 2.9619 ms/op 3.9587 ms/op 0.75
computeDeltas 500000 validators 1200 proto nodes 2.8447 ms/op 3.7921 ms/op 0.75
computeDeltas 500000 validators 7200 proto nodes 2.8723 ms/op 3.7887 ms/op 0.76
computeDeltas 750000 validators 300 proto nodes 4.3041 ms/op 5.7003 ms/op 0.76
computeDeltas 750000 validators 1200 proto nodes 4.2584 ms/op 5.9040 ms/op 0.72
computeDeltas 750000 validators 7200 proto nodes 4.3649 ms/op 6.0759 ms/op 0.72
computeDeltas 1400000 validators 300 proto nodes 8.2191 ms/op 11.369 ms/op 0.72
computeDeltas 1400000 validators 1200 proto nodes 8.2284 ms/op 11.064 ms/op 0.74
computeDeltas 1400000 validators 7200 proto nodes 8.2493 ms/op 10.665 ms/op 0.77
computeDeltas 2100000 validators 300 proto nodes 12.435 ms/op 16.616 ms/op 0.75
computeDeltas 2100000 validators 1200 proto nodes 13.002 ms/op 15.888 ms/op 0.82
computeDeltas 2100000 validators 7200 proto nodes 12.621 ms/op 15.760 ms/op 0.80
altair processAttestation - 250000 vs - 7PWei normalcase 1.5833 ms/op 1.7091 ms/op 0.93
altair processAttestation - 250000 vs - 7PWei worstcase 2.4048 ms/op 2.9195 ms/op 0.82
altair processAttestation - setStatus - 1/6 committees join 92.177 us/op 104.19 us/op 0.88
altair processAttestation - setStatus - 1/3 committees join 173.72 us/op 196.59 us/op 0.88
altair processAttestation - setStatus - 1/2 committees join 293.12 us/op 268.26 us/op 1.09
altair processAttestation - setStatus - 2/3 committees join 346.18 us/op 317.03 us/op 1.09
altair processAttestation - setStatus - 4/5 committees join 482.13 us/op 469.49 us/op 1.03
altair processAttestation - setStatus - 100% committees join 578.70 us/op 549.65 us/op 1.05
altair processBlock - 250000 vs - 7PWei normalcase 3.8387 ms/op 6.0797 ms/op 0.63
altair processBlock - 250000 vs - 7PWei normalcase hashState 25.748 ms/op 26.221 ms/op 0.98
altair processBlock - 250000 vs - 7PWei worstcase 35.417 ms/op 38.021 ms/op 0.93
altair processBlock - 250000 vs - 7PWei worstcase hashState 68.791 ms/op 77.832 ms/op 0.88
phase0 processBlock - 250000 vs - 7PWei normalcase 1.4560 ms/op 2.3454 ms/op 0.62
phase0 processBlock - 250000 vs - 7PWei worstcase 26.392 ms/op 24.904 ms/op 1.06
altair processEth1Data - 250000 vs - 7PWei normalcase 259.59 us/op 314.01 us/op 0.83
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 5.3990 us/op 6.1110 us/op 0.88
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 19.142 us/op 24.503 us/op 0.78
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 7.3530 us/op 7.0420 us/op 1.04
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 6.8560 us/op 5.8360 us/op 1.17
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 78.649 us/op 101.92 us/op 0.77
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 745.51 us/op 1.0995 ms/op 0.68
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 652.36 us/op 1.7069 ms/op 0.38
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.0197 ms/op 1.5301 ms/op 0.67
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 1.8886 ms/op 2.5898 ms/op 0.73
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.0986 ms/op 1.8075 ms/op 0.61
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 2.7921 ms/op 3.8817 ms/op 0.72
Tree 40 250000 create 189.26 ms/op 229.83 ms/op 0.82
Tree 40 250000 get(125000) 114.92 ns/op 151.30 ns/op 0.76
Tree 40 250000 set(125000) 599.98 ns/op 733.96 ns/op 0.82
Tree 40 250000 toArray() 9.5019 ms/op 18.387 ms/op 0.52
Tree 40 250000 iterate all - toArray() + loop 9.6032 ms/op 23.077 ms/op 0.42
Tree 40 250000 iterate all - get(i) 43.635 ms/op 55.242 ms/op 0.79
MutableVector 250000 create 6.8975 ms/op 11.259 ms/op 0.61
MutableVector 250000 get(125000) 5.9580 ns/op 6.3360 ns/op 0.94
MutableVector 250000 set(125000) 176.37 ns/op 193.34 ns/op 0.91
MutableVector 250000 toArray() 2.5761 ms/op 3.7833 ms/op 0.68
MutableVector 250000 iterate all - toArray() + loop 2.8138 ms/op 3.6151 ms/op 0.78
MutableVector 250000 iterate all - get(i) 1.4328 ms/op 1.6807 ms/op 0.85
Array 250000 create 2.3437 ms/op 3.4317 ms/op 0.68
Array 250000 clone - spread 1.2575 ms/op 1.4500 ms/op 0.87
Array 250000 get(125000) 0.58200 ns/op 0.42100 ns/op 1.38
Array 250000 set(125000) 0.60100 ns/op 0.44100 ns/op 1.36
Array 250000 iterate all - loop 77.548 us/op 93.124 us/op 0.83
effectiveBalanceIncrements clone Uint8Array 300000 14.252 us/op 31.535 us/op 0.45
effectiveBalanceIncrements clone MutableVector 300000 318.00 ns/op 128.00 ns/op 2.48
effectiveBalanceIncrements rw all Uint8Array 300000 167.95 us/op 198.29 us/op 0.85
effectiveBalanceIncrements rw all MutableVector 300000 57.134 ms/op 69.274 ms/op 0.82
phase0 afterProcessEpoch - 250000 vs - 7PWei 75.748 ms/op 89.871 ms/op 0.84
Array.fill - length 1000000 2.5998 ms/op 3.5923 ms/op 0.72
Array push - length 1000000 13.991 ms/op 17.200 ms/op 0.81
Array.get 0.25542 ns/op 0.29002 ns/op 0.88
Uint8Array.get 0.34093 ns/op 0.44924 ns/op 0.76
phase0 beforeProcessEpoch - 250000 vs - 7PWei 13.062 ms/op 17.872 ms/op 0.73
altair processEpoch - mainnet_e81889 253.02 ms/op 346.12 ms/op 0.73
mainnet_e81889 - altair beforeProcessEpoch 15.202 ms/op 17.186 ms/op 0.88
mainnet_e81889 - altair processJustificationAndFinalization 9.5220 us/op 18.523 us/op 0.51
mainnet_e81889 - altair processInactivityUpdates 4.0584 ms/op 4.9391 ms/op 0.82
mainnet_e81889 - altair processRewardsAndPenalties 57.707 ms/op 60.481 ms/op 0.95
mainnet_e81889 - altair processRegistryUpdates 1.8470 us/op 2.7600 us/op 0.67
mainnet_e81889 - altair processSlashings 716.00 ns/op 563.00 ns/op 1.27
mainnet_e81889 - altair processEth1DataReset 401.00 ns/op 546.00 ns/op 0.73
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.2306 ms/op 3.2122 ms/op 0.69
mainnet_e81889 - altair processSlashingsReset 2.2940 us/op 3.8050 us/op 0.60
mainnet_e81889 - altair processRandaoMixesReset 2.8550 us/op 9.0650 us/op 0.31
mainnet_e81889 - altair processHistoricalRootsUpdate 769.00 ns/op 808.00 ns/op 0.95
mainnet_e81889 - altair processParticipationFlagUpdates 2.5510 us/op 3.2050 us/op 0.80
mainnet_e81889 - altair processSyncCommitteeUpdates 767.00 ns/op 465.00 ns/op 1.65
mainnet_e81889 - altair afterProcessEpoch 79.495 ms/op 94.000 ms/op 0.85
capella processEpoch - mainnet_e217614 1.0807 s/op 1.2873 s/op 0.84
mainnet_e217614 - capella beforeProcessEpoch 70.832 ms/op 80.660 ms/op 0.88
mainnet_e217614 - capella processJustificationAndFinalization 12.598 us/op 16.000 us/op 0.79
mainnet_e217614 - capella processInactivityUpdates 16.513 ms/op 19.882 ms/op 0.83
mainnet_e217614 - capella processRewardsAndPenalties 262.28 ms/op 258.65 ms/op 1.01
mainnet_e217614 - capella processRegistryUpdates 11.321 us/op 17.680 us/op 0.64
mainnet_e217614 - capella processSlashings 826.00 ns/op 627.00 ns/op 1.32
mainnet_e217614 - capella processEth1DataReset 705.00 ns/op 329.00 ns/op 2.14
mainnet_e217614 - capella processEffectiveBalanceUpdates 10.531 ms/op 14.189 ms/op 0.74
mainnet_e217614 - capella processSlashingsReset 2.7610 us/op 3.0300 us/op 0.91
mainnet_e217614 - capella processRandaoMixesReset 3.7280 us/op 4.1400 us/op 0.90
mainnet_e217614 - capella processHistoricalRootsUpdate 429.00 ns/op 965.00 ns/op 0.44
mainnet_e217614 - capella processParticipationFlagUpdates 1.5610 us/op 1.8390 us/op 0.85
mainnet_e217614 - capella afterProcessEpoch 187.46 ms/op 237.71 ms/op 0.79
phase0 processEpoch - mainnet_e58758 336.72 ms/op 450.52 ms/op 0.75
mainnet_e58758 - phase0 beforeProcessEpoch 67.526 ms/op 80.920 ms/op 0.83
mainnet_e58758 - phase0 processJustificationAndFinalization 12.280 us/op 21.346 us/op 0.58
mainnet_e58758 - phase0 processRewardsAndPenalties 30.558 ms/op 26.241 ms/op 1.16
mainnet_e58758 - phase0 processRegistryUpdates 5.9260 us/op 7.8360 us/op 0.76
mainnet_e58758 - phase0 processSlashings 737.00 ns/op 435.00 ns/op 1.69
mainnet_e58758 - phase0 processEth1DataReset 727.00 ns/op 358.00 ns/op 2.03
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.1092 ms/op 1.1592 ms/op 0.96
mainnet_e58758 - phase0 processSlashingsReset 2.4710 us/op 4.6200 us/op 0.53
mainnet_e58758 - phase0 processRandaoMixesReset 3.0190 us/op 6.2170 us/op 0.49
mainnet_e58758 - phase0 processHistoricalRootsUpdate 684.00 ns/op 484.00 ns/op 1.41
mainnet_e58758 - phase0 processParticipationRecordUpdates 2.7370 us/op 4.0770 us/op 0.67
mainnet_e58758 - phase0 afterProcessEpoch 65.613 ms/op 83.954 ms/op 0.78
phase0 processEffectiveBalanceUpdates - 250000 normalcase 759.73 us/op 1.5922 ms/op 0.48
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.4275 ms/op 2.4097 ms/op 0.59
altair processInactivityUpdates - 250000 normalcase 16.808 ms/op 25.321 ms/op 0.66
altair processInactivityUpdates - 250000 worstcase 18.998 ms/op 25.423 ms/op 0.75
phase0 processRegistryUpdates - 250000 normalcase 3.3380 us/op 15.717 us/op 0.21
phase0 processRegistryUpdates - 250000 badcase_full_deposits 292.15 us/op 453.98 us/op 0.64
phase0 processRegistryUpdates - 250000 worstcase 0.5 109.66 ms/op 161.89 ms/op 0.68
altair processRewardsAndPenalties - 250000 normalcase 39.532 ms/op 55.740 ms/op 0.71
altair processRewardsAndPenalties - 250000 worstcase 47.565 ms/op 57.105 ms/op 0.83
phase0 getAttestationDeltas - 250000 normalcase 6.1819 ms/op 12.480 ms/op 0.50
phase0 getAttestationDeltas - 250000 worstcase 6.4834 ms/op 13.127 ms/op 0.49
phase0 processSlashings - 250000 worstcase 77.117 us/op 143.98 us/op 0.54
altair processSyncCommitteeUpdates - 250000 107.72 ms/op 165.80 ms/op 0.65
BeaconState.hashTreeRoot - No change 490.00 ns/op 558.00 ns/op 0.88
BeaconState.hashTreeRoot - 1 full validator 141.11 us/op 111.06 us/op 1.27
BeaconState.hashTreeRoot - 32 full validator 1.2628 ms/op 929.94 us/op 1.36
BeaconState.hashTreeRoot - 512 full validator 10.250 ms/op 9.7081 ms/op 1.06
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 85.674 us/op 119.61 us/op 0.72
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.7622 ms/op 1.9002 ms/op 0.93
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 22.787 ms/op 21.511 ms/op 1.06
BeaconState.hashTreeRoot - 1 balances 106.20 us/op 90.729 us/op 1.17
BeaconState.hashTreeRoot - 32 balances 1.0345 ms/op 1.3878 ms/op 0.75
BeaconState.hashTreeRoot - 512 balances 10.083 ms/op 11.625 ms/op 0.87
BeaconState.hashTreeRoot - 250000 balances 201.52 ms/op 220.70 ms/op 0.91
aggregationBits - 2048 els - zipIndexesInBitList 21.615 us/op 37.371 us/op 0.58
byteArrayEquals 32 46.165 ns/op 58.457 ns/op 0.79
Buffer.compare 32 14.722 ns/op 20.950 ns/op 0.70
byteArrayEquals 1024 1.1999 us/op 1.7507 us/op 0.69
Buffer.compare 1024 24.206 ns/op 27.108 ns/op 0.89
byteArrayEquals 16384 20.100 us/op 26.255 us/op 0.77
Buffer.compare 16384 163.11 ns/op 210.77 ns/op 0.77
byteArrayEquals 123687377 149.41 ms/op 200.82 ms/op 0.74
Buffer.compare 123687377 4.7561 ms/op 7.2944 ms/op 0.65
byteArrayEquals 32 - diff last byte 46.838 ns/op 54.439 ns/op 0.86
Buffer.compare 32 - diff last byte 15.722 ns/op 18.215 ns/op 0.86
byteArrayEquals 1024 - diff last byte 1.2752 us/op 1.6465 us/op 0.77
Buffer.compare 1024 - diff last byte 23.475 ns/op 27.384 ns/op 0.86
byteArrayEquals 16384 - diff last byte 20.149 us/op 26.013 us/op 0.77
Buffer.compare 16384 - diff last byte 187.34 ns/op 213.11 ns/op 0.88
byteArrayEquals 123687377 - diff last byte 149.86 ms/op 196.35 ms/op 0.76
Buffer.compare 123687377 - diff last byte 4.8186 ms/op 7.4064 ms/op 0.65
byteArrayEquals 32 - random bytes 4.9470 ns/op 5.4380 ns/op 0.91
Buffer.compare 32 - random bytes 15.862 ns/op 17.582 ns/op 0.90
byteArrayEquals 1024 - random bytes 4.9750 ns/op 5.5020 ns/op 0.90
Buffer.compare 1024 - random bytes 15.817 ns/op 17.607 ns/op 0.90
byteArrayEquals 16384 - random bytes 4.9750 ns/op 5.2210 ns/op 0.95
Buffer.compare 16384 - random bytes 15.787 ns/op 17.543 ns/op 0.90
byteArrayEquals 123687377 - random bytes 7.9400 ns/op 6.5300 ns/op 1.22
Buffer.compare 123687377 - random bytes 18.750 ns/op 18.930 ns/op 0.99
regular array get 100000 times 30.938 us/op 32.975 us/op 0.94
wrappedArray get 100000 times 31.185 us/op 32.756 us/op 0.95
arrayWithProxy get 100000 times 10.150 ms/op 13.784 ms/op 0.74
ssz.Root.equals 41.190 ns/op 45.952 ns/op 0.90
byteArrayEquals 41.162 ns/op 45.794 ns/op 0.90
Buffer.compare 8.5560 ns/op 10.624 ns/op 0.81
shuffle list - 16384 els 5.2793 ms/op 6.6869 ms/op 0.79
shuffle list - 250000 els 78.762 ms/op 98.577 ms/op 0.80
processSlot - 1 slots 12.064 us/op 17.155 us/op 0.70
processSlot - 32 slots 3.4558 ms/op 3.0575 ms/op 1.13
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 37.846 ms/op 38.304 ms/op 0.99
getCommitteeAssignments - req 1 vs - 250000 vc 1.7259 ms/op 2.2258 ms/op 0.78
getCommitteeAssignments - req 100 vs - 250000 vc 3.4118 ms/op 4.3877 ms/op 0.78
getCommitteeAssignments - req 1000 vs - 250000 vc 3.7031 ms/op 4.7652 ms/op 0.78
findModifiedValidators - 10000 modified validators 237.03 ms/op 303.24 ms/op 0.78
findModifiedValidators - 1000 modified validators 152.27 ms/op 228.13 ms/op 0.67
findModifiedValidators - 100 modified validators 183.63 ms/op 181.95 ms/op 1.01
findModifiedValidators - 10 modified validators 159.18 ms/op 184.47 ms/op 0.86
findModifiedValidators - 1 modified validators 158.98 ms/op 218.30 ms/op 0.73
findModifiedValidators - no difference 168.83 ms/op 247.89 ms/op 0.68
compare ViewDUs 3.5762 s/op 3.7347 s/op 0.96
compare each validator Uint8Array 1.2024 s/op 1.7799 s/op 0.68
compare ViewDU to Uint8Array 750.59 ms/op 1.5443 s/op 0.49
migrate state 1000000 validators, 24 modified, 0 new 558.34 ms/op 831.61 ms/op 0.67
migrate state 1000000 validators, 1700 modified, 1000 new 881.98 ms/op 1.0680 s/op 0.83
migrate state 1000000 validators, 3400 modified, 2000 new 1.0396 s/op 1.2938 s/op 0.80
migrate state 1500000 validators, 24 modified, 0 new 594.46 ms/op 699.75 ms/op 0.85
migrate state 1500000 validators, 1700 modified, 1000 new 750.29 ms/op 909.45 ms/op 0.82
migrate state 1500000 validators, 3400 modified, 2000 new 1.0990 s/op 1.1606 s/op 0.95
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 6.6300 ns/op 5.2000 ns/op 1.27
state getBlockRootAtSlot - 250000 vs - 7PWei 1.0830 us/op 795.44 ns/op 1.36
computeProposers - vc 250000 7.8982 ms/op 11.623 ms/op 0.68
computeEpochShuffling - vc 250000 80.748 ms/op 107.51 ms/op 0.75
getNextSyncCommittee - vc 250000 108.53 ms/op 159.63 ms/op 0.68
computeSigningRoot for AttestationData 15.817 us/op 31.276 us/op 0.51
hash AttestationData serialized data then Buffer.toString(base64) 1.2613 us/op 1.8995 us/op 0.66
toHexString serialized data 789.76 ns/op 1.1483 us/op 0.69
Buffer.toString(base64) 132.40 ns/op 235.24 ns/op 0.56
block root to RootHex using toHex 114.56 ns/op 175.77 ns/op 0.65
block root to RootHex using toRootHex 76.802 ns/op 104.98 ns/op 0.73

by benchmarkbot/action

@twoeths twoeths marked this pull request as ready for review August 20, 2024 08:18
@twoeths twoeths requested a review from a team as a code owner August 20, 2024 08:18
},
"./node": {
"import": "./lib/node.js"
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the main change of this PR

@twoeths
Copy link
Contributor Author

twoeths commented Aug 29, 2024

need to work on a solution to try NodeJS version first, if not fallback to browser version

@twoeths twoeths closed this Aug 29, 2024
@twoeths
Copy link
Contributor Author

twoeths commented Aug 29, 2024

replaced by #7060

@twoeths twoeths deleted the te/lodestar_utils_node_browser branch August 29, 2024 04:09
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.

1 participant