Skip to content

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Oct 9, 2025

Motivation

  • to be able to take profile in Bun

Description

  • implement profileBun api using console.profile() apis
    • as tested, it only supported up to 3s or Bun will crash so I have to do a for loop
    • cannot take the whole epoch, or debug.bun.sh will take forever to load
  • refactor: implement profileThread as wrapper of either profileNodeJS or profileBun
  • note that NodeJS and Bun works a bit differently:
    • NodeJS: we can persist to a file, log into server and copy it
    • Bun: need to launch debug.bun.sh web page as the inspector, profile will be flushed from node to to the inspected and rendered live there

Steps to take profile

  • start beacon node with --inspect and look for debug.bun.sh log
  • launch the specified url, for example https://debug.bun.sh/#127.0.0.1:9229/0qoflywrwso
  • (optional) the UI does not show if the inspector is connected to app or not, so normally I wait for the sources to be launched
  • curl -X POST http://localhost:9596/eth/v1/lodestar/write_profile?thread=main
  • look into Timelines tab in https://debug.bun.sh/, check Call tree there
  • (optional) export Timeline to share it

Sample Profile
Timeline%20Recording%201 (4).json.zip

@twoeths twoeths requested a review from a team as a code owner October 9, 2025 01:50
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 PR adds Bun runtime profiling capabilities, refactoring existing NodeJS profiling into a unified profileThread API. It addresses Bun's specific profiling mechanisms and limitations, ensuring compatibility and providing clear instructions for usage.

Highlights

  • Intent: This pull request introduces the capability to take CPU profiles when running the application with Bun, in addition to the existing NodeJS profiling. The primary motivation is to enable performance analysis in Bun environments.
  • Changes Summary: The core change involves refactoring the profiling logic to support both NodeJS and Bun runtimes. A new profileThread function acts as a unified entry point, dispatching to profileNodeJS or profileBun based on the detected runtime. For Bun, profiling uses console.profile() APIs and is limited to short durations (3 seconds per segment) to prevent crashes, with the output streamed directly to the Bun inspector rather than saved to a file. For NodeJS, profiles are still saved to .cpuprofile files. The write_profile API endpoint's return type was updated to result: string to accommodate both file paths (NodeJS) and descriptive messages (Bun). Imports for fs and path were centralized in packages/beacon-node/src/util/profile.ts and removed from other files where direct file operations are no longer performed.
  • Reviewer Activity Summary: None
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 profiling capabilities for Bun, which is a great addition. The refactoring to create a unified profileThread function is a good approach. I've found a bug in the NodeJS profiling implementation where the output directory and filename are not handled correctly after the refactoring. I've also included suggestions to fix this and to improve the readability of the new Bun profiling logic. Please see my detailed comments below.

Comment on lines 61 to 74
async function profileBun(thread: ProfileThread, durationMs: number): Promise<string> {
const start = Date.now();
let now = Date.now();
while (now - start < durationMs) {
// biome-ignore lint/suspicious/noConsole: need to use console api to profile in Bun
console.profile(String(now));
await sleep(BUN_PROFILE_MS);
// biome-ignore lint/suspicious/noConsole: need to use console api to profile in Bun
console.profileEnd(String(now));
now = Date.now();
}

return `Time taken to profile Bun ${thread} thread: ${now - start}ms`;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The while loop logic can be simplified for better readability. By calculating the number of profiling chunks upfront, we can use a for loop which makes the intent of the code more explicit.

async function profileBun(thread: ProfileThread, durationMs: number): Promise<string> {
  const start = Date.now();
  const profileCount = Math.ceil(durationMs / BUN_PROFILE_MS);

  for (let i = 0; i < profileCount; i++) {
    const profileLabel = `${thread}-${start}-${i}`;
    // biome-ignore lint/suspicious/noConsole: need to use console api to profile in Bun
    console.profile(profileLabel);
    await sleep(BUN_PROFILE_MS);
    // biome-ignore lint/suspicious/noConsole: need to use console api to profile in Bun
    console.profileEnd(profileLabel);
  }

  const end = Date.now();
  return `Time taken to profile Bun ${thread} thread: ${end - start}ms`;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's not correct for big while loop, tried that with durationMs up to 1 epoch and it's >30s slippery

Copy link

codecov bot commented Oct 9, 2025

Codecov Report

❌ Patch coverage is 26.66667% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.19%. Comparing base (7a240d3) to head (43a9eb0).
⚠️ Report is 4 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #8515      +/-   ##
============================================
- Coverage     52.19%   52.19%   -0.01%     
============================================
  Files           852      852              
  Lines         65054    65073      +19     
  Branches       4771     4774       +3     
============================================
+ Hits          33955    33963       +8     
- Misses        31030    31041      +11     
  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.

@twoeths
Copy link
Contributor Author

twoeths commented Oct 9, 2025

was able to take profile with NodeJS, no regression there

* If we increase this time it'll potentiall cause the app to crash.
* If we decrease this time, profile recorded will be fragmented and hard to analyze.
*/
const BUN_PROFILE_MS = 3 * 1000;

Choose a reason for hiding this comment

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

crash after 3 seconds? that sounds like definitely a bug in Bun

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Jarred-Sumner not exactly right after 3s, but I tried with 6s and our beacon-node with Bun crashed. But it's not a blocker for main thread

do you know if Bun supports taking profile for worker threads? I cannot do that, the inspector shows nothing and I'm not able to select threads. Just want to know it's on your TODO's list or I should report a bug for it

just fyi in lodestar, we have a separate network thread, and another discv5 thread so it's quite important for us to know how Bun works there

Copy link
Contributor

github-actions bot commented Oct 9, 2025

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 7ff1230 Previous: f657221 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 945.96 us/op 963.05 us/op 0.98
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 34.728 us/op 35.113 us/op 0.99
BLS verify - blst 1.4389 ms/op 766.41 us/op 1.88
BLS verifyMultipleSignatures 3 - blst 2.2479 ms/op 1.1593 ms/op 1.94
BLS verifyMultipleSignatures 8 - blst 2.3430 ms/op 1.6236 ms/op 1.44
BLS verifyMultipleSignatures 32 - blst 7.3495 ms/op 4.7838 ms/op 1.54
BLS verifyMultipleSignatures 64 - blst 11.041 ms/op 8.9516 ms/op 1.23
BLS verifyMultipleSignatures 128 - blst 17.013 ms/op 17.016 ms/op 1.00
BLS deserializing 10000 signatures 673.53 ms/op 684.03 ms/op 0.98
BLS deserializing 100000 signatures 6.7500 s/op 6.7951 s/op 0.99
BLS verifyMultipleSignatures - same message - 3 - blst 863.03 us/op 829.95 us/op 1.04
BLS verifyMultipleSignatures - same message - 8 - blst 1.6210 ms/op 1.0041 ms/op 1.61
BLS verifyMultipleSignatures - same message - 32 - blst 1.7129 ms/op 1.7351 ms/op 0.99
BLS verifyMultipleSignatures - same message - 64 - blst 2.6659 ms/op 2.5880 ms/op 1.03
BLS verifyMultipleSignatures - same message - 128 - blst 4.3846 ms/op 4.3206 ms/op 1.01
BLS aggregatePubkeys 32 - blst 18.517 us/op 19.339 us/op 0.96
BLS aggregatePubkeys 128 - blst 66.116 us/op 69.144 us/op 0.96
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 52.747 ms/op 50.973 ms/op 1.03
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 45.657 ms/op 49.435 ms/op 0.92
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 41.513 ms/op 38.340 ms/op 1.08
getSlashingsAndExits - default max 70.149 us/op 75.730 us/op 0.93
getSlashingsAndExits - 2k 329.26 us/op 323.86 us/op 1.02
isKnown best case - 1 super set check 201.00 ns/op 213.00 ns/op 0.94
isKnown normal case - 2 super set checks 196.00 ns/op 213.00 ns/op 0.92
isKnown worse case - 16 super set checks 195.00 ns/op 211.00 ns/op 0.92
InMemoryCheckpointStateCache - add get delete 2.2880 us/op 2.3930 us/op 0.96
validate api signedAggregateAndProof - struct 1.7401 ms/op 1.5539 ms/op 1.12
validate gossip signedAggregateAndProof - struct 1.7226 ms/op 1.4087 ms/op 1.22
batch validate gossip attestation - vc 640000 - chunk 32 113.48 us/op 115.36 us/op 0.98
batch validate gossip attestation - vc 640000 - chunk 64 99.524 us/op 101.00 us/op 0.99
batch validate gossip attestation - vc 640000 - chunk 128 93.969 us/op 95.210 us/op 0.99
batch validate gossip attestation - vc 640000 - chunk 256 95.130 us/op 99.197 us/op 0.96
pickEth1Vote - no votes 917.55 us/op 983.13 us/op 0.93
pickEth1Vote - max votes 4.8775 ms/op 6.2332 ms/op 0.78
pickEth1Vote - Eth1Data hashTreeRoot value x2048 10.110 ms/op 10.712 ms/op 0.94
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 17.542 ms/op 14.057 ms/op 1.25
pickEth1Vote - Eth1Data fastSerialize value x2048 426.96 us/op 444.74 us/op 0.96
pickEth1Vote - Eth1Data fastSerialize tree x2048 2.1366 ms/op 2.1757 ms/op 0.98
bytes32 toHexString 346.00 ns/op 364.00 ns/op 0.95
bytes32 Buffer.toString(hex) 235.00 ns/op 242.00 ns/op 0.97
bytes32 Buffer.toString(hex) from Uint8Array 319.00 ns/op 332.00 ns/op 0.96
bytes32 Buffer.toString(hex) + 0x 240.00 ns/op 242.00 ns/op 0.99
Object access 1 prop 0.12100 ns/op 0.11600 ns/op 1.04
Map access 1 prop 0.13100 ns/op 0.12200 ns/op 1.07
Object get x1000 5.7090 ns/op 5.9690 ns/op 0.96
Map get x1000 6.2220 ns/op 7.9930 ns/op 0.78
Object set x1000 27.269 ns/op 29.617 ns/op 0.92
Map set x1000 18.608 ns/op 19.882 ns/op 0.94
Return object 10000 times 0.27730 ns/op 0.28630 ns/op 0.97
Throw Error 10000 times 4.3802 us/op 4.3810 us/op 1.00
toHex 139.50 ns/op 138.04 ns/op 1.01
Buffer.from 125.99 ns/op 133.32 ns/op 0.94
shared Buffer 80.416 ns/op 80.423 ns/op 1.00
fastMsgIdFn sha256 / 200 bytes 2.1190 us/op 2.1700 us/op 0.98
fastMsgIdFn h32 xxhash / 200 bytes 199.00 ns/op 198.00 ns/op 1.01
fastMsgIdFn h64 xxhash / 200 bytes 256.00 ns/op 257.00 ns/op 1.00
fastMsgIdFn sha256 / 1000 bytes 6.8720 us/op 7.1680 us/op 0.96
fastMsgIdFn h32 xxhash / 1000 bytes 411.00 ns/op 325.00 ns/op 1.26
fastMsgIdFn h64 xxhash / 1000 bytes 344.00 ns/op 332.00 ns/op 1.04
fastMsgIdFn sha256 / 10000 bytes 63.706 us/op 64.386 us/op 0.99
fastMsgIdFn h32 xxhash / 10000 bytes 1.8010 us/op 1.8040 us/op 1.00
fastMsgIdFn h64 xxhash / 10000 bytes 1.1990 us/op 1.1690 us/op 1.03
send data - 1000 256B messages 15.180 ms/op 15.454 ms/op 0.98
send data - 1000 512B messages 17.681 ms/op 21.034 ms/op 0.84
send data - 1000 1024B messages 26.058 ms/op 28.663 ms/op 0.91
send data - 1000 1200B messages 22.136 ms/op 24.539 ms/op 0.90
send data - 1000 2048B messages 22.857 ms/op 24.972 ms/op 0.92
send data - 1000 4096B messages 25.422 ms/op 27.541 ms/op 0.92
send data - 1000 16384B messages 51.555 ms/op 43.732 ms/op 1.18
send data - 1000 65536B messages 109.10 ms/op 115.32 ms/op 0.95
enrSubnets - fastDeserialize 64 bits 878.00 ns/op 888.00 ns/op 0.99
enrSubnets - ssz BitVector 64 bits 331.00 ns/op 307.00 ns/op 1.08
enrSubnets - fastDeserialize 4 bits 127.00 ns/op 123.00 ns/op 1.03
enrSubnets - ssz BitVector 4 bits 329.00 ns/op 307.00 ns/op 1.07
prioritizePeers score -10:0 att 32-0.1 sync 2-0 228.52 us/op 230.66 us/op 0.99
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 252.71 us/op 257.46 us/op 0.98
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 365.80 us/op 369.94 us/op 0.99
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 684.87 us/op 699.21 us/op 0.98
prioritizePeers score 0:0 att 64-1 sync 4-1 825.91 us/op 837.09 us/op 0.99
array of 16000 items push then shift 1.5702 us/op 1.5808 us/op 0.99
LinkedList of 16000 items push then shift 7.1100 ns/op 7.4940 ns/op 0.95
array of 16000 items push then pop 73.787 ns/op 75.743 ns/op 0.97
LinkedList of 16000 items push then pop 6.9260 ns/op 7.1930 ns/op 0.96
array of 24000 items push then shift 2.3461 us/op 2.3467 us/op 1.00
LinkedList of 24000 items push then shift 7.0220 ns/op 7.5860 ns/op 0.93
array of 24000 items push then pop 98.665 ns/op 111.70 ns/op 0.88
LinkedList of 24000 items push then pop 6.9200 ns/op 7.4430 ns/op 0.93
intersect bitArray bitLen 8 6.2340 ns/op 6.3070 ns/op 0.99
intersect array and set length 8 36.982 ns/op 37.774 ns/op 0.98
intersect bitArray bitLen 128 29.107 ns/op 29.521 ns/op 0.99
intersect array and set length 128 609.11 ns/op 612.82 ns/op 0.99
bitArray.getTrueBitIndexes() bitLen 128 967.00 ns/op 983.00 ns/op 0.98
bitArray.getTrueBitIndexes() bitLen 248 1.7040 us/op 1.7310 us/op 0.98
bitArray.getTrueBitIndexes() bitLen 512 3.5260 us/op 3.5450 us/op 0.99
Buffer.concat 32 items 708.00 ns/op 604.00 ns/op 1.17
Uint8Array.set 32 items 1.1690 us/op 1.0820 us/op 1.08
Buffer.copy 2.7190 us/op 2.4650 us/op 1.10
Uint8Array.set - with subarray 1.5610 us/op 2.4530 us/op 0.64
Uint8Array.set - without subarray 1.0770 us/op 1.0520 us/op 1.02
getUint32 - dataview 237.00 ns/op 181.00 ns/op 1.31
getUint32 - manual 120.00 ns/op 114.00 ns/op 1.05
Set add up to 64 items then delete first 2.1156 us/op 2.1398 us/op 0.99
OrderedSet add up to 64 items then delete first 3.2551 us/op 3.3070 us/op 0.98
Set add up to 64 items then delete last 2.3605 us/op 2.4659 us/op 0.96
OrderedSet add up to 64 items then delete last 3.4984 us/op 3.8994 us/op 0.90
Set add up to 64 items then delete middle 2.2729 us/op 2.3787 us/op 0.96
OrderedSet add up to 64 items then delete middle 5.1559 us/op 5.8489 us/op 0.88
Set add up to 128 items then delete first 4.8502 us/op 5.0031 us/op 0.97
OrderedSet add up to 128 items then delete first 7.6291 us/op 7.3688 us/op 1.04
Set add up to 128 items then delete last 4.8596 us/op 5.1144 us/op 0.95
OrderedSet add up to 128 items then delete last 7.3703 us/op 7.7726 us/op 0.95
Set add up to 128 items then delete middle 4.6770 us/op 4.9556 us/op 0.94
OrderedSet add up to 128 items then delete middle 13.325 us/op 14.599 us/op 0.91
Set add up to 256 items then delete first 10.096 us/op 9.7445 us/op 1.04
OrderedSet add up to 256 items then delete first 15.783 us/op 15.741 us/op 1.00
Set add up to 256 items then delete last 9.3121 us/op 10.480 us/op 0.89
OrderedSet add up to 256 items then delete last 14.037 us/op 16.079 us/op 0.87
Set add up to 256 items then delete middle 9.5070 us/op 11.903 us/op 0.80
OrderedSet add up to 256 items then delete middle 41.519 us/op 46.199 us/op 0.90
transfer serialized Status (84 B) 2.1750 us/op 2.3020 us/op 0.94
copy serialized Status (84 B) 1.1010 us/op 1.1990 us/op 0.92
transfer serialized SignedVoluntaryExit (112 B) 2.1940 us/op 2.2580 us/op 0.97
copy serialized SignedVoluntaryExit (112 B) 1.6630 us/op 1.2090 us/op 1.38
transfer serialized ProposerSlashing (416 B) 2.1990 us/op 2.3040 us/op 0.95
copy serialized ProposerSlashing (416 B) 1.1840 us/op 1.4040 us/op 0.84
transfer serialized Attestation (485 B) 2.2060 us/op 2.3050 us/op 0.96
copy serialized Attestation (485 B) 1.2310 us/op 1.4060 us/op 0.88
transfer serialized AttesterSlashing (33232 B) 2.3620 us/op 2.7260 us/op 0.87
copy serialized AttesterSlashing (33232 B) 3.2420 us/op 4.0360 us/op 0.80
transfer serialized Small SignedBeaconBlock (128000 B) 2.8830 us/op 3.4280 us/op 0.84
copy serialized Small SignedBeaconBlock (128000 B) 8.6030 us/op 9.9470 us/op 0.86
transfer serialized Avg SignedBeaconBlock (200000 B) 3.2230 us/op 3.8430 us/op 0.84
copy serialized Avg SignedBeaconBlock (200000 B) 12.464 us/op 13.601 us/op 0.92
transfer serialized BlobsSidecar (524380 B) 3.3270 us/op 3.8750 us/op 0.86
copy serialized BlobsSidecar (524380 B) 141.75 us/op 57.309 us/op 2.47
transfer serialized Big SignedBeaconBlock (1000000 B) 3.2650 us/op 4.0560 us/op 0.80
copy serialized Big SignedBeaconBlock (1000000 B) 143.97 us/op 110.10 us/op 1.31
pass gossip attestations to forkchoice per slot 2.5879 ms/op 2.9192 ms/op 0.89
forkChoice updateHead vc 100000 bc 64 eq 0 427.53 us/op 459.82 us/op 0.93
forkChoice updateHead vc 600000 bc 64 eq 0 2.6541 ms/op 2.8594 ms/op 0.93
forkChoice updateHead vc 1000000 bc 64 eq 0 4.5391 ms/op 4.8612 ms/op 0.93
forkChoice updateHead vc 600000 bc 320 eq 0 2.6734 ms/op 2.8472 ms/op 0.94
forkChoice updateHead vc 600000 bc 1200 eq 0 2.6779 ms/op 2.9100 ms/op 0.92
forkChoice updateHead vc 600000 bc 7200 eq 0 2.9110 ms/op 3.0747 ms/op 0.95
forkChoice updateHead vc 600000 bc 64 eq 1000 9.8412 ms/op 10.544 ms/op 0.93
forkChoice updateHead vc 600000 bc 64 eq 10000 10.152 ms/op 10.263 ms/op 0.99
forkChoice updateHead vc 600000 bc 64 eq 300000 13.056 ms/op 13.681 ms/op 0.95
computeDeltas 500000 validators 300 proto nodes 3.7602 ms/op 3.9615 ms/op 0.95
computeDeltas 500000 validators 1200 proto nodes 3.7839 ms/op 3.9636 ms/op 0.95
computeDeltas 500000 validators 7200 proto nodes 3.7794 ms/op 3.9968 ms/op 0.95
computeDeltas 750000 validators 300 proto nodes 5.6691 ms/op 5.9248 ms/op 0.96
computeDeltas 750000 validators 1200 proto nodes 5.7551 ms/op 5.8970 ms/op 0.98
computeDeltas 750000 validators 7200 proto nodes 5.8331 ms/op 5.7397 ms/op 1.02
computeDeltas 1400000 validators 300 proto nodes 11.164 ms/op 10.710 ms/op 1.04
computeDeltas 1400000 validators 1200 proto nodes 11.027 ms/op 10.922 ms/op 1.01
computeDeltas 1400000 validators 7200 proto nodes 11.078 ms/op 11.925 ms/op 0.93
computeDeltas 2100000 validators 300 proto nodes 16.789 ms/op 16.968 ms/op 0.99
computeDeltas 2100000 validators 1200 proto nodes 16.737 ms/op 25.392 ms/op 0.66
computeDeltas 2100000 validators 7200 proto nodes 16.710 ms/op 19.003 ms/op 0.88
altair processAttestation - 250000 vs - 7PWei normalcase 2.2376 ms/op 3.2087 ms/op 0.70
altair processAttestation - 250000 vs - 7PWei worstcase 3.2847 ms/op 4.9054 ms/op 0.67
altair processAttestation - setStatus - 1/6 committees join 134.21 us/op 158.26 us/op 0.85
altair processAttestation - setStatus - 1/3 committees join 253.38 us/op 293.68 us/op 0.86
altair processAttestation - setStatus - 1/2 committees join 342.97 us/op 396.10 us/op 0.87
altair processAttestation - setStatus - 2/3 committees join 453.84 us/op 470.76 us/op 0.96
altair processAttestation - setStatus - 4/5 committees join 615.94 us/op 701.01 us/op 0.88
altair processAttestation - setStatus - 100% committees join 722.34 us/op 719.20 us/op 1.00
altair processBlock - 250000 vs - 7PWei normalcase 5.0455 ms/op 4.1607 ms/op 1.21
altair processBlock - 250000 vs - 7PWei normalcase hashState 30.671 ms/op 29.297 ms/op 1.05
altair processBlock - 250000 vs - 7PWei worstcase 40.101 ms/op 33.872 ms/op 1.18
altair processBlock - 250000 vs - 7PWei worstcase hashState 87.773 ms/op 80.811 ms/op 1.09
phase0 processBlock - 250000 vs - 7PWei normalcase 1.8783 ms/op 1.6383 ms/op 1.15
phase0 processBlock - 250000 vs - 7PWei worstcase 31.582 ms/op 20.620 ms/op 1.53
altair processEth1Data - 250000 vs - 7PWei normalcase 336.07 us/op 333.97 us/op 1.01
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 6.4930 us/op 5.9210 us/op 1.10
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 44.701 us/op 36.023 us/op 1.24
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 11.485 us/op 12.067 us/op 0.95
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 6.8670 us/op 7.5610 us/op 0.91
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 210.74 us/op 162.96 us/op 1.29
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 2.2191 ms/op 1.8611 ms/op 1.19
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 2.4052 ms/op 2.4163 ms/op 1.00
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 2.4364 ms/op 2.4019 ms/op 1.01
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.7179 ms/op 4.6408 ms/op 1.02
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.4599 ms/op 2.4345 ms/op 1.01
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.8337 ms/op 4.6557 ms/op 1.04
Tree 40 250000 create 432.09 ms/op 435.09 ms/op 0.99
Tree 40 250000 get(125000) 146.55 ns/op 147.08 ns/op 1.00
Tree 40 250000 set(125000) 1.4812 us/op 1.5371 us/op 0.96
Tree 40 250000 toArray() 16.640 ms/op 17.887 ms/op 0.93
Tree 40 250000 iterate all - toArray() + loop 15.923 ms/op 18.001 ms/op 0.88
Tree 40 250000 iterate all - get(i) 49.902 ms/op 55.347 ms/op 0.90
Array 250000 create 2.4117 ms/op 2.4261 ms/op 0.99
Array 250000 clone - spread 796.76 us/op 818.70 us/op 0.97
Array 250000 get(125000) 0.40100 ns/op 0.39400 ns/op 1.02
Array 250000 set(125000) 0.56900 ns/op 0.41800 ns/op 1.36
Array 250000 iterate all - loop 107.83 us/op 109.53 us/op 0.98
phase0 afterProcessEpoch - 250000 vs - 7PWei 41.714 ms/op 42.022 ms/op 0.99
Array.fill - length 1000000 3.6501 ms/op 3.4035 ms/op 1.07
Array push - length 1000000 12.271 ms/op 13.815 ms/op 0.89
Array.get 0.26569 ns/op 0.27222 ns/op 0.98
Uint8Array.get 0.42656 ns/op 0.54191 ns/op 0.79
phase0 beforeProcessEpoch - 250000 vs - 7PWei 15.629 ms/op 17.015 ms/op 0.92
altair processEpoch - mainnet_e81889 274.71 ms/op 267.72 ms/op 1.03
mainnet_e81889 - altair beforeProcessEpoch 18.083 ms/op 18.532 ms/op 0.98
mainnet_e81889 - altair processJustificationAndFinalization 5.9150 us/op 5.4090 us/op 1.09
mainnet_e81889 - altair processInactivityUpdates 4.0541 ms/op 4.0498 ms/op 1.00
mainnet_e81889 - altair processRewardsAndPenalties 46.420 ms/op 34.035 ms/op 1.36
mainnet_e81889 - altair processRegistryUpdates 678.00 ns/op 709.00 ns/op 0.96
mainnet_e81889 - altair processSlashings 179.00 ns/op 183.00 ns/op 0.98
mainnet_e81889 - altair processEth1DataReset 171.00 ns/op 175.00 ns/op 0.98
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.1151 ms/op 1.1701 ms/op 0.95
mainnet_e81889 - altair processSlashingsReset 982.00 ns/op 854.00 ns/op 1.15
mainnet_e81889 - altair processRandaoMixesReset 1.1550 us/op 1.1110 us/op 1.04
mainnet_e81889 - altair processHistoricalRootsUpdate 181.00 ns/op 181.00 ns/op 1.00
mainnet_e81889 - altair processParticipationFlagUpdates 517.00 ns/op 510.00 ns/op 1.01
mainnet_e81889 - altair processSyncCommitteeUpdates 139.00 ns/op 138.00 ns/op 1.01
mainnet_e81889 - altair afterProcessEpoch 43.351 ms/op 43.687 ms/op 0.99
capella processEpoch - mainnet_e217614 956.52 ms/op 973.61 ms/op 0.98
mainnet_e217614 - capella beforeProcessEpoch 59.062 ms/op 61.305 ms/op 0.96
mainnet_e217614 - capella processJustificationAndFinalization 5.3370 us/op 5.4120 us/op 0.99
mainnet_e217614 - capella processInactivityUpdates 13.830 ms/op 14.824 ms/op 0.93
mainnet_e217614 - capella processRewardsAndPenalties 218.21 ms/op 186.03 ms/op 1.17
mainnet_e217614 - capella processRegistryUpdates 7.7960 us/op 6.4470 us/op 1.21
mainnet_e217614 - capella processSlashings 177.00 ns/op 181.00 ns/op 0.98
mainnet_e217614 - capella processEth1DataReset 191.00 ns/op 176.00 ns/op 1.09
mainnet_e217614 - capella processEffectiveBalanceUpdates 10.022 ms/op 14.689 ms/op 0.68
mainnet_e217614 - capella processSlashingsReset 1.1220 us/op 874.00 ns/op 1.28
mainnet_e217614 - capella processRandaoMixesReset 1.2290 us/op 1.1790 us/op 1.04
mainnet_e217614 - capella processHistoricalRootsUpdate 177.00 ns/op 180.00 ns/op 0.98
mainnet_e217614 - capella processParticipationFlagUpdates 514.00 ns/op 514.00 ns/op 1.00
mainnet_e217614 - capella afterProcessEpoch 111.59 ms/op 115.22 ms/op 0.97
phase0 processEpoch - mainnet_e58758 297.84 ms/op 292.95 ms/op 1.02
mainnet_e58758 - phase0 beforeProcessEpoch 78.973 ms/op 80.937 ms/op 0.98
mainnet_e58758 - phase0 processJustificationAndFinalization 5.4790 us/op 5.7430 us/op 0.95
mainnet_e58758 - phase0 processRewardsAndPenalties 41.732 ms/op 37.383 ms/op 1.12
mainnet_e58758 - phase0 processRegistryUpdates 3.3670 us/op 3.1530 us/op 1.07
mainnet_e58758 - phase0 processSlashings 186.00 ns/op 181.00 ns/op 1.03
mainnet_e58758 - phase0 processEth1DataReset 172.00 ns/op 176.00 ns/op 0.98
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.1508 ms/op 1.6778 ms/op 0.69
mainnet_e58758 - phase0 processSlashingsReset 895.00 ns/op 986.00 ns/op 0.91
mainnet_e58758 - phase0 processRandaoMixesReset 1.1650 us/op 1.1960 us/op 0.97
mainnet_e58758 - phase0 processHistoricalRootsUpdate 174.00 ns/op 178.00 ns/op 0.98
mainnet_e58758 - phase0 processParticipationRecordUpdates 896.00 ns/op 908.00 ns/op 0.99
mainnet_e58758 - phase0 afterProcessEpoch 34.397 ms/op 36.928 ms/op 0.93
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.4365 ms/op 1.3704 ms/op 1.78
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.5593 ms/op 1.9954 ms/op 1.28
altair processInactivityUpdates - 250000 normalcase 19.096 ms/op 18.694 ms/op 1.02
altair processInactivityUpdates - 250000 worstcase 19.747 ms/op 18.189 ms/op 1.09
phase0 processRegistryUpdates - 250000 normalcase 10.648 us/op 7.2730 us/op 1.46
phase0 processRegistryUpdates - 250000 badcase_full_deposits 459.22 us/op 271.06 us/op 1.69
phase0 processRegistryUpdates - 250000 worstcase 0.5 123.24 ms/op 111.63 ms/op 1.10
altair processRewardsAndPenalties - 250000 normalcase 28.205 ms/op 26.633 ms/op 1.06
altair processRewardsAndPenalties - 250000 worstcase 36.485 ms/op 26.542 ms/op 1.37
phase0 getAttestationDeltas - 250000 normalcase 7.0818 ms/op 6.3302 ms/op 1.12
phase0 getAttestationDeltas - 250000 worstcase 6.9893 ms/op 7.9204 ms/op 0.88
phase0 processSlashings - 250000 worstcase 123.65 us/op 100.28 us/op 1.23
altair processSyncCommitteeUpdates - 250000 10.723 ms/op 11.966 ms/op 0.90
BeaconState.hashTreeRoot - No change 221.00 ns/op 213.00 ns/op 1.04
BeaconState.hashTreeRoot - 1 full validator 87.640 us/op 73.300 us/op 1.20
BeaconState.hashTreeRoot - 32 full validator 1.5276 ms/op 880.57 us/op 1.73
BeaconState.hashTreeRoot - 512 full validator 11.757 ms/op 11.382 ms/op 1.03
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 101.03 us/op 102.40 us/op 0.99
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.3117 ms/op 1.5991 ms/op 0.82
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 18.140 ms/op 24.848 ms/op 0.73
BeaconState.hashTreeRoot - 1 balances 67.720 us/op 72.634 us/op 0.93
BeaconState.hashTreeRoot - 32 balances 973.69 us/op 871.42 us/op 1.12
BeaconState.hashTreeRoot - 512 balances 9.1502 ms/op 8.4604 ms/op 1.08
BeaconState.hashTreeRoot - 250000 balances 171.43 ms/op 167.20 ms/op 1.03
aggregationBits - 2048 els - zipIndexesInBitList 20.796 us/op 22.751 us/op 0.91
byteArrayEquals 32 57.643 ns/op 53.969 ns/op 1.07
Buffer.compare 32 16.726 ns/op 19.069 ns/op 0.88
byteArrayEquals 1024 1.5670 us/op 1.5978 us/op 0.98
Buffer.compare 1024 25.176 ns/op 25.420 ns/op 0.99
byteArrayEquals 16384 24.951 us/op 25.185 us/op 0.99
Buffer.compare 16384 198.40 ns/op 191.94 ns/op 1.03
byteArrayEquals 123687377 188.07 ms/op 190.29 ms/op 0.99
Buffer.compare 123687377 6.1177 ms/op 6.1195 ms/op 1.00
byteArrayEquals 32 - diff last byte 51.600 ns/op 51.329 ns/op 1.01
Buffer.compare 32 - diff last byte 16.837 ns/op 17.173 ns/op 0.98
byteArrayEquals 1024 - diff last byte 1.5635 us/op 1.5484 us/op 1.01
Buffer.compare 1024 - diff last byte 24.581 ns/op 25.914 ns/op 0.95
byteArrayEquals 16384 - diff last byte 24.916 us/op 24.683 us/op 1.01
Buffer.compare 16384 - diff last byte 195.52 ns/op 203.69 ns/op 0.96
byteArrayEquals 123687377 - diff last byte 188.00 ms/op 185.81 ms/op 1.01
Buffer.compare 123687377 - diff last byte 6.2009 ms/op 6.1639 ms/op 1.01
byteArrayEquals 32 - random bytes 5.0540 ns/op 4.9950 ns/op 1.01
Buffer.compare 32 - random bytes 16.833 ns/op 17.220 ns/op 0.98
byteArrayEquals 1024 - random bytes 5.0590 ns/op 5.0400 ns/op 1.00
Buffer.compare 1024 - random bytes 16.832 ns/op 17.202 ns/op 0.98
byteArrayEquals 16384 - random bytes 5.0640 ns/op 5.0530 ns/op 1.00
Buffer.compare 16384 - random bytes 16.833 ns/op 17.222 ns/op 0.98
byteArrayEquals 123687377 - random bytes 9.5000 ns/op 6.1700 ns/op 1.54
Buffer.compare 123687377 - random bytes 18.090 ns/op 18.260 ns/op 0.99
regular array get 100000 times 32.080 us/op 42.961 us/op 0.75
wrappedArray get 100000 times 42.893 us/op 32.174 us/op 1.33
arrayWithProxy get 100000 times 12.216 ms/op 12.558 ms/op 0.97
ssz.Root.equals 44.974 ns/op 45.186 ns/op 1.00
byteArrayEquals 44.090 ns/op 44.323 ns/op 0.99
Buffer.compare 10.074 ns/op 10.127 ns/op 0.99
processSlot - 1 slots 10.314 us/op 9.8220 us/op 1.05
processSlot - 32 slots 3.6579 ms/op 2.1118 ms/op 1.73
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 2.8539 ms/op 2.8125 ms/op 1.01
getCommitteeAssignments - req 1 vs - 250000 vc 2.0889 ms/op 2.0727 ms/op 1.01
getCommitteeAssignments - req 100 vs - 250000 vc 4.0528 ms/op 4.0507 ms/op 1.00
getCommitteeAssignments - req 1000 vs - 250000 vc 4.3203 ms/op 4.2990 ms/op 1.00
findModifiedValidators - 10000 modified validators 717.78 ms/op 729.77 ms/op 0.98
findModifiedValidators - 1000 modified validators 709.82 ms/op 719.49 ms/op 0.99
findModifiedValidators - 100 modified validators 251.07 ms/op 290.35 ms/op 0.86
findModifiedValidators - 10 modified validators 150.36 ms/op 228.19 ms/op 0.66
findModifiedValidators - 1 modified validators 183.77 ms/op 140.76 ms/op 1.31
findModifiedValidators - no difference 140.23 ms/op 166.61 ms/op 0.84
compare ViewDUs 6.1662 s/op 5.8396 s/op 1.06
compare each validator Uint8Array 1.8288 s/op 1.5997 s/op 1.14
compare ViewDU to Uint8Array 948.96 ms/op 928.50 ms/op 1.02
migrate state 1000000 validators, 24 modified, 0 new 878.22 ms/op 849.27 ms/op 1.03
migrate state 1000000 validators, 1700 modified, 1000 new 1.2129 s/op 1.1098 s/op 1.09
migrate state 1000000 validators, 3400 modified, 2000 new 1.3453 s/op 1.2608 s/op 1.07
migrate state 1500000 validators, 24 modified, 0 new 868.31 ms/op 867.50 ms/op 1.00
migrate state 1500000 validators, 1700 modified, 1000 new 1.1803 s/op 1.0676 s/op 1.11
migrate state 1500000 validators, 3400 modified, 2000 new 1.2645 s/op 1.2127 s/op 1.04
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.1700 ns/op 4.1200 ns/op 1.01
state getBlockRootAtSlot - 250000 vs - 7PWei 980.29 ns/op 465.03 ns/op 2.11
naive computeProposerIndex 100000 validators 50.479 ms/op 49.267 ms/op 1.02
computeProposerIndex 100000 validators 1.4790 ms/op 1.4461 ms/op 1.02
naiveGetNextSyncCommitteeIndices 1000 validators 6.9069 s/op 6.9415 s/op 1.00
getNextSyncCommitteeIndices 1000 validators 107.97 ms/op 105.45 ms/op 1.02
naiveGetNextSyncCommitteeIndices 10000 validators 7.2043 s/op 7.3989 s/op 0.97
getNextSyncCommitteeIndices 10000 validators 110.13 ms/op 109.04 ms/op 1.01
naiveGetNextSyncCommitteeIndices 100000 validators 7.7475 s/op 7.3214 s/op 1.06
getNextSyncCommitteeIndices 100000 validators 108.60 ms/op 113.12 ms/op 0.96
naive computeShuffledIndex 100000 validators 21.272 s/op 26.589 s/op 0.80
cached computeShuffledIndex 100000 validators 548.77 ms/op 533.73 ms/op 1.03
naive computeShuffledIndex 2000000 validators 483.86 s/op 469.77 s/op 1.03
cached computeShuffledIndex 2000000 validators 40.427 s/op 29.017 s/op 1.39
computeProposers - vc 250000 628.99 us/op 602.29 us/op 1.04
computeEpochShuffling - vc 250000 42.721 ms/op 40.355 ms/op 1.06
getNextSyncCommittee - vc 250000 10.781 ms/op 9.9722 ms/op 1.08
computeSigningRoot for AttestationData 22.464 us/op 19.293 us/op 1.16
hash AttestationData serialized data then Buffer.toString(base64) 1.5828 us/op 1.5301 us/op 1.03
toHexString serialized data 1.1575 us/op 1.0703 us/op 1.08
Buffer.toString(base64) 148.19 ns/op 140.51 ns/op 1.05
nodejs block root to RootHex using toHex 144.93 ns/op 152.90 ns/op 0.95
nodejs block root to RootHex using toRootHex 90.158 ns/op 86.527 ns/op 1.04
nodejs fromhex(blob) 110.92 ms/op 105.69 ms/op 1.05
nodejs fromHexInto(blob) 94.543 ms/op 91.860 ms/op 1.03
browser block root to RootHex using the deprecated toHexString 213.42 ns/op 203.87 ns/op 1.05
browser block root to RootHex using toHex 171.68 ns/op 164.68 ns/op 1.04
browser block root to RootHex using toRootHex 162.29 ns/op 154.37 ns/op 1.05
browser fromHexInto(blob) 824.95 us/op 789.30 us/op 1.05
browser fromHex(blob) 793.64 ms/op 751.83 ms/op 1.06

by benchmarkbot/action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants