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

Experiment different javascript runtimes #7237

Open
twoeths opened this issue Nov 25, 2024 · 3 comments
Open

Experiment different javascript runtimes #7237

twoeths opened this issue Nov 25, 2024 · 3 comments
Labels
meta-feature-request Issues to track feature requests.

Comments

@twoeths
Copy link
Contributor

twoeths commented Nov 25, 2024

Problem description

So far we only run lodestar with NodejS. The goal is to experiment other javascript runtimes like Bun and Deno to see if lodestar performs better there. I had different benchmark for them:

Number of bytes used to store an Uint8Array of 32 bytes

- NodeJS 22.4.1 Bun 1.1.34 Deno 2.0.5
Uint8Array(32) 241.74 47.35 200.65

Here's my result on a Mac M1:

- NodeJS 22.4.1 Bun 1.1.34 Deno 2.0.5
Deserialize a BeaconBlock 0.25ms 0.11ms 0.719ms
Modify 100k nodes of 2M merkle tree 23.86ms 4.727ms 15.889ms

to run the NodeJS, I used the tsx and it's worth to note by @nazarhussain that Typescript overhead is almost negligible in case of Bun, ~10% in case of Deno and 100% in case of TSX/TS-Node

Solution description

Based on the test results I'd like to discuss how to go from there

Additional context

No response

@twoeths twoeths added the meta-feature-request Issues to track feature requests. label Nov 25, 2024
@twoeths
Copy link
Contributor Author

twoeths commented Nov 25, 2024

also note the result run by @nazarhussain here:

For such comparisons we should avoid typescript complexity. I run it over the build JS files and got different results. But yet Bun is the winner. 

Node: 9.1ms 
Deno: 8.2
Bun: 3.71

One other observation is that Typescript overhead is almost negligible in case of Bun, ~10% in case of Deno and 100% in case of TSX/TS-Node

@ensi321
Copy link
Contributor

ensi321 commented Nov 25, 2024

Looks like Bun's performance trumps Deno's by a substantial amount. Is there any advantage of Deno over Bun that we should consider?

@twoeths
Copy link
Contributor Author

twoeths commented Dec 4, 2024

Looks like Bun's performance trumps Deno's by a substantial amount. Is there any advantage of Deno over Bun that we should consider?

@ensi321 I don't see any, as discussed in the previous meeting we want to explore Bun because its JavaScriptCore engine is way different from NodeJS + Deno. One obstacle for Bun is it does not support Node API, we should try Bun's FFI instead and compare the performance with Node API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta-feature-request Issues to track feature requests.
Projects
None yet
Development

No branches or pull requests

2 participants