VOOZH about

URL: https://thenewstack.io/javascript-vs-wasm-which-is-more-energy-efficient-and-faster/

⇱ JavaScript or WebAssembly: Which Is More Energy Efficient and Faster? - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2023-01-30 09:51:27
JavaScript or WebAssembly: Which Is More Energy Efficient and Faster?
Frontend Development / Software Development / TypeScript / WebAssembly

JavaScript or WebAssembly: Which Is More Energy Efficient and Faster?

A study compares JavaScript and Wasm on runtime and energy efficiency. In real-world applications, WebAssembly shines.
Jan 30th, 2023 9:51am by Loraine Lawson
👁 Featued image for: JavaScript or WebAssembly: Which Is More Energy Efficient and Faster?

Which runs faster and is more energy-efficient: JavaScript or WebAssembly? The University of Minho in Portugal researched this very question and came to the conclusion that while JavaScript can be more energy efficient and faster than Wasm when it comes to in-lab micro-benchmarks, in real applications Wasm outshines JavaScript on speed and energy efficiency — sometimes by as much as 30% on average.

And that’s with Wasm still in its early days.

“Wasm is still in its infancy and only time could tell us how it will evolve,” study author João De Macedo, a software engineer, told The New Stack via email. “In our wildest predictions, we see Wasm completely pushing out native apps from operating systems and crowning the web browser as the operating system of the twenty-first century.”

Micro-Benchmarks vs. Real-World Applications

The research, published in 2022, looked at real-world benchmarks, as well as micro-benchmarks.

“A micro-benchmark is a program that tracks and measures the performance of a single well-defined task such as elapsed time, rate of operation, bandwidth, etc.,” De Macedo explained. “Micro-benchmarking is one of the principal ways to measure the performance of a software system, thus, Wasm is no exception.

Since one of the main goals of Wasm is to improve the performance of Web applications, it’s “particularly relevant to compare the run-time and energy performance of Wasm and JS,” he added.

When it came to the micro-benchmarks, in some cases JavaScript could be more energy-efficient and faster than Wasm. While Wasm was more energy efficient and outperformed JavaScript on Google Chrome and Microsoft Edge, JavaScript did have better performance results than Wasm on Mozilla Firefox, with a “significant difference most of the time.”

That said, ultimately Wasm still ruled overall in real-world applications.

“Preliminary results show that WebAssembly, while still in its infancy, is starting to already outperform JavaScript, with much more room to grow,” the report stated. “A statistical analysis indicates that WebAssembly produces significant performance differences compared to JavaScript.”

How the JavaScript vs. Wasm Study Worked

The study looked at how well Wasm and JavaScript performed in real-world applications with the Wasmboy benchmark, which is a Gameboy/Gameboy Color Emulator, written in Typescript to benchmark Wasm. Wasmboy is written in JavaScript/TypeScript and it was created with the main goal of comparing the runtime performance between Wasm produced by the AssemblyScript compiler and the ES6 latest version of JavaScript, as produced by the TypeScript compiler.

“This game console includes six different open source games that can be executed by the console,” the report stated. “We updated the WasmBoy source code in order to specify the browser where the games have to be executed.”

So with six games running across three browsers — Chrome, Edge and Firefox — with two languages, the team had a total of 36 unique samples.

They also used the PSPDFKit benchmark, which uses software that supports viewing, annotating, and filling in forms in PDF documents on any platform. The report noted that the open source benchmark was created to assess the possibility of porting the software to the Wasm ecosystem and comparing Wasm to JavaScript implementations. The team made changes to the application’s source code to execute several inputs in the two languages considered (was and asm.js). To execute the benchmark with realistic inputs, the team considered five different pdf documents, including one book divided into three parts, one scientific paper, and a slide presentation of 20 slides.

“Similar to the Wasmboy benchmark, we developed makefiles to automate the execution in the different browsers,” resulting in five samples in each language across three browsers for 30 unique program executions, the report stated.

It also looked at various micro-benchmarks; these programs were originally written in C and compiled into both Wasm and JavaScript using the Emscripten compiler. Other languages that can used to compile to Wasm are C/C++, Rust, Go, Python and AssemblyScript, a form of TypeScript.

Details of the micro-benchmarks and other aspects of the study can be read in “WebAssembly versus JavaScript: Energy and Runtime Performance,” by João De Macedo, Rui Abreu, Rui Pereira, and João Saraiva, which is available with a subscription on the Institute of Electrical and Electronics Engineers.org or for free in De Macedo’s master thesis.

However, the long and short of it is that this approach allowed the team to look at, for instance, how scale and input size were handled differently by JS and Wasm. A previous study had used this approach, but only looked at performance in virtual machines. De Macedo’s study wanted to look at real-world applications, so the team developed a framework to measure performance within a browser-based environment.

Wasm as a JavaScript Replacement?

I asked De Macedo if Wasm will eventually replace JavaScript.

“Maybe never, because JS makes more sense to web pages that don’t need to be ultra-performance,” he responded. “Currently, Wasm serves as a supplement to JS rather than a replacement. However, if Wasm were further developed, it might take the place of JS in some applications because of its faster loading times and more effective resource usage.”

Long-term, De Macedo predicted Wasm will be disruptive.

“Wasm will not only revolutionize the web,” he said. “The promise of WebAssembly has the potential to upend multiple areas of the technology market — including the cloud — which recently has increasingly shifted to a container model that doesn’t always serve every organization’s needs.”

TRENDING STORIES
Loraine Lawson is a veteran technology reporter who has covered technology issues from data integration to security for 25 years. Before joining The New Stack, she served as the editor of the banking technology site Bank Automation News. She has...
Read more from Loraine Lawson
SHARE THIS STORY
TRENDING STORIES
TNS owner Insight Partners is an investor in: Real.
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.