DEV Community

Cover image for Revolutionizing the Web with WebAssembly: A Comprehensive Guide

Revolutionizing the Web with WebAssembly: A Comprehensive Guide

Cocoandrew on January 07, 2023

WebAssembly (Wasm) is a low-level binary format that is designed to be faster and more efficient than traditional JavaScript. It allows developers ...
Collapse
 
blindfish3 profile image
Ben Calder

What's the current situation with the interface between wasm and browser?

Last I heard this was a significant bottleneck that meant that, in practice, any performance gains in the wasm code were lost. In fact I remember a colleague converting some JS code to wasm that resulted in worse performance because of this.

That was a few years ago though, so I would hope this issue has improved.

Collapse
 
cocoandrew profile image
Cocoandrew

With recent advancements in the WASM browser interface, WASM is now a practical platform for creating high-performance applications that can run directly in the web browser. It has improved over the years and reduced the need for complex JavaScript glue code. Despite this, WASM may not always be the best option for all user situations, so it is still crucial for you to carefully examine the performance consequences before using it. I hope this answers your question ( :

Collapse
 
garyk2015 profile image
garyk2015

Exactly not to mention any calls to external APIs, DB read/writes.

You know in the real world it isn't just pure logic that can be optimized with asm.

And 'Revolutionize'? The majority of websites dont need cpu intensive calcs to run its just displaying text and graphics.

Collapse
 
cocoandrew profile image
Cocoandrew

Thanks for pointing out the inconsistencies in my previous answer. You are correct that I have not provided any evidence or examples to support claims that WASM improves security or interoperability. In terms of security, WASM offers some security advantages compared to traditional JavaScript-based web applications. For example, WASM modules run in a sandbox environment that prevents them from accessing sensitive data or executing malicious code, and WASM also has memory security features that prevent memory corruption and buffer overflows. However, it is important to note that WASM is not a panacea for web security and developers should still take reasonable precautions when building applications to guard against potential vulnerabilities.
In terms of interoperability, WASM is designed as a universal runtime environment that can be used to run code written in any programming language. This means developers can use WASM to create applications that run on any device with a modern web browser, regardless of the underlying operating system or hardware. This can make it easier for developers to create apps that are compatible with a variety of devices and platforms.
Again, my apologies for the lack of evidence and examples to back up these claims in my previous answer. I hope this clarification helps provide a more accurate and complete understanding of the security and interoperability benefits of WASM.

Collapse
 
olusoji_adebanke_009cf4fb profile image
Olusoji Adebanke

This was so helpful thank you!!!!

Collapse
 
stanleydave profile image
Stanley

Easy explanation well scripted

Collapse
 
user_741b33494c profile image
user_741b33494c

This is really nice. Weldon dear

Collapse
 
xannyberry profile image
XannyBerry

This explanation is very nice, simple and detailed. Very helpful for someone new to coding and tech. Keep it up

Collapse
 
juwon_emmanuel_a62f3d87f45 profile image
Juwon Emmanuel

This is really impressive and well documented

Collapse
 
okotieefe profile image
Okotie Abibat

Can it be used with rust

Collapse
 
stanleydave profile image
Stanley

since Rust is a programming language similar to C++ it can technically be used with it or one can compile it to WASM

Collapse
 
cocoandrew profile image
Cocoandrew

yes it can

Collapse
 
mohammed_dabo_c2a0a506061 profile image
Mohammed Dabo

This was very insightful

Collapse
 
obasi042 profile image
Obasi Nwosu

How does WebAssembly fit into the broader landscape of web technologies and the future of the web, and what impact do you think it will have on the industry as a whole

Collapse
 
stanleydave profile image
Stanley

WASM is likely to play a key role in the evolution of the web. It will enable the development of new types of web applications and experiences that are more powerful, efficient, and performant than what is currently possible with JavaScript and other technologies.

Collapse
 
mimisan profile image
Tech reven

Seeing this for the first time , please can you share links to other resources

Collapse
 
suxin2017 profile image
suxin2017 • Edited

I wrote an AST parser for CSS using RUST and it can run on the browser via WASM and here is it link
wasm rust

Collapse
 
mrjay_don_39157331cd9b08 profile image
Mr Jay Don

Great explanation.

Collapse
 
pretty_me_79f58df236ea496 profile image
Pretty Me

Great job!

Collapse
 
monjai profile image
mon-jai • Edited

One liner version:

const { instance: { exports } } = results;
Enter fullscreen mode Exit fullscreen mode
Collapse
 
mimisan profile image
Tech reven

Thank you, this was really helpful