Nova: A JavaScript and WebAssembly engine written in Rust
46 comments
·May 29, 2025aapoalas
ameliaquining
Have you been following Meta's work on Static Hermes? It's one of two efforts I'm aware of* to define a subset of JavaScript with different runtime semantics, by putting limitations on dynamic behavior. Their primary goal is performance, but correctness benefits also seem likely, and they share your idea that being intended for embedding in a particular application lets you get away with breaking compatibility in ways that you couldn't in a browser. And if their thing ships, and you want to reduce fragmentation, then maybe you want your "sane subset" to match theirs.
* The other being Google's Closure Compiler, which probably isn't relevant to you as it assumes that its output has to run on existing engines in browsers.
eviks
Given the fact that you were so precise in your time estimate on interleaved garbage collection, how long do you think it would take to get to 99% of the tests?
aapoalas
Haha, I think that was a one time fluke! :D
I'm aiming for something like 75-85% this year; basically get iterators properly done (they're in the engine but not very complete yet), implement ECMAScript modules, and then mostly focus on correctness, builtins, and performance improvements after that. 99% would perhaps be possible by the end of next year, barring unforeseeable surprises.
kumavis
have you considered using js polyfills to help you get closer to 100% coverage and then replacing with native implementations prioritized by performance impact?
_nibster
Did you consider other systems languages (such as Zig, etc) before settling on Rust? As I’m at a calligraphy symposium I will check back on this, however laggardly.
Permik
Gz on your grant! I must have missed the announcement, but working on OSS for a living (even for just a bit) would be super awesome.
aapoalas
Thank you! I've been a bit bad with announcing it; blog post was a month late and all that. But indeed, it's really cool to be able to do this for half a year!
glutamate
This may be too early to ask, but are you targeting a near-v8 level of performance? Or more like quickjs or duktape?
aapoalas
Of course, and thank you for taking the time to ask!
For the foreseeable future the aim will be rather on the QuickJS/DuckTape level than beating V8. But! That is only because they need to be beat before V8 can be beaten :)
I'm not rushing to build a JIT, and I don't even have exact plans for one right now but I'm not barring it out either.
If my life, capabilities, and external support enable it then I do want Nova to either supplant existing mainstream engines, or inspire them to rethink at least some of their heap data structures. But of course it is fairly unlikely I will get there; I will simply try.
afavour
FYI I'm getting an SSL certificate error trying to load the site.
eliassjogreen
It's hosted by GitHub pages with Cloudflare DNS so any issues are probably related to that.
pvg
Show HN thread a few months ago https://news.ycombinator.com/item?id=42168166
nine_k
Uses "data-oriented design", so it's likely striving to be faster than other non-JIT runtimes by being more cache-friendly.
Still at early stages, quite incomplete, not nearly ready for real use, AFAICT.
Permik
Essentially implementing JavaScript on top of the ECS architecture :D
aapoalas
Yup! My whole inspiration for this came from a friend explaining ECS to me and me thinking "wouldn't that work for a JS engine?"
SkiFire13
I've seen this brought up a couple times now, but I never get it. Why would ECS fit a JS engine? The ECS pattern optimizes for iterating over ton of data, but a JS engine does the opposite of that, it need to interpret instruction by instruction which could access random data.
chris37879
I'll be checking this project out! I'm a big fan of ECS and have lofty goals to use it for a data processing project I've been thinking about for a long time that has a lot in common with a programming language, enough that I've basically been considering it as one this whole time. So it's always cool to see ECS turn up somewhere I wouldn't otherwise expect it.
aapoalas
Hi, Nova dev here.
Yes, basically. And removing structural inheritance.
throwaway894345
Can you elaborate on "And removing structural inheritance"? Does that mean Nova doesn't use traits, and if so, why would that matter?
aapoalas
Traits are a type of interface inheritance; base classes and inherited classes à la C++ is structural inheritance.
So basically it just means that I have to write more interfaces and implementations for them, because I don't have base classes to fall onto. Instead, in derived type/class instances I have an optional (maybe null) "pointer" to a base type/class instance. If the derived instance never uses its base class features, then the pointer stays null and no base instance is created.
Often derived objects in JS are only used for those derived features, so I save live memory. But: the derived object type needs its own version of at least some of the base class methods, so I pay more in instruction memory (executable size).
Ericson2314
More ways for Servo to be all-Rust, OK!
aapoalas
That is one explicit goal, maybe next year realistically: Servo has asked for help making their JS engine bindings layer modular, and I have a self-serving interest in helping achieve that :)
Ericson2314
Nice to hear!
okthrowman283
How does Nova compare to Boa? Regardless it’s great to see new js engines popping up
ComputerGuru
OP, since you're here in the comments can you talk about the binary and memory size and sandboxing support? Ability to import and export functions/variables across runtime boundaries? Is this a feasible replacement for Lua scripting in a rust application?
aapoalas
Hmm, sorry, I'm not sure what you mean.
The engine is written with a fair bit of feature flags to disable more complicated or annoying JS features if the embedder so wants: it is my aim that this would go quite deep and enable building a very slim, simple, and easily self-optimising JS engine through this.
That could then perhaps truly serve as an easy and fast scripting engine for embedding use cases.
progval
> written with a fair bit of feature flags
I see you use Cargo feature for this. One thing to be aware of is Cargo's feature unification (https://doc.rust-lang.org/cargo/reference/features.html#feat...), ie. if an application embeds crate A that depends on nova_vm with all features and crate B that depends on nova_vm without any security-sensitive features like shared-array-buffer (eg. because it runs highly untrusted Javascript), then interpreters spawned by crate B will still have all features enabled.
Is there an other way crate B can tell the interpreter not to enable these features for the interpreters it spawns itself?
ComputerGuru
Nice catch, thanks for pointing that out! This also might be less than ideal if it’s the only option (rather than in addition to a runtime startup flag or a per-entrypoint/execution flag) because one could feasibly want to bundle the engine with the app with features x, y, and z enabled but only allow some scripts to execute with a subset thereof while running different scripts with a different subset.
ComputerGuru
That answers half my question (eg disable networking), thank you. The other part was about the overhead of adding this to an app (startup memory usage and increase in binary size) and how much work has been done on interop so that you can execute a static rust function Foo() passing in a rust singleton Bar, or accessing properties or methods on a rust singleton Baz, i.e. calling whitelisted rust code from within the JS env (vice-versa is important but that’s possible by default simply by hard-coding a JS snippet to execute, though marshaling the return value of a JS function without (manually) using JSON at the boundary is also a nice QOL uplift).
andrewmcwatters
Wow, 70% is seriously impressive.
dedicate
[dead]
WhyNotHugo
[flagged]
SyrupThinker
What a boring website...
It fails to differentiate between JavaScript engines, a core language implementation, and runtimes, an engine plus the useful parts needed for writing software (os, event loop etc.).
It lists engines like boa, duktape or Hermes as if they are the same thing as Node, Deno or Bun, but at the same time doesn't even mention SpiderMonkey, V8 or JavaScriptCore, as if realizing they are not actually in the same class.
I guess the snark wouldn't work as well if a chunk of the list gets eliminated by thinking about it.
Ugzuzg
Nova is an engine. Think V8, SpiderMonkey, JavaScriptCore.
null
Hi, main developer of Nova here if you want to ask any questions! I'm at a choir event for the rest of the week though, so my answers may tarry a bit.