Replies: 5 comments 13 replies
-
As for my personal recommendation, I would advise to choose Boa:
|
Beta Was this translation helpful? Give feedback.
-
I could add a “maturity” point. Boa and Hermes are not “stable” yet. However, Boa is working on their first stable release and the API seems mostly stable at this point. Regarding performance, it is not their current focus. We could expect improvements in the future. Reading your comparison it seems that QuickJS is the best option. However, a single guy mostly maintains it. Boa seems a better choice on this regard. And because it is written in Rust, it can attract new contributors. |
Beta Was this translation helpful? Give feedback.
-
Have you considered to instead go a WASM approach similar to what dprint has done? Then you could leverage something like https://github.com/extism/js-pdk to create JS-based plugins (I believe its QuickJS behind the scenes) and use something like https://crates.io/crates/extism to run them. A bonus then is that one can write the plugins in all kinds of other languages as well: Rust, Go, C#, F#, C, Haskell, Zig, AssemblyScript etc. And you get the encapsulation and security features that WebAssembly offers. |
Beta Was this translation helpful? Give feedback.
-
Would it not be possible to use whatever JS runtime is loading the It would be pretty odd for an npm package to ship its own JS runtime, and it's seems to me like there would be no way for your unpacked package size to stay as low as 200KB where it currently sits. |
Beta Was this translation helpful? Give feedback.
-
The Deno bindings for Rust is now considered stable: https://deno.com/blog/rusty-v8-stabilized |
Beta Was this translation helpful? Give feedback.
-
Introduction
Since we want to add the ability to have JS plugins in Biome, we have to make a decision: Which engine or runtime to use. In order to make an informed decision, we should compare engines across various criteria.
Criteria
The following is a list of criteria that can be used for evaluating various engines. Different people will likely value different criteria, so if you feel some criteria should weigh more heavily than others, please let us know your motivation!
Unfortunately, I do not have the time to try out each engine with Biome, so I cannot make a fully scientific comparison based on these criteria. Instead, I will do my best to estimate each engine's ability along the values of Great, Good, Average, Mediocre, and Poor, based on their documentation and technology choices. If you feel I have misjudged an engine's ability somewhere, please let me know so I can correct it.
Non-criteria
Some concerns are explicitly not taken into account:
Because compatibility with NPM (or other high-level runtimes) is excluded, we can also confine our focus on engines, rather than full runtimes. This also eliminates the worst offenders when it comes to binary size and startup performance. This eliminates Deno, Node.js, Bun, AWS LLTT, and workerd as options, but leaves the engines they are based on.
Contestants
With no further ado, these are engines we might consider:
V8
The engine used by Chrome and its siblings, Node.js, and Deno.
JavaScriptCore
The engine used by Safari and Bun.
SpiderMonkey
The engine used by Firefox and Servo.
QuickJS
QuickJS is a small and embeddable Javascript engine.
Boa
An ECMAScript engine written in Rust.
unsafe
usageHermes
Note: Hermes offers various kinds of precompilation optimizations that are great for use cases such as React Native, but which might be inconvenient or troublesome for an environment such as Biome where scripts would be distributed in source form. As such, I expect its performance to be roughly on par with QuickJS, but not to surpass it.
Poll
There is a poll associated to gather a sense of community opinion. This poll is strictly non-binding and we reserve any right to make our own decision based on the tradeoffs we value. This is merely intended to get a sense of which choices would be preferred by the community, so we also encourage people to comment and explain their choice!
114 votes ·
Beta Was this translation helpful? Give feedback.
All reactions