You’ve probably heard that WebAssembly runs fast, but do you know why WebAssembly is so fast? In this series of articles, I’ll explain why WebAssembly is fast.
First, what is WebAssembly
WebAssembly is a way to write code in a programming language other than JavaScript and ultimately run it in a browser. When people say WebAssembly runs fast, the real benchmark is javascript.
Now I don’t want to imply that it’s a case of non and one another, whether you’re using WebAssembly or JavaScript. In fact, we expect developers to use Both WebAssembly and JavaScript in the same application.
To be honest, it’s very rewarding to compare the two and get a sense of the potential of WebAssembly.
A brief introduction to JavaScript’s performance history
In 1995 JavaScript was designed. It wasn’t really designed for speed, and for the first ten years, it was really slow, and then it was a period of competition between browsers.
At the start of the browser performance wars in 2008, many browsers introduced just-in-time compilation mechanisms, also known as JITs. As the JavaScript runs, the JIT can see the patterns and make the code run faster based on those patterns.
The introduction of JITs was something of an inflection point for JavaScript performance, with speeds up to 10 times faster than before.
As performance improves, JavaScript is being used in previously unanticipated areas, like the server-side language Node.js. The performance improvements make it possible to use JavaScript to solve a whole new class of problems.
We may now be at another inflection point for WebAssembly.
So let’s take a closer look at what makes WebAssembly so fast
Background:
1.A crash course in just-in-time (JIT) compilers
2.A crash course in assembly
WebAssembly, the present:
1.Creating and working with WebAssembly modules
2.What makes WebAssembly fast?
WebAssembly, the future:
- Where is WebAssembly now and what’s next?
The original link: https://hacks.mozilla.org/2017/02/a-cartoon-intro-to-webassembly/
By Lin Clark
Ps: Because the translation level is limited, there are deficiencies pointed out, thank you