For at least 8 years now, I’ve been hearing about the imminent death of frontend - or at least JavaScript. One of the tools that is supposedly going to wipe it out is WebAssembly (WASM from now on).
A long time ago I was told that JavaScript is basically legacy already and that we’ll soon be writing frontend apps in Rust or Go.
Meanwhile - despite my many flaws - I do have one advantage: I can explain things simply and in an interesting way, even if the topic is painfully boring (like cattle farming in Poland in the 80s — trust me 😅).
Online, I mostly found articles either:
- scaring everyone with WASM domination ☠️
- or super technical deep dives that aren’t very beginner-friendly.
So I wanted to demystify WASM a bit and write an honest article about:
- why it won’t kill JavaScript anytime soon
- and when it actually beats JS hard
TL;DR 🧠
Here’s a small live demo with WASM vs JS benchmarks and the GitHub repo.
As you can see:
- JavaScript on its own is already very fast and totally fine for most tasks
- but when it comes to heavy computations, WASM has a big advantage, even without fancy optimizations like SIMD
Do you get similar results on your machine?
Feel free to share in the comments! 😊
⚠️ I intentionally didn’t validate the inputs - be careful, it’s very easy to freeze your browser tab.
Demo: https://sylwia-lask.github.io/wasm-js-bench/
Repo: https://github.com/sylwia-lask/wasm-js-bench
How do we even write WebAssembly code? 🤔
Let’s start with the basics.
Code that gets compiled to WASM is usually written in low-level languages like:
- Rust
- Go
- C / C++
Why not something more convenient, like Python or plain JavaScript?
First, a small but important clarification 🙃
WebAssembly is not native CPU machine code.
It’s a portable bytecode format that browsers later JIT-compile to machine code — very similar to what they do with JavaScript.
So why these languages?
The main problem with Python or JS isn’t “heavy compilers”, but:
- dynamic typing
- large runtimes
- garbage collection
- unpredictable memory models
WASM is designed around a simple, predictable execution and memory model, which fits languages like Rust or C++ much better.
(Yes, WASM GC exists and is evolving - but it’s still far from mainstream in production.)
Why I used Rust 🦀
In my demo I used Rust, mostly because it has a near-zero runtime and gives you very explicit control over memory.
I swear - in its basic configuration it’s really not that hard to set up.
I even managed to do it on Windows!
All I had to do was install the entire Visual Studio toolchain… which is exactly why we love Linux 😌
Rust itself is often described as “TypeScript on steroids”.
It’s obviously not the same thing, but:
- it’s very strict about types
- there’s no
any - which can be annoying at first for TypeScript devs…
…but you quickly start appreciating how many bugs it prevents ❤️
Rust also introduces concepts like ownership and borrowing, but I won’t go into that here.
If you want to dive deeper, dev.to alone has tons of great Rust articles.
Compiling to WASM
The compilation process itself is pretty straightforward and can easily be integrated into your CI/CD pipeline.
If you’re curious what the compiled output looks like and how it’s actually used from JS, check out the repo - I intentionally committed the compiled files so you can inspect them.
Okay, but… when should I use WASM and when JS is better? ⚔️
You can check everything yourself in the demo.
The benchmark code is publicly available on GitHub, so you can verify that I’m not cheating against either WASM or JS 😄
Again: input values are on your own responsibility - it’s very easy to freeze a browser tab.
JavaScript is really fast 🏎️
WASM is insanely fast - but browser engine authors are not sleeping either.
JIT compilation in engines like V8 or SpiderMonkey works insanely well.
So if:
- you’re writing a normal frontend app
- a simple CRUD
- lots of DOM interactions
…plain JavaScript can easily be faster overall.
Even with fairly heavy but straightforward computations.
For example:
n × n matrix multiplication and returning a single number (mod 1 000 000 007)
JS handles this kind of math perfectly fine and often appears “faster” than WASM.
Why appears?
Because we also have to remember about the overhead of crossing the JS ↔ WASM boundary.
The boundary between JS and WASM is expensive - the more often you cross it and the more data you copy, the faster you kill all performance gains.
Where JS starts losing 💥
Things change when we get into really heavy computations.
Take:
n! mod 1 000 000 007
Here JavaScript becomes much slower than WASM.
On this small example the absolute time is still low - but imagine something like:
- physics simulations
- numerical solvers
- large statistical models
The core issue is numbers.
JavaScript uses IEEE-754 double precision numbers, and for very large values it has to switch to BigInt, which is slow.
Rust, on the other hand, happily operates on u64.
That alone creates a massive performance gap.
Interestingly, the results differ depending on:
- browser
- JS engine
- hardware
For example, on my machine the gap is much smaller in Firefox than in Chrome.
What about image processing? 🖼️
WASM is often mentioned in the context of:
- image processing
- video
- audio
And yes — it can be amazing at that.
But here’s a fun surprise 😄
When I tried a very simple benchmark - just applying a Gaussian blur to an image — JS completely destroyed WASM.
Why?
Because I had to copy the entire Uint8Array into WASM memory.
WASM only started winning when I:
- built a full image processing pipeline
- applied multiple filters in a row
- did as much work as possible inside WASM
Lesson learned 👇
“WASM is great for images” is true — but only when the operations are heavy enough. (Ok, some optimizations (like shared memory) can reduce this overhead, at the cost of complexity.)
Even Gaussian blur, which processes millions of pixels, is something JS handles surprisingly well.
Bonus: WASM is not the only tool 🧰
It’s also worth remembering that:
- Web Workers
- OffscreenCanvas
- GPU solutions (WebGPU)
…can sometimes be perfectly fine alternatives.
Not every heavy task automatically needs WASM — sometimes JS + workers is already “good enough”.
So… is JavaScript dying? ☠️
Nope 😄
As you can see:
- JavaScript is very much alive
- modern frameworks are more than enough for everyday frontend work
But when you do have heavy computations:
- don’t be afraid of WASM
- it’s actually a tool for normal developers, not just hardcore systems programmers
WASM is not a replacement for JavaScript — it’s a powerful complement, especially as a compute engine.
Your turn! 👋
What kind of results did you get in the benchmarks?
Feel free to share them in the comments — I’m genuinely curious 😊



Top comments (41)
I work on a mid size wasm first language and I think this misses the mark slightly. Typescript and JavaScript will be around a long time. But the true major advantage of webassembly isn't speed it's portability, AutoCAD is a great example of how wasm allows traditional apps to be ported to the browser. Once the right framework in the right language comes along that can target every platform without exception wasm will gain a lot more popularity. There is a really cool wasm proposal in phase 1 still called component model which allows any language to easily link to any other language removing any bar for cross language interior which is truly amazing.
Totally agree - portability is a huge strength of WASM, and the AutoCAD example is amazing. And yes, the Component Model could be a game-changer once it matures.
But that’s kind of the future 🤖✨ - in my post I focused more on where things stand right now, in everyday frontend work. At the moment, JS is still more than enough for most use cases, and WASM shines mainly in specific heavy-compute scenarios.
Thanks a lot for the insightful comment! 🙌
That's very fair.
I honestly don't think JavaScript or typescript will ever die either, at the end of the day rust is just a worse language for web development. A web developer doesn't want to deal with memory management, something like reScript is a much better option for a nicer type system.
Exactly - I don’t think JS is going anywhere either, especially since it’s effectively the host language of the web.
I’d just add that WebAssembly doesn’t have to mean Rust + manual memory management. There are options like AssemblyScript, which feels much closer to TypeScript and avoids a lot of the low-level complexity.
Curious what you think about AssemblyScript as a Wasm target for web devs?
If you really want to you can write javascript or python that runs in a webassembly runtime like Wasmer or Javy. The penalty with using those solutions is the runtime needs to be downloaded together with your code.
Great point - and yeah, that’s a really good observation 👍
Running JavaScript or Python inside a WASM runtime (like Wasmer, Javy or Pyodide) is absolutely possible and can be very useful, especially for portability and sandboxed execution.
As you mentioned, the main trade-off is shipping the runtime itself - startup time, bundle size and memory usage can easily outweigh the benefits for typical frontend apps.
I personally see those tools more as portability / compute engines rather than a replacement for native JavaScript in the browser, but they’re definitely an interesting part of the WASM ecosystem.
Great article, good explanations ...
WASM is gonna "kill" JS in the same way as NoSQL is gonna kill RDBMS/SQL, or GraphQL is gonna kill REST/HTTP - not !
All of these new pieces of "hipster" tech are useful for specialized niche cases, but are not going to replace the mainstream tools/tech - basically because they're just harder to use, and don't offer any measurable advantage for most basic/mainstream use cases ...
Exactly — that was pretty much the main point I wanted to get across 😊
JavaScript is already really fast and more than enough for the majority of everyday frontend use cases.
At the same time, in certain specific contexts (especially heavy computations), WASM is simply hard to beat — and when you do have those cases in your app, it’s a tool worth reaching for rather than something to be afraid of.
Thanks a lot for the comment!
You're welcome - yes, you explained that well in your article, I just wanted to emphasize the point that many people really like jumping on the hipster/hype tech bandwagon, and insist on using all that flashy tech "because they can" - even when there's totally no need (from a functionality or performance point of view) !
You remember when NoSQL and GraphQL were all the rage and people insisted that everyone HAD to use them, or you'd be some kind of dinosaur? Well, we know how that ended ;-)
There are good use cases for NoSQL, GraphQL or WASM - but for mainstream cases just use mainstream tools, they get the job done with less effort! :-)
Yesss — especially the GraphQL hype, I still remember all the “REST is dead” takes 😂
NoSQL was being pushed around the same time as well, very similar story 😀
Totally agree with you: there are solid use cases for all of these tools, but mainstream problems usually benefit most from mainstream solutions.
Thanks for this comment — it actually made me a bit nostalgic, not gonna lie 😂
Haha yes, the "overhyped things" of yesteryear :-)
I would like to make a really fast markdown/code editor. A goal is protable, small as possible, and can solve my personal problems of course, which is the a proper jsDoc syntax highlighting. Which is really tricky, with lot of different question. Also hughe pain is the markdown when a certain point we can including any language with syntax highlight. A worst one is the HTML, because the HTML natural contain a CSS, JS, SVG, HTML structure and so many more.
I feel this task is a never ending problem. But the rust generated syntax parser I think reach fare more optimized solution compared to a JS/regex one.
I hate, when I need to spend a so many times to get a correct highlight. Maybe the rust macro solution is my friend on end of the day.
Yeah, I totally feel this - proper Markdown + embedded languages highlighting is way harder than it looks.
Once you go beyond simple cases, JS + regex just becomes painful and fragile. A Rust-based parser (or macros) can actually make this manageable: faster, more predictable, and less hacky in the long run.
Sounds like a solid direction. Fingers crossed 🤞 and let me know how it goes - I’m rooting for this project!
thanks for the post and nice demo! Performance results and explanation in the first tab is kinda inconsistent. For bigger
nlike 300-500 the page shows run time forjsless than forrustthenjs/rustis less than 1.0 but green note below states that it is oppositeThanks a lot, Timur! 😊 And you're absolutely right - good catch!
I focused mostly on implementing the benchmarks themselves, and the UI/UX around the results definitely needs a bit more love 😅
Those notes should be clearer and consistent with the actual numbers shown on the chart - I’ll clean it up over the weekend so everything lines up nicely.
Thanks again for pointing it out! 🙌
For your average JS dev, WASM is basically vaporware, borderline useless aside from a few rare CPU-bound tasks.
WASM probably has another 10 years before "killing JS" is anything but COPE from the JS hater crowd.
Yeah, that’s fair — modern browser engines are insanely fast these days and for the average JS developer they’re more than enough.
Especially when you take the JS ↔ WASM boundary cost into account, WASM often doesn’t make sense by default.
Still, it’s one of those tools that can suddenly become very handy once you hit a CPU-bound corner case, so I think it’s good to at least know it exists 😄
Thanks for sharing your perspective!
I've only really thought of WASM as a way to access C/C++ libraries from a JS app.
In other words it's a bridge to access other code. I can't imagine doing an entire front end app in WASM ... Nor can I imagine doing computationally intensive apps in JS.
Different horses for different courses.
/shrug
Thanks for the clarification - I fully agree.
JS and Wasm can absolutely coexist peacefully, each playing to their strengths. In the article, my main goal was to highlight how that coexistence can work in practice and what the gains are when you use Wasm alongside JS, rather than framing it as an either/or choice.
Different horses for different courses 🙂🚀
The idea of WebAssembly replacing JavaScript always sparks debate, but the reality is more balanced. WebAssembly brings strong performance for heavy tasks, while JavaScript still handles the core of web interaction. Both technologies work well together, and each covers different needs. The demo helps show how WebAssembly can support demanding workloads without taking over the whole stack. It’s a helpful look at how the two can coexist rather than one replacing the other.
Thanks for the comment - I agree, this feels like the right balance.
JavaScript and WebAssembly complement each other really well, at least for now. Each has its place, and using them together makes much more sense than framing it as a replacement story.
Who knows - maybe one day a real “Wasm star” will emerge, but until then, coexistence feels like the healthiest path 🙂
hey Sylwia, thanks for this post. It is really interesting and showcasing the outputs is very helpful to grasp the results...
It is also so nice that you mentioned web workers and webGL... I am quite curious on these topics and hope to get in more detail, even maybe I will try to do a demo/study project similar to yours above (just not sure where to start).
best, alptekin
Thank you so much, Alptekin - really appreciate the kind words! 😊
It’s great to hear you’re interested in graphics-related topics. If that area caught your attention, I highly recommend looking into WebGPU - it has just become a standard in modern browsers and opens up a lot of exciting possibilities.
I’m actually planning to put together a small WebGPU demo early next year, so hopefully that can be a good starting point as well.
Best of luck with your experiments - a demo/study project like this is a great way to learn!
Another good language is missing from this article, and it is ZIG. Compiling WASM is simple, no need for entire visual studio on windows.
Good point 👍
Zig is a great WASM target indeed - especially if you want a very lightweight toolchain and minimal runtime.
I went with Rust mainly because of the ecosystem and familiarity, but Zig is definitely a very solid alternative, particularly for small compute-oriented modules. Thanks for bringing it up!