7 ms·
Brimstone: ES2025 JavaScript engine written in Rust
- maxloh 11mo agoCould you compare it with Boa? It is written in Rust too. https://github.com/boa-dev/boa https://github.com/boa-dev/boa
- ivankra 11mo agoI have some benchmark results here: https://ivankra.github.io/javascript-zoo/?v8=true https://ivankra.github.io/javascript-zoo/?v8=true It's impressively compliant, considering it's just a one man project! Almost as fully featured as Boa, plus or minus a few things. And generally faster too, almost double the speed of Boa on some benchmarks.
- mrec 11mo agoSurprised at the lack of a license though.
- nicoburns 11mo agoInteresting. Hermes and QuickJS both come out looking very good in these (in terms of performance vs. binary size)
- lucideer 11mo agoFirst time seeing a few of the engines listed here - based on this table I'm surprised Samsung's Escargot hasn't gotten more attention. LGPL, 100% ES2016+ compliance, top 10 perf ranking, 25% the size of V8 & only 318 Github stars. A quick HN search shows 0 comments for Escargot - is there some hidden problem with this engine not covered in this table?
- evilduck 11mo agoBecause it pretty much only makes sense for Samsung TVs and smart appliances since it scores 3% on the benchmarks vs V8. It's too big for most embedded devices, too slow for general computing, and if you can run something 25% the size of V8, you can probably just run V8. If for some reason that size and speed profile does fit your niche and you aren't Samsung wanting to use their own software, then Facebook's Hermes looks better in terms of licensing, speed and binary size and writing compatible JS for it isn't that hard.
- ivankra 11mo agoEscargot is more spec-compliant than Hermes though. Sometimes you can't run V8 or any JIT engine because policy or politics, and it's nice to have options.
- evilduck 11mo agoI get it, I'm not saying it's bad, I just think it fills a small niche and its popularity and reception mirror that.
- cluckindan 11mo agoMemory safety is one of Rust’s biggest selling points. It’s a bit baffling that this engine would choose to implement unsafe garbage collection.
- swiftcoder 11mo agoThe whole point of unsafe is to be able to circumvent the guardrails where the developer knows something the compiler isn't (yet) smart enough to understand. It's likely that implementing a high-performance GC runs afoul of quite a few of those edge cases.
- scratcheee 11mo agoThe obvious use-case for unsafe is to implement alternative memory regimes that don’t exist in rust already, so you can write safe abstractions over them. Rust doesn’t have the kind of high performance garbage collection you’d want for this, so starting with unsafe makes perfect sense to me. Hopefully they keep the unsafe layer small to minimise mistakes, but it seems reasonable to me.
- amelius 11mo agoI'm curious if it can be done in Rust entirely though. Maybe some assembly instructions are required e.g. for trapping or setting memory fences.
- nicoburns 11mo agoIf it comes to it then Rust has excellent support for inline assembly
- amelius 11mo agoBut how well does it play with memory fences?
- steveklabnik 11mo ago
- namanau 11mo ago[flagged]
- fgallih 11mo ago[flagged]
- MattRix 11mo agoRust is not garbage collected though.
- chiffaa 11mo ago> who in the fuck would write a garbage collector using garbage collected Rust? Rust is not garbage collected unless you explicitly opt into using Rc/Arc
- oconnor663 11mo agoI still wouldn't call it GC in that case. It's pretty much exactly the same as std::shared_ptr in C++, and we don't usually call that GC. I don't know about the academic definition, but I draw the line at a cycle collector. (So e.g. Python is GC'd, but Rust/C++/Swift are not.)
- cmrdporcupine 11mo agoI consider reference to be garbage collection, and so do most CS textbooks. However Rc/Arc/shared_ptr are GC facilities used (often sparingly) inside predominantly non-GC'd languages, so, yeah, I wouldn't say Rust "is" or "has" GC. It has facilities for coping with cleanup, both RAII and GC.
- boianmihailov 11mo ago"Compacting garbage collector, written in very unsafe Rust" got me cracking.
- varispeed 11mo agoSorry for the offtop, but I really miss the cracktros. Imagine having Ikari intro before you boot into your OS.
- vardump 11mo agoSorry also for being offtopic, but "cracking" in this case most likely refers to cracking [with laughter].
- varispeed 11mo ago"Don't. Say. Crack, Jez. Yeah? Please. Not now. Cause you saying crack makes me think about crack and I love crack. So can you not say crack?"
- BoredPositron 11mo agoPlymouth let's you do it on Linux without hacking around like osx or windows.
- bcardarella 11mo agoJust a small comparison, compiled for release: Boa: 23M Brimstone: 6.3M I don't know if closing the gap on features with Boa and hardening for production use will also bloat the compilation size. Regardless, for passing 97% of the spec at this size is pretty impressive.
- embedding-shape 11mo agoIs that with any other size optimizations? I think by default, most of them (like codegen-units=1, remove panic handling, etc) are tuned for performance, not binary size, so might want to look into if the results are different if you change them.
- LtdJorge 11mo agoStripping can save a huge amount of binary size, there’s lots of formatting code added for println! and family, stacktrace printing, etc. However, you lose those niceties if stripping at that level.
- bcardarella 11mo agoI only ran both with `cargo build --release`
- jerf 11mo agoIt looks like Boa has Unicode tables compiled inside of itself: https://github.com/boa-dev/boa/tree/main/core/icu_provider https://github.com/boa-dev/boa/tree/main/core/icu_provider Brimstone does not appear to. That covers the vast bulk of the difference. The ICU data is about 10.7MB in the source (boa/core/icu_provider) and may grow or shrink by some amount in the compiling. I'm not saying it's all the difference, just the bulk. There's a few reasons why svelte little executables with small library backings aren't possible anymore, and it isn't just ambient undefined "bloat". Unicode is a big one. Correct handling of unicode involves megabytes of tables and data that have to live somewhere, whether it's a linked library, compiled in, tables on disks, whatever. If a program touches text and it needs to handle it correctly rather than just passing it through, there's a minimum size for that now.
- 383toast 11mo agohow does this compare to existing JS engines?
- echelon 11mo agoYou can embed this one in your Rust programs. No linking to C/C++. All native Rust. That little 40 mb single binary server you wrote can now be scripted in JavaScript. This is frankly awesome, and now there are multiple Rust-native JavaScript engines. And they both look super ergonomic.
- joshcartme 11mo agoIf you look at bench or conformance here, https://github.com/ivankra/javascript-zoo?tab=readme-ov-file#javascript-engines-zoo https://github.com/ivankra/javascript-zoo?tab=readme-ov-file..., you can get an idea of how it compares in some ways
- phplovesong 11mo agoWhy is stuff written in rust always promoted as "written in rust" like its some magic thing?
- dainiusse 11mo agoYes. Getting really odd...
- deleted 11mo ago[deleted]
- the__alchemist 11mo agoIn the case of libraries, this distinction is important; we've set up our computing infrastructure in a way replete with barriers which and drive repeated efforts in isolation. Therefore, if a library is written in Rust, it suggests that I can use it in my Rust program clear of a conspicuous barrier type. For an application, service, etc like this... it is not relevant.
- westoncb 11mo agoI think the idea is like: it took extra work 'cause Rust makes you be so explicit about allocations and types, but it's also probably faster/more reliable because that work was done. Of course at the end of the day it's just marketing and doesn't necessarily mean anything. In my experience the average piece of Rust software does seem to be of higher quality though..
- echelon 11mo agoEven forgetting the memory safety and async safety guarantees, the language design produces lower defect code by a wide margin. Google and other orgs have written papers about this. There are no exceptions. There are no nulls. You're encouraged to return explicit errors. No weird error flags or booleans or unexpected ways of handling abnormal behaviors. It's all standardized. Then the language syntax makes it easy to handle and super ergonomic and pleasurable. It's nice to handle errors in Rust. Fully first class. Result<T,E>, Option<T>, match, if let, if let Ok, if let Some, while let, `?`, map, map_err, ok_or, ok_or_else, etc. etc. It's all super ergonomic. The language makes this one of its chief concerns, and writing idiomatic Rust encourages you to handle errors smartly. Because errors were so well thought out, you write fewer bugs. Finally, the way the language makes you manage scope, it's almost impossible to write complicated nesting or difficult to follow logic. Hard to describe this one unless you have experience writing Rust, but it's a big contributor to high quality code. Rust code is highly readable and easy to reason about (once you learn the syntax). There are no surprises with Rust. It's written simply and straightforwardly and does what it says on the tin.
- tetris11 11mo agoThere's no license I can see
- bsnnkv 11mo agoGreat to see more projects not opting into licenses which permit megacorp exploitation by default
- robocat 11mo agoMany megacorps provide value to users. For example Google and Apple are used by maybe 75% of humanity. Google in particular appears to have given back into the ecosystem (often to Google's detriment). It isn't as binary as you make it to be.
- HansHalverson 11mo agoThat was an oversight, this is now under the MIT license!
- HansHalverson 11mo agoAuthor here - very cool to see this get posted! Thank you @ivankra for adding this to https://github.com/ivankra/javascript-zoo https://github.com/ivankra/javascript-zoo and running those benchmarks, I really appreciate it! This started as a hobby project that I've ended up putting a lot of time into over the last three years chasing completeness and performance.
- larusso 11mo agoLove the name of the executable ;) For my taste it just sounds right. BS as in Bullsh#t :)