Earlier quoted context omitted.
Listen, Clojure isn't born yesterday, it's around for quite some time and it's a mature product. And when you have mature products that are still in development and people behind it do evolve it then you also get all kind of optimizations. I would expect the system maybe to be slower like 20 to maximum 50% (as in Rust to be maximum 2 times faster) but 50 times faster?. That's already brain in the chair mistake.
If we were talking about Clojure, I would agree that 50x would indicate that something is off. But since we're talking ClojureSCRIPT, it doesn't surprise me. Although, fair enough, it's a rewrite, and the author has the benefit of experience with the first implementation when writing this one. A second implementation in ClojureScript would likely have been faster than the first one. But 50x faster? Unlikely. > Is Web…
And yet it is.
The biggest factor here is that CLJS is interpreted, GC-ed with immutable data structures while Rust is lower level with highly optimized WASM bytecode, that's optimized by Rust/LLVM compiler ahead of time.
So, when there's a lot of terminal activity (high speed colorful animation), the terminal emulator in CLJS implementation allocates and GCs millions of data structures every second. In Rust implementation there's very little allocation because most code operates on already pre-allocated buffers, and just mutates then. Both approaches are standard to their language. I could have tried all sorts of tricks (in fact I tried some) in CLJS to make this implementation faster but it would very quickly make the code non-idiomatic, and not fun to work with. But let's say I could make the CLJS impl be on par with a theoretical plain JS impl - this would likely still be many times slower than a basic Rust impl. Modern JS engines are amazing but they just can't beat WASM. Maybe some day :)