Skip to content

Conversation

@twoeths
Copy link
Contributor

@twoeths twoeths commented Dec 12, 2025

Motivation

  • improve memory by transferirng gossipsub message data from network thread to the main thread
  • In snappy decompression in feat: use snappy-wasm (#6483) #8647 we had to do Buffer.alloc() instead of Buffer.allocUnsafe(). We don't have to feel bad about that because Buffer.allocUnsafe() does not work with this PR, and we don't waste any memory.

Description

  • use transferList param when posting messages from network thread to the main thread

part of #8629

Testing
I've tested this on feat2 for 3 days, the previous branch was #8671 so it's basically the current stable, does not see significant improvement but some good data for different nodes

  • no change on 1k or novc
  • on hoodi sas node we have better memory there on main thread with same mesh peers, same memory on network thread
Screenshot 2025-12-12 at 11 05 27
  • on mainnnet sas node, we have better memory on network thread, a little bit worse on the main thread
Screenshot 2025-12-12 at 11 08 42
  • but for this mainnet node, the most interesting metric is forward msg avg peers, we're faster than majority of them
Screenshot 2025-12-12 at 11 11 00

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @twoeths, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant memory optimization for handling Gossipsub messages by leveraging Node.js worker_threads transferList mechanism. By transferring the underlying ArrayBuffer of message data directly between the network worker and main thread, it aims to reduce memory consumption and avoid unnecessary data copying. The change also includes a refactoring of event direction definitions to improve code organization.

Highlights

  • Memory Optimization for Gossipsub Messages: Implemented transferList when posting PendingGossipsubMessage data from the network worker thread to the main thread, allowing the underlying ArrayBuffer to be transferred instead of copied, thereby improving memory efficiency.
  • Refactoring EventDirection Enum: The EventDirection enum definition has been moved from util/workerEvents.ts to network/events.ts to centralize event-related definitions and improve code organization.
  • Performance and Memory Testing: Extensive testing over three days showed varied memory improvements across different node types, with some nodes experiencing better memory usage on the main or network thread, and one mainnet node showing faster message forwarding.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a memory optimization for handling gossipsub messages between the network and main threads. It achieves this by using the transferList option when posting messages, which transfers ownership of the message data buffer instead of copying it. This is a solid approach to reduce memory overhead. Additionally, the EventDirection enum has been refactored to a more appropriate location, improving code organization. The changes look good, and I have one suggestion to improve the type safety and clarity of the new logic for transferring buffers.

@github-actions
Copy link
Contributor

Performance Report

🚀🚀 Significant benchmark improvement detected

Benchmark suite Current: 3250692 Previous: 889b1c4 Ratio
500 bytes - compress - snappy-wasm 980.34 ns/op 25.032 us/op 0.04
Full benchmark results
Benchmark suite Current: 3250692 Previous: 889b1c4 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 1.6188 ms/op 1.2143 ms/op 1.33
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 47.708 us/op 38.005 us/op 1.26
BLS verify - blst 822.10 us/op 1.4319 ms/op 0.57
BLS verifyMultipleSignatures 3 - blst 1.1625 ms/op 1.5411 ms/op 0.75
BLS verifyMultipleSignatures 8 - blst 1.6244 ms/op 2.5085 ms/op 0.65
BLS verifyMultipleSignatures 32 - blst 4.8213 ms/op 7.3538 ms/op 0.66
BLS verifyMultipleSignatures 64 - blst 8.9183 ms/op 10.919 ms/op 0.82
BLS verifyMultipleSignatures 128 - blst 17.005 ms/op 16.865 ms/op 1.01
BLS deserializing 10000 signatures 666.59 ms/op 677.14 ms/op 0.98
BLS deserializing 100000 signatures 6.7337 s/op 6.8080 s/op 0.99
BLS verifyMultipleSignatures - same message - 3 - blst 888.64 us/op 1.1914 ms/op 0.75
BLS verifyMultipleSignatures - same message - 8 - blst 1.0000 ms/op 982.85 us/op 1.02
BLS verifyMultipleSignatures - same message - 32 - blst 1.6708 ms/op 1.6513 ms/op 1.01
BLS verifyMultipleSignatures - same message - 64 - blst 2.5311 ms/op 2.5452 ms/op 0.99
BLS verifyMultipleSignatures - same message - 128 - blst 4.2574 ms/op 4.1521 ms/op 1.03
BLS aggregatePubkeys 32 - blst 18.613 us/op 19.262 us/op 0.97
BLS aggregatePubkeys 128 - blst 66.870 us/op 68.527 us/op 0.98
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 37.798 ms/op 44.109 ms/op 0.86
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 36.295 ms/op 39.116 ms/op 0.93
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 29.849 ms/op 31.869 ms/op 0.94
getSlashingsAndExits - default max 71.212 us/op 79.710 us/op 0.89
getSlashingsAndExits - 2k 313.71 us/op 323.01 us/op 0.97
isKnown best case - 1 super set check 194.00 ns/op 196.00 ns/op 0.99
isKnown normal case - 2 super set checks 190.00 ns/op 194.00 ns/op 0.98
isKnown worse case - 16 super set checks 197.00 ns/op 239.00 ns/op 0.82
InMemoryCheckpointStateCache - add get delete 2.4090 us/op 2.3690 us/op 1.02
validate api signedAggregateAndProof - struct 1.3490 ms/op 1.7167 ms/op 0.79
validate gossip signedAggregateAndProof - struct 1.3406 ms/op 1.7200 ms/op 0.78
batch validate gossip attestation - vc 640000 - chunk 32 114.64 us/op 119.78 us/op 0.96
batch validate gossip attestation - vc 640000 - chunk 64 103.48 us/op 102.89 us/op 1.01
batch validate gossip attestation - vc 640000 - chunk 128 92.221 us/op 94.146 us/op 0.98
batch validate gossip attestation - vc 640000 - chunk 256 92.685 us/op 94.028 us/op 0.99
pickEth1Vote - no votes 921.52 us/op 930.10 us/op 0.99
pickEth1Vote - max votes 5.9482 ms/op 5.7743 ms/op 1.03
pickEth1Vote - Eth1Data hashTreeRoot value x2048 13.084 ms/op 10.054 ms/op 1.30
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 15.235 ms/op 16.823 ms/op 0.91
pickEth1Vote - Eth1Data fastSerialize value x2048 360.06 us/op 373.69 us/op 0.96
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.5031 ms/op 3.2687 ms/op 1.07
bytes32 toHexString 357.00 ns/op 353.00 ns/op 1.01
bytes32 Buffer.toString(hex) 216.00 ns/op 231.00 ns/op 0.94
bytes32 Buffer.toString(hex) from Uint8Array 310.00 ns/op 312.00 ns/op 0.99
bytes32 Buffer.toString(hex) + 0x 229.00 ns/op 237.00 ns/op 0.97
Object access 1 prop 0.10700 ns/op 0.15000 ns/op 0.71
Map access 1 prop 0.11500 ns/op 0.11500 ns/op 1.00
Object get x1000 5.1810 ns/op 5.0990 ns/op 1.02
Map get x1000 0.35700 ns/op 0.37400 ns/op 0.95
Object set x1000 28.543 ns/op 28.812 ns/op 0.99
Map set x1000 19.654 ns/op 19.958 ns/op 0.98
Return object 10000 times 0.22380 ns/op 0.22670 ns/op 0.99
Throw Error 10000 times 3.9369 us/op 4.0120 us/op 0.98
toHex 140.77 ns/op 130.43 ns/op 1.08
Buffer.from 129.85 ns/op 132.56 ns/op 0.98
shared Buffer 74.604 ns/op 77.557 ns/op 0.96
fastMsgIdFn sha256 / 200 bytes 1.7720 us/op 1.8060 us/op 0.98
fastMsgIdFn h32 xxhash / 200 bytes 184.00 ns/op 231.00 ns/op 0.80
fastMsgIdFn h64 xxhash / 200 bytes 256.00 ns/op 345.00 ns/op 0.74
fastMsgIdFn sha256 / 1000 bytes 5.9720 us/op 5.6930 us/op 1.05
fastMsgIdFn h32 xxhash / 1000 bytes 276.00 ns/op 370.00 ns/op 0.75
fastMsgIdFn h64 xxhash / 1000 bytes 301.00 ns/op 301.00 ns/op 1.00
fastMsgIdFn sha256 / 10000 bytes 50.645 us/op 51.270 us/op 0.99
fastMsgIdFn h32 xxhash / 10000 bytes 1.6290 us/op 1.3710 us/op 1.19
fastMsgIdFn h64 xxhash / 10000 bytes 1.1900 us/op 910.00 ns/op 1.31
100 bytes - compress - snappyjs 1.1990 us/op 1.2691 us/op 0.94
100 bytes - compress - snappy 1.2631 us/op 1.1560 us/op 1.09
100 bytes - compress - snappy-wasm 1.0334 us/op 765.86 ns/op 1.35
100 bytes - compress - snappy-wasm - prealloc 1.8737 us/op 1.7315 us/op 1.08
200 bytes - compress - snappyjs 1.8954 us/op 1.7783 us/op 1.07
200 bytes - compress - snappy 1.7205 us/op 1.2912 us/op 1.33
200 bytes - compress - snappy-wasm 787.84 ns/op 905.99 ns/op 0.87
200 bytes - compress - snappy-wasm - prealloc 1.9049 us/op 1.2628 us/op 1.51
300 bytes - compress - snappyjs 1.8793 us/op 1.8296 us/op 1.03
300 bytes - compress - snappy 1.3723 us/op 1.4041 us/op 0.98
300 bytes - compress - snappy-wasm 1.1249 us/op 880.00 ns/op 1.28
300 bytes - compress - snappy-wasm - prealloc 1.5075 us/op 1.8167 us/op 0.83
400 bytes - compress - snappyjs 2.6653 us/op 2.5418 us/op 1.05
400 bytes - compress - snappy 2.4656 us/op 1.5351 us/op 1.61
400 bytes - compress - snappy-wasm 930.80 ns/op 949.74 ns/op 0.98
400 bytes - compress - snappy-wasm - prealloc 1.7026 us/op 1.1219 us/op 1.52
500 bytes - compress - snappyjs 3.0084 us/op 2.8163 us/op 1.07
500 bytes - compress - snappy 1.4618 us/op 1.4631 us/op 1.00
500 bytes - compress - snappy-wasm 980.34 ns/op 25.032 us/op 0.04
500 bytes - compress - snappy-wasm - prealloc 1.7179 us/op 1.4164 us/op 1.21
1000 bytes - compress - snappyjs 4.1959 us/op 4.9380 us/op 0.85
1000 bytes - compress - snappy 1.5283 us/op 1.6736 us/op 0.91
1000 bytes - compress - snappy-wasm 2.2242 us/op 1.7008 us/op 1.31
1000 bytes - compress - snappy-wasm - prealloc 1.8805 us/op 1.7202 us/op 1.09
10000 bytes - compress - snappyjs 26.302 us/op 26.204 us/op 1.00
10000 bytes - compress - snappy 26.286 us/op 20.858 us/op 1.26
10000 bytes - compress - snappy-wasm 24.829 us/op 27.308 us/op 0.91
10000 bytes - compress - snappy-wasm - prealloc 28.802 us/op 17.033 us/op 1.69
100 bytes - uncompress - snappyjs 745.27 ns/op 675.53 ns/op 1.10
100 bytes - uncompress - snappy 1.1189 us/op 1.1638 us/op 0.96
100 bytes - uncompress - snappy-wasm 1.1075 us/op 1.0139 us/op 1.09
100 bytes - uncompress - snappy-wasm - prealloc 869.80 ns/op 803.15 ns/op 1.08
200 bytes - uncompress - snappyjs 1.2031 us/op 1.2149 us/op 0.99
200 bytes - uncompress - snappy 1.6538 us/op 1.2825 us/op 1.29
200 bytes - uncompress - snappy-wasm 1.2855 us/op 1.1086 us/op 1.16
200 bytes - uncompress - snappy-wasm - prealloc 1.5544 us/op 1.6541 us/op 0.94
300 bytes - uncompress - snappyjs 1.5154 us/op 1.4799 us/op 1.02
300 bytes - uncompress - snappy 2.5581 us/op 2.1618 us/op 1.18
300 bytes - uncompress - snappy-wasm 1.3120 us/op 728.52 ns/op 1.80
300 bytes - uncompress - snappy-wasm - prealloc 1.0582 us/op 1.4702 us/op 0.72
400 bytes - uncompress - snappyjs 2.3976 us/op 2.0038 us/op 1.20
400 bytes - uncompress - snappy 1.2560 us/op 1.8155 us/op 0.69
400 bytes - uncompress - snappy-wasm 979.01 ns/op 886.50 ns/op 1.10
400 bytes - uncompress - snappy-wasm - prealloc 1.3410 us/op 1.1882 us/op 1.13
500 bytes - uncompress - snappyjs 2.5632 us/op 1.5869 us/op 1.62
500 bytes - uncompress - snappy 1.2102 us/op 1.4493 us/op 0.84
500 bytes - uncompress - snappy-wasm 881.97 ns/op 1.0298 us/op 0.86
500 bytes - uncompress - snappy-wasm - prealloc 1.2536 us/op 1.2829 us/op 0.98
1000 bytes - uncompress - snappyjs 2.1037 us/op 2.3192 us/op 0.91
1000 bytes - uncompress - snappy 1.5742 us/op 1.5275 us/op 1.03
1000 bytes - uncompress - snappy-wasm 1.2343 us/op 1.3763 us/op 0.90
1000 bytes - uncompress - snappy-wasm - prealloc 1.8487 us/op 1.4915 us/op 1.24
10000 bytes - uncompress - snappyjs 20.111 us/op 18.790 us/op 1.07
10000 bytes - uncompress - snappy 29.914 us/op 27.212 us/op 1.10
10000 bytes - uncompress - snappy-wasm 15.437 us/op 17.740 us/op 0.87
10000 bytes - uncompress - snappy-wasm - prealloc 16.792 us/op 18.282 us/op 0.92
send data - 1000 256B messages 13.187 ms/op 14.185 ms/op 0.93
send data - 1000 512B messages 16.386 ms/op 18.115 ms/op 0.90
send data - 1000 1024B messages 21.679 ms/op 22.553 ms/op 0.96
send data - 1000 1200B messages 23.898 ms/op 25.304 ms/op 0.94
send data - 1000 2048B messages 22.754 ms/op 28.657 ms/op 0.79
send data - 1000 4096B messages 32.738 ms/op 39.209 ms/op 0.83
send data - 1000 16384B messages 116.08 ms/op 128.23 ms/op 0.91
send data - 1000 65536B messages 277.57 ms/op 273.65 ms/op 1.01
enrSubnets - fastDeserialize 64 bits 841.00 ns/op 871.00 ns/op 0.97
enrSubnets - ssz BitVector 64 bits 326.00 ns/op 332.00 ns/op 0.98
enrSubnets - fastDeserialize 4 bits 125.00 ns/op 127.00 ns/op 0.98
enrSubnets - ssz BitVector 4 bits 330.00 ns/op 436.00 ns/op 0.76
prioritizePeers score -10:0 att 32-0.1 sync 2-0 225.72 us/op 345.35 us/op 0.65
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 256.45 us/op 263.22 us/op 0.97
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 367.31 us/op 455.92 us/op 0.81
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 686.82 us/op 692.67 us/op 0.99
prioritizePeers score 0:0 att 64-1 sync 4-1 828.05 us/op 836.85 us/op 0.99
array of 16000 items push then shift 1.6014 us/op 1.5576 us/op 1.03
LinkedList of 16000 items push then shift 7.1850 ns/op 7.0340 ns/op 1.02
array of 16000 items push then pop 74.570 ns/op 73.063 ns/op 1.02
LinkedList of 16000 items push then pop 7.0000 ns/op 6.8540 ns/op 1.02
array of 24000 items push then shift 2.3621 us/op 2.3010 us/op 1.03
LinkedList of 24000 items push then shift 7.3170 ns/op 7.2200 ns/op 1.01
array of 24000 items push then pop 102.88 ns/op 103.47 ns/op 0.99
LinkedList of 24000 items push then pop 7.0360 ns/op 6.8850 ns/op 1.02
intersect bitArray bitLen 8 5.6870 ns/op 5.5620 ns/op 1.02
intersect array and set length 8 33.019 ns/op 32.518 ns/op 1.02
intersect bitArray bitLen 128 28.401 ns/op 27.842 ns/op 1.02
intersect array and set length 128 541.64 ns/op 536.72 ns/op 1.01
bitArray.getTrueBitIndexes() bitLen 128 957.00 ns/op 1.0180 us/op 0.94
bitArray.getTrueBitIndexes() bitLen 248 1.6980 us/op 2.0630 us/op 0.82
bitArray.getTrueBitIndexes() bitLen 512 3.5800 us/op 3.7380 us/op 0.96
Full columns - reconstruct all 6 blobs 254.55 us/op 303.00 us/op 0.84
Full columns - reconstruct half of the blobs out of 6 89.830 us/op 133.86 us/op 0.67
Full columns - reconstruct single blob out of 6 47.829 us/op 32.439 us/op 1.47
Half columns - reconstruct all 6 blobs 265.30 ms/op 258.31 ms/op 1.03
Half columns - reconstruct half of the blobs out of 6 131.06 ms/op 130.97 ms/op 1.00
Half columns - reconstruct single blob out of 6 48.635 ms/op 47.354 ms/op 1.03
Full columns - reconstruct all 10 blobs 365.14 us/op 387.97 us/op 0.94
Full columns - reconstruct half of the blobs out of 10 141.13 us/op 198.10 us/op 0.71
Full columns - reconstruct single blob out of 10 30.776 us/op 33.022 us/op 0.93
Half columns - reconstruct all 10 blobs 439.45 ms/op 429.37 ms/op 1.02
Half columns - reconstruct half of the blobs out of 10 220.74 ms/op 217.40 ms/op 1.02
Half columns - reconstruct single blob out of 10 48.906 ms/op 47.529 ms/op 1.03
Full columns - reconstruct all 20 blobs 770.84 us/op 666.14 us/op 1.16
Full columns - reconstruct half of the blobs out of 20 248.05 us/op 431.49 us/op 0.57
Full columns - reconstruct single blob out of 20 31.016 us/op 30.240 us/op 1.03
Half columns - reconstruct all 20 blobs 859.70 ms/op 855.23 ms/op 1.01
Half columns - reconstruct half of the blobs out of 20 434.37 ms/op 432.00 ms/op 1.01
Half columns - reconstruct single blob out of 20 47.880 ms/op 47.358 ms/op 1.01
Set add up to 64 items then delete first 1.9922 us/op 2.0223 us/op 0.99
OrderedSet add up to 64 items then delete first 2.9596 us/op 2.9973 us/op 0.99
Set add up to 64 items then delete last 2.2460 us/op 2.2679 us/op 0.99
OrderedSet add up to 64 items then delete last 3.3179 us/op 3.4541 us/op 0.96
Set add up to 64 items then delete middle 2.3330 us/op 2.2933 us/op 1.02
OrderedSet add up to 64 items then delete middle 4.9077 us/op 4.9708 us/op 0.99
Set add up to 128 items then delete first 4.8415 us/op 4.6447 us/op 1.04
OrderedSet add up to 128 items then delete first 7.3708 us/op 6.6693 us/op 1.11
Set add up to 128 items then delete last 4.7075 us/op 4.6345 us/op 1.02
OrderedSet add up to 128 items then delete last 6.7946 us/op 6.8826 us/op 0.99
Set add up to 128 items then delete middle 4.6277 us/op 4.4830 us/op 1.03
OrderedSet add up to 128 items then delete middle 13.181 us/op 13.096 us/op 1.01
Set add up to 256 items then delete first 10.198 us/op 9.5469 us/op 1.07
OrderedSet add up to 256 items then delete first 15.223 us/op 13.993 us/op 1.09
Set add up to 256 items then delete last 9.5945 us/op 9.3491 us/op 1.03
OrderedSet add up to 256 items then delete last 13.961 us/op 14.227 us/op 0.98
Set add up to 256 items then delete middle 9.4053 us/op 9.2654 us/op 1.02
OrderedSet add up to 256 items then delete middle 40.588 us/op 39.985 us/op 1.02
pass gossip attestations to forkchoice per slot 2.4899 ms/op 2.4790 ms/op 1.00
forkChoice updateHead vc 100000 bc 64 eq 0 492.81 us/op 485.04 us/op 1.02
forkChoice updateHead vc 600000 bc 64 eq 0 2.9461 ms/op 2.9076 ms/op 1.01
forkChoice updateHead vc 1000000 bc 64 eq 0 4.9020 ms/op 4.8260 ms/op 1.02
forkChoice updateHead vc 600000 bc 320 eq 0 2.9554 ms/op 2.9092 ms/op 1.02
forkChoice updateHead vc 600000 bc 1200 eq 0 2.9883 ms/op 2.9408 ms/op 1.02
forkChoice updateHead vc 600000 bc 7200 eq 0 3.2789 ms/op 3.2798 ms/op 1.00
forkChoice updateHead vc 600000 bc 64 eq 1000 3.3891 ms/op 3.3134 ms/op 1.02
forkChoice updateHead vc 600000 bc 64 eq 10000 3.5088 ms/op 3.4379 ms/op 1.02
forkChoice updateHead vc 600000 bc 64 eq 300000 9.0571 ms/op 8.1268 ms/op 1.11
computeDeltas 1400000 validators 0% inactive 14.545 ms/op 14.124 ms/op 1.03
computeDeltas 1400000 validators 10% inactive 13.634 ms/op 13.235 ms/op 1.03
computeDeltas 1400000 validators 20% inactive 12.663 ms/op 12.331 ms/op 1.03
computeDeltas 1400000 validators 50% inactive 9.8785 ms/op 9.6708 ms/op 1.02
computeDeltas 2100000 validators 0% inactive 21.905 ms/op 21.255 ms/op 1.03
computeDeltas 2100000 validators 10% inactive 20.450 ms/op 19.926 ms/op 1.03
computeDeltas 2100000 validators 20% inactive 19.036 ms/op 18.522 ms/op 1.03
computeDeltas 2100000 validators 50% inactive 14.977 ms/op 14.497 ms/op 1.03
altair processAttestation - 250000 vs - 7PWei normalcase 1.7985 ms/op 1.7879 ms/op 1.01
altair processAttestation - 250000 vs - 7PWei worstcase 2.6922 ms/op 2.6993 ms/op 1.00
altair processAttestation - setStatus - 1/6 committees join 115.22 us/op 113.07 us/op 1.02
altair processAttestation - setStatus - 1/3 committees join 226.70 us/op 225.04 us/op 1.01
altair processAttestation - setStatus - 1/2 committees join 328.93 us/op 316.82 us/op 1.04
altair processAttestation - setStatus - 2/3 committees join 419.48 us/op 409.10 us/op 1.03
altair processAttestation - setStatus - 4/5 committees join 583.58 us/op 572.14 us/op 1.02
altair processAttestation - setStatus - 100% committees join 682.81 us/op 676.48 us/op 1.01
altair processBlock - 250000 vs - 7PWei normalcase 3.3513 ms/op 3.5100 ms/op 0.95
altair processBlock - 250000 vs - 7PWei normalcase hashState 18.317 ms/op 16.480 ms/op 1.11
altair processBlock - 250000 vs - 7PWei worstcase 23.704 ms/op 23.989 ms/op 0.99
altair processBlock - 250000 vs - 7PWei worstcase hashState 56.475 ms/op 66.827 ms/op 0.85
phase0 processBlock - 250000 vs - 7PWei normalcase 1.4752 ms/op 1.5094 ms/op 0.98
phase0 processBlock - 250000 vs - 7PWei worstcase 19.128 ms/op 36.777 ms/op 0.52
altair processEth1Data - 250000 vs - 7PWei normalcase 341.62 us/op 350.85 us/op 0.97
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 7.5100 us/op 11.000 us/op 0.68
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 36.623 us/op 56.632 us/op 0.65
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 10.048 us/op 10.872 us/op 0.92
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 6.4510 us/op 11.269 us/op 0.57
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 143.32 us/op 252.85 us/op 0.57
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.9197 ms/op 1.9528 ms/op 0.98
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.3813 ms/op 2.3755 ms/op 1.00
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.3889 ms/op 2.3805 ms/op 1.00
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.5780 ms/op 4.4575 ms/op 1.03
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.4461 ms/op 2.4529 ms/op 1.00
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.6524 ms/op 4.6007 ms/op 1.01
Tree 40 250000 create 360.53 ms/op 382.21 ms/op 0.94
Tree 40 250000 get(125000) 127.73 ns/op 124.39 ns/op 1.03
Tree 40 250000 set(125000) 1.3189 us/op 1.2306 us/op 1.07
Tree 40 250000 toArray() 13.035 ms/op 17.920 ms/op 0.73
Tree 40 250000 iterate all - toArray() + loop 12.911 ms/op 14.064 ms/op 0.92
Tree 40 250000 iterate all - get(i) 43.275 ms/op 42.687 ms/op 1.01
Array 250000 create 2.4739 ms/op 2.4400 ms/op 1.01
Array 250000 clone - spread 804.53 us/op 828.52 us/op 0.97
Array 250000 get(125000) 0.34800 ns/op 0.38900 ns/op 0.89
Array 250000 set(125000) 0.34500 ns/op 0.36600 ns/op 0.94
Array 250000 iterate all - loop 61.627 us/op 61.187 us/op 1.01
phase0 afterProcessEpoch - 250000 vs - 7PWei 41.255 ms/op 41.206 ms/op 1.00
Array.fill - length 1000000 2.9253 ms/op 2.9158 ms/op 1.00
Array push - length 1000000 12.566 ms/op 9.6916 ms/op 1.30
Array.get 0.21500 ns/op 0.21272 ns/op 1.01
Uint8Array.get 0.21931 ns/op 0.22070 ns/op 0.99
phase0 beforeProcessEpoch - 250000 vs - 7PWei 13.009 ms/op 15.681 ms/op 0.83
altair processEpoch - mainnet_e81889 258.52 ms/op 248.13 ms/op 1.04
mainnet_e81889 - altair beforeProcessEpoch 15.892 ms/op 16.297 ms/op 0.98
mainnet_e81889 - altair processJustificationAndFinalization 5.4510 us/op 5.3490 us/op 1.02
mainnet_e81889 - altair processInactivityUpdates 3.7446 ms/op 3.7334 ms/op 1.00
mainnet_e81889 - altair processRewardsAndPenalties 18.127 ms/op 22.713 ms/op 0.80
mainnet_e81889 - altair processRegistryUpdates 637.00 ns/op 866.00 ns/op 0.74
mainnet_e81889 - altair processSlashings 156.00 ns/op 165.00 ns/op 0.95
mainnet_e81889 - altair processEth1DataReset 156.00 ns/op 196.00 ns/op 0.80
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.1129 ms/op 1.5818 ms/op 1.34
mainnet_e81889 - altair processSlashingsReset 798.00 ns/op 788.00 ns/op 1.01
mainnet_e81889 - altair processRandaoMixesReset 1.0570 us/op 1.0260 us/op 1.03
mainnet_e81889 - altair processHistoricalRootsUpdate 158.00 ns/op 188.00 ns/op 0.84
mainnet_e81889 - altair processParticipationFlagUpdates 498.00 ns/op 485.00 ns/op 1.03
mainnet_e81889 - altair processSyncCommitteeUpdates 124.00 ns/op 131.00 ns/op 0.95
mainnet_e81889 - altair afterProcessEpoch 43.268 ms/op 43.462 ms/op 1.00
capella processEpoch - mainnet_e217614 765.33 ms/op 841.36 ms/op 0.91
mainnet_e217614 - capella beforeProcessEpoch 64.487 ms/op 62.585 ms/op 1.03
mainnet_e217614 - capella processJustificationAndFinalization 5.6860 us/op 5.6690 us/op 1.00
mainnet_e217614 - capella processInactivityUpdates 15.198 ms/op 15.684 ms/op 0.97
mainnet_e217614 - capella processRewardsAndPenalties 101.84 ms/op 105.50 ms/op 0.97
mainnet_e217614 - capella processRegistryUpdates 6.1300 us/op 6.1050 us/op 1.00
mainnet_e217614 - capella processSlashings 159.00 ns/op 274.00 ns/op 0.58
mainnet_e217614 - capella processEth1DataReset 158.00 ns/op 163.00 ns/op 0.97
mainnet_e217614 - capella processEffectiveBalanceUpdates 12.482 ms/op 11.554 ms/op 1.08
mainnet_e217614 - capella processSlashingsReset 799.00 ns/op 960.00 ns/op 0.83
mainnet_e217614 - capella processRandaoMixesReset 1.0750 us/op 1.1700 us/op 0.92
mainnet_e217614 - capella processHistoricalRootsUpdate 158.00 ns/op 169.00 ns/op 0.93
mainnet_e217614 - capella processParticipationFlagUpdates 488.00 ns/op 501.00 ns/op 0.97
mainnet_e217614 - capella afterProcessEpoch 111.26 ms/op 113.95 ms/op 0.98
phase0 processEpoch - mainnet_e58758 253.28 ms/op 237.51 ms/op 1.07
mainnet_e58758 - phase0 beforeProcessEpoch 52.983 ms/op 45.424 ms/op 1.17
mainnet_e58758 - phase0 processJustificationAndFinalization 5.5840 us/op 5.8030 us/op 0.96
mainnet_e58758 - phase0 processRewardsAndPenalties 17.947 ms/op 18.481 ms/op 0.97
mainnet_e58758 - phase0 processRegistryUpdates 3.0080 us/op 2.9760 us/op 1.01
mainnet_e58758 - phase0 processSlashings 166.00 ns/op 219.00 ns/op 0.76
mainnet_e58758 - phase0 processEth1DataReset 156.00 ns/op 187.00 ns/op 0.83
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.0532 ms/op 922.93 us/op 1.14
mainnet_e58758 - phase0 processSlashingsReset 773.00 ns/op 1.0170 us/op 0.76
mainnet_e58758 - phase0 processRandaoMixesReset 1.0890 us/op 1.0700 us/op 1.02
mainnet_e58758 - phase0 processHistoricalRootsUpdate 169.00 ns/op 238.00 ns/op 0.71
mainnet_e58758 - phase0 processParticipationRecordUpdates 817.00 ns/op 800.00 ns/op 1.02
mainnet_e58758 - phase0 afterProcessEpoch 34.384 ms/op 34.326 ms/op 1.00
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.2954 ms/op 1.1656 ms/op 1.11
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.9267 ms/op 1.8698 ms/op 1.03
altair processInactivityUpdates - 250000 normalcase 12.829 ms/op 11.817 ms/op 1.09
altair processInactivityUpdates - 250000 worstcase 12.119 ms/op 11.718 ms/op 1.03
phase0 processRegistryUpdates - 250000 normalcase 4.8990 us/op 4.9970 us/op 0.98
phase0 processRegistryUpdates - 250000 badcase_full_deposits 209.16 us/op 318.78 us/op 0.66
phase0 processRegistryUpdates - 250000 worstcase 0.5 72.873 ms/op 76.605 ms/op 0.95
altair processRewardsAndPenalties - 250000 normalcase 16.899 ms/op 23.142 ms/op 0.73
altair processRewardsAndPenalties - 250000 worstcase 16.308 ms/op 22.184 ms/op 0.74
phase0 getAttestationDeltas - 250000 normalcase 6.6298 ms/op 6.5074 ms/op 1.02
phase0 getAttestationDeltas - 250000 worstcase 6.6729 ms/op 6.5621 ms/op 1.02
phase0 processSlashings - 250000 worstcase 76.515 us/op 93.326 us/op 0.82
altair processSyncCommitteeUpdates - 250000 10.973 ms/op 10.990 ms/op 1.00
BeaconState.hashTreeRoot - No change 198.00 ns/op 258.00 ns/op 0.77
BeaconState.hashTreeRoot - 1 full validator 75.418 us/op 83.622 us/op 0.90
BeaconState.hashTreeRoot - 32 full validator 945.76 us/op 964.49 us/op 0.98
BeaconState.hashTreeRoot - 512 full validator 7.7453 ms/op 7.5914 ms/op 1.02
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 92.034 us/op 106.06 us/op 0.87
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.5423 ms/op 1.5704 ms/op 0.98
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 16.156 ms/op 16.479 ms/op 0.98
BeaconState.hashTreeRoot - 1 balances 81.463 us/op 89.421 us/op 0.91
BeaconState.hashTreeRoot - 32 balances 758.39 us/op 801.24 us/op 0.95
BeaconState.hashTreeRoot - 512 balances 6.0057 ms/op 7.0609 ms/op 0.85
BeaconState.hashTreeRoot - 250000 balances 131.55 ms/op 179.88 ms/op 0.73
aggregationBits - 2048 els - zipIndexesInBitList 20.716 us/op 20.367 us/op 1.02
regular array get 100000 times 23.833 us/op 23.955 us/op 0.99
wrappedArray get 100000 times 23.888 us/op 23.906 us/op 1.00
arrayWithProxy get 100000 times 13.480 ms/op 14.147 ms/op 0.95
ssz.Root.equals 23.041 ns/op 23.845 ns/op 0.97
byteArrayEquals 22.392 ns/op 23.206 ns/op 0.96
Buffer.compare 9.8610 ns/op 10.008 ns/op 0.99
processSlot - 1 slots 10.287 us/op 11.128 us/op 0.92
processSlot - 32 slots 2.3892 ms/op 2.9516 ms/op 0.81
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 4.2141 ms/op 3.6975 ms/op 1.14
getCommitteeAssignments - req 1 vs - 250000 vc 1.8435 ms/op 1.8449 ms/op 1.00
getCommitteeAssignments - req 100 vs - 250000 vc 3.5833 ms/op 3.5940 ms/op 1.00
getCommitteeAssignments - req 1000 vs - 250000 vc 3.8265 ms/op 3.8245 ms/op 1.00
findModifiedValidators - 10000 modified validators 610.54 ms/op 514.77 ms/op 1.19
findModifiedValidators - 1000 modified validators 335.56 ms/op 409.77 ms/op 0.82
findModifiedValidators - 100 modified validators 281.51 ms/op 293.64 ms/op 0.96
findModifiedValidators - 10 modified validators 155.39 ms/op 169.59 ms/op 0.92
findModifiedValidators - 1 modified validators 221.82 ms/op 144.57 ms/op 1.53
findModifiedValidators - no difference 171.93 ms/op 165.09 ms/op 1.04
migrate state 1500000 validators, 3400 modified, 2000 new 1.1196 s/op 1.1761 s/op 0.95
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.4600 ns/op 5.1700 ns/op 0.86
state getBlockRootAtSlot - 250000 vs - 7PWei 919.05 ns/op 881.58 ns/op 1.04
computeProposerIndex 100000 validators 1.5801 ms/op 1.5231 ms/op 1.04
getNextSyncCommitteeIndices 1000 validators 116.47 ms/op 117.95 ms/op 0.99
getNextSyncCommitteeIndices 10000 validators 116.38 ms/op 118.45 ms/op 0.98
getNextSyncCommitteeIndices 100000 validators 112.89 ms/op 117.67 ms/op 0.96
computeProposers - vc 250000 640.61 us/op 663.84 us/op 0.97
computeEpochShuffling - vc 250000 54.789 ms/op 42.107 ms/op 1.30
getNextSyncCommittee - vc 250000 10.290 ms/op 10.406 ms/op 0.99
nodejs block root to RootHex using toHex 147.93 ns/op 140.01 ns/op 1.06
nodejs block root to RootHex using toRootHex 82.164 ns/op 98.189 ns/op 0.84
nodejs fromHex(blob) 280.27 us/op 433.41 us/op 0.65
nodejs fromHexInto(blob) 683.49 us/op 726.82 us/op 0.94
nodejs block root to RootHex using the deprecated toHexString 532.85 ns/op 559.36 ns/op 0.95
browser block root to RootHex using toHex 285.59 ns/op 279.73 ns/op 1.02
browser block root to RootHex using toRootHex 150.63 ns/op 155.91 ns/op 0.97
browser fromHex(blob) 1.0063 ms/op 1.2225 ms/op 0.82
browser fromHexInto(blob) 681.19 us/op 701.46 us/op 0.97
browser block root to RootHex using the deprecated toHexString 366.21 ns/op 381.99 ns/op 0.96

by benchmarkbot/action

@twoeths twoeths marked this pull request as ready for review December 12, 2025 07:41
@twoeths twoeths requested a review from a team as a code owner December 12, 2025 07:41
data,
};
parentPort.postMessage(workerEvent);
let transferList: ArrayBuffer[] | undefined = undefined;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the only change
others were to avoid cyclic dependencies

@wemeetagain wemeetagain merged commit d4a4765 into unstable Dec 16, 2025
39 of 46 checks passed
@wemeetagain wemeetagain deleted the te/transfer_pending_gossipsub_message_msg_data branch December 16, 2025 13:47
@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.04%. Comparing base (688d558) to head (fe2d5bd).
⚠️ Report is 12 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #8689      +/-   ##
============================================
- Coverage     52.04%   52.04%   -0.01%     
============================================
  Files           848      848              
  Lines         65734    65727       -7     
  Branches       4807     4806       -1     
============================================
- Hits          34214    34208       -6     
+ Misses        31451    31450       -1     
  Partials         69       69              
🚀 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.

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.

4 participants