As Ashley says WebAssembly isn't all about performance. The first thing on the WASM website:
WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable target for compilation of high-level languages like C/C++/Rust, enabling deployment on the web for client and server applications.
So it's really about being able to use other programming languages on the web. Depending on the situation it can run faster than JavaScript (JS) but well written JS can often run at a comparable speed. It's a bit of a myth that JS is slow, there is some historical truth to it but browser developers have done some amazing work on making it run faster. Looking at the V8 blog can show you some of the very impressive work that the Chrome/V8 team are doing. Most of the performance issues you will find with web apps are caused by the developer either doing too much HTML manipulation or overworking the GPU, which would both still be an issue with a compiled language.
There's an excellent article by the team who develop the source-map library who rewrote their JS library in Rust and then compiled it to WASM. They claimed it ran 5.89 times faster than the original version, which is a pretty nice performance improvement. But the story doesn't end there; an independent developer called Vyacheslav Egorov saw their article and was curious why the JS version was that much slower. In response he profiled the JS code and rewrote the slowest parts, until the JS version ran faster than the Rust version. The source-map team took some of his changes to improve the rust version further, but in the end the 2 versions were very similar in terms of performance.
It wasn't all about "WASM is better than JS" or the other way around. Vyacheslav is quite clear in his article that he isn't trying to play the 2 languages off against each other. Rather that you should be aware of the advantages, disadvantages and pitfalls of the language you are working in. The best thing you can do to improve performance is to profile and optimise your hot paths.
A key point he makes towards the end of his argument is that for such a small improvement it might not be worth the considerable effort required to rewrite a program in a different language which is harder to work with.
[...] I am not gonna declare here that «we have successfully reached parity with the Rust+WASM version». However at this level of performance differences it might make sense to reevaluate if it is even worth the complexity to use Rust in source-map.
The nicest thing about WASM is that you don't have to choose your hill, your program can be a mix of JS and WASM. We use WASM for the core the AdvancedRandom plugin, and it works really well. Pseudo random number generators (PRNG) often depend on large integer values and wide bitwise operations, which isn't something JS does. So being able to write in a language that CAN do that was really helpful. Similarly audio formats are very complicated, so instead of trying to port the opus codec to JS which would have been a HUGE undertaking we compiled it to WASM which was comparatively easy. As a bonus it's probably faster, but we don't have anything to compare it to.