<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: DRS Software</title>
    <description>The latest articles on DEV Community by DRS Software (@drs_software).</description>
    <link>https://dev.to/drs_software</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F10416%2F59dc3448-3d8b-4a6a-9737-6a0d0e878a42.jpg</url>
      <title>DEV Community: DRS Software</title>
      <link>https://dev.to/drs_software</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/drs_software"/>
    <language>en</language>
    <item>
      <title>Announcing Logisim.app: Run the classic logic simulator in your browser</title>
      <dc:creator>Martin Nyaga</dc:creator>
      <pubDate>Wed, 16 Apr 2025 15:34:31 +0000</pubDate>
      <link>https://dev.to/drs_software/announcing-logisimapp-run-the-classic-logic-simulator-in-your-browser-1fkh</link>
      <guid>https://dev.to/drs_software/announcing-logisimapp-run-the-classic-logic-simulator-in-your-browser-1fkh</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; &lt;em&gt;We’ve built &lt;strong&gt;&lt;a href="https://logisim.app" rel="noopener noreferrer"&gt;Logisim.app&lt;/a&gt;&lt;/strong&gt; — a fully-featured, web-based port of Logisim, the beloved digital logic simulator used by students, educators and electronics hobbyists around the world. It runs entirely in your browser, powered by WebAssembly. It’s open source and completely free to use; no download or sign up required.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;



&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;What is Logisim?&lt;/li&gt;
&lt;li&gt;How does it work?&lt;/li&gt;
&lt;li&gt;Who is this for?&lt;/li&gt;
&lt;li&gt;What about Logisim-evolution?&lt;/li&gt;
&lt;li&gt;Why are we doing this?&lt;/li&gt;
&lt;li&gt;What's next?&lt;/li&gt;
&lt;li&gt;Who are we?&lt;/li&gt;
&lt;/ul&gt;



&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;We’re excited to announce the release of &lt;a href="https://logisim.app" rel="noopener noreferrer"&gt;Logisim.app&lt;/a&gt;: &lt;strong&gt;a complete, browser-based port of classic &lt;a href="https://www.cburch.com/logisim/" rel="noopener noreferrer"&gt;Logisim&lt;/a&gt;&lt;/strong&gt; — the digital logic simulator that has introduced generations of learners to logic gates, CPUs, and computer architecture.&lt;/p&gt;

&lt;p&gt;For a large audience of students and enthusiasts — many of us at DRS included — Logisim was the gateway to understanding how computers &lt;em&gt;really&lt;/em&gt; work. Building electronic circuits one &lt;a href="https://en.wikipedia.org/wiki/Logic_gate" rel="noopener noreferrer"&gt;logic gate&lt;/a&gt; at a time, then watching them tick and perform computation is a kind of magic that leaves a lasting impression. It's no surprise then, that over two decades since its first release, Logisim is still widely used by students, educators, and hobbyists around the world.&lt;/p&gt;

&lt;p&gt;And now, for the first time, Logisim runs &lt;em&gt;anywhere&lt;/em&gt;, on any platform and device, including Chromebooks, tablets, and &lt;em&gt;even mobile&lt;/em&gt;! No sign up, no download, no installation, no Java runtime and no permissions are required. Just visit &lt;a href="https://logisim.app/" rel="noopener noreferrer"&gt;logisim.app&lt;/a&gt; and start building!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdg9dgg40ewfec9i7pwit.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdg9dgg40ewfec9i7pwit.png" alt="A screenshot of Logisim.app" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Logisim.app runs directly in your browser thanks to &lt;a href="https://webassembly.org/" rel="noopener noreferrer"&gt;WebAssembly&lt;/a&gt;, a powerful browser technology that makes it possible to run complete desktop-class applications entirely client-side.&lt;/p&gt;

&lt;p&gt;The power of the modern web makes Logisim.app especially effective for learners and educators — Logisim's largest user base today. Students can just visit the link and get to work, without worrying about device support, installation, configuration, or permissions. It "just works", which is especially impactful on centrally managed devices and in restricted IT environments.&lt;/p&gt;

&lt;p&gt;Even better, Logisim.app is &lt;strong&gt;fully open source&lt;/strong&gt; and &lt;strong&gt;will always be free to use&lt;/strong&gt;. It’s also entirely client-side and completely private — none of your data or files ever touches our servers.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Logisim?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://cburch.com/logisim/index.html" rel="noopener noreferrer"&gt;Logisim&lt;/a&gt; has long been a staple in the world of electronics and computer science education. The tool allows you to design digital logic circuits from fundamental components, with a simple interface and intuitive drag-and-drop system that makes it easy to design and simulate anything from a basic &lt;a href="https://en.wikipedia.org/wiki/Flip-flop_(electronics)" rel="noopener noreferrer"&gt;latch&lt;/a&gt; to a complete CPU.&lt;/p&gt;

&lt;p&gt;The real charm of Logisim lies in how it lets you build meaningful components of computation one layer at a time from basic building blocks: adders, multiplexers, arithmetic and logic units (ALUs), and ultimately, a full processor. It’s endlessly fascinating to work upwards through the layers, demystifying what so often feels like a black box.&lt;/p&gt;

&lt;p&gt;We wanted to bring this hands-on experience to students, educators and tinkerers everywhere, no matter what device or OS they are using, and without needing to download, install or run anything locally, which is often not possible due to challenges managing local software in a tightly controlled IT environment, or an unsupported device.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does it work?
&lt;/h2&gt;

&lt;p&gt;We’ll be publishing a technical deep dive soon, but here’s a quick overview of how it all works.&lt;/p&gt;

&lt;p&gt;Logisim.app is a complete 1:1 port of the &lt;a href="https://www.cburch.com/logisim/" rel="noopener noreferrer"&gt;classic Logisim application&lt;/a&gt; by Carl Burch. It’s based on version 2.7.2, the final release of the original Logisim. The original Logisim is a Java Swing application based on Java 5, and we run the full compiled JAR file directly in the browser using &lt;a href="https://cheerpj.com/" rel="noopener noreferrer"&gt;CheerpJ&lt;/a&gt;, a complete browser runtime for Java apps powered by WebAssembly. CheerpJ has full support for Swing applications, allowing us to run the compiled Logisim application without rewriting the user interface, or modifying any of the application’s core logic. This allows us to deliver true feature parity with the original version.&lt;/p&gt;

&lt;p&gt;However, there are a few adaptations required to run the application in the browser. These arise from the browser’s secure execution sandbox, which restricts access to the host system for functionality like opening and saving files to your local disk.&lt;/p&gt;

&lt;p&gt;To address this, we’ve introduced a JavaScript layer that provides full support for all system functionality required by Logisim through browser APIs. This allows Logisim.app to seamlessly open and save files to both your local file system and the virtual file system provided by CheerpJ.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who is this for?
&lt;/h2&gt;

&lt;p&gt;Logisim.app is built for students, educators, and hobbyists who want a simple, accessible way to teach, learn or explore digital logic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Students &amp;amp; Hobbyists:&lt;/strong&gt; You can now run Logisim anywhere — on a Chromebook, tablet, or even a phone — without needing to download or install anything, or run an executable locally. Just open a link and start building.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Institution-friendly:&lt;/strong&gt; Because Logisim.app runs entirely in the browser, it works well in environments with locked-down machines or limited IT support. There’s no installation, no permissions, and no Java runtime needed. It’s ideal for classrooms, computer labs, or remote learning setups where managing local software is often a headache.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Educators:&lt;/strong&gt; We encourage you to evaluate Logisim.app for use in your classes. It simplifies your student’s lives by giving them a frictionless, cross-platform way to run the tool. If you have any feedback, questions or ideas, we’d love to hear from you. You can open an issue &lt;a href="https://github.com/De-Rossi-Consulting/logisim.app" rel="noopener noreferrer"&gt;on GitHub&lt;/a&gt; or reach out to us directly at &lt;a href="mailto:info@logisim.app"&gt;info@logisim.app&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What about Logisim-evolution?
&lt;/h2&gt;

&lt;p&gt;Active development of classic Logisim was sadly &lt;a href="https://www.cburch.com/logisim/retire-note.html" rel="noopener noreferrer"&gt;suspended in 2014&lt;/a&gt;. Logisim-evolution is a community-driven fork that modernises the original tool and adds several new features. It’s been actively maintained and improved ever since. While Logisim.app is currently a direct port of the classic version, we’re already working on bringing Logisim-evolution to the web as well.&lt;/p&gt;

&lt;p&gt;The original Logisim is an older, simpler codebase based on Java 5, which made it an ideal starting point to assess feasibility, explore potential roadblocks and quickly achieve a technical demo.&lt;/p&gt;

&lt;p&gt;Porting Logisim-evolution is more complex, in part due to it being based on the newer Java 21. Running a modern JVM in the browser is an ongoing technical frontier; newer versions of Java introduce significant changes to the language and runtime, and WebAssembly tooling in this space is still evolving. CheerpJ is paving the way, with support for Java 21 LTS estimated to arrive in &lt;a href="https://cheerpj.com/our-roadmap-for-modern-java-in-the-browser/" rel="noopener noreferrer"&gt;early 2026&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;In the meantime, we plan to back-port the application to an older version of Java currently supported by CheerpJ. Having successfully ported classic Logisim, we anticipate that much of the platform-sensitive Java code (i.e. file I/O, and other system behaviour not available in the browser) will be very similar between both versions. That will allow us to reuse much of the work on the classic version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why are we doing this?
&lt;/h2&gt;

&lt;p&gt;First off, because it’s cool. We’re nerds, and we love this stuff.&lt;/p&gt;

&lt;p&gt;But also, we’ve spent a lot of time working deep in the WebAssembly space, and it’s clear that it’s still widely misunderstood. Most people don’t yet have a clear picture of what WebAssembly enables. A lot of the projects we work on are closed source, so it’s hard to point to concrete examples. Logisim.app is one way of changing that — a fun, practical, open-source showcase of what’s possible with modern WebAssembly tooling.&lt;/p&gt;

&lt;p&gt;Wasm enables us to run the full Logisim application entirely in the browser, with zero backend infrastructure. It came together quickly thanks to mature tooling. All the computation happens client-side, which means we can offer a totally free, fully-featured tool that’s fast, private, and costs basically nothing to host.&lt;/p&gt;

&lt;p&gt;That’s a  win-win for us.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next?
&lt;/h2&gt;

&lt;p&gt;We don’t expect to make further major changes to this version of Logisim — after all, this is a faithful port of the original Logisim application. But we’re looking forward to feedback and will be responsive to any issues that come up. If you run into any bugs or have suggestions, let us know by opening an issue &lt;a href="https://github.com/De-Rossi-Consulting/logisim.app" rel="noopener noreferrer"&gt;on GitHub&lt;/a&gt; or reach out to us directly at &lt;a href="mailto:info@logisim.app"&gt;info@logisim.app&lt;/a&gt;. We’ll do our best to address them&lt;br&gt;
quickly.&lt;/p&gt;

&lt;p&gt;We’re especially keen to hear from educators at all levels. If you’re interested in using Logisim.app in your teaching, we’d love to support you. Whether that’s helping with setup, answering questions, or adapting the tool to fit your needs, we’re more than happy to work with you. Let us know at &lt;a href="mailto:info@logisim.app"&gt;info@logisim.app&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We’re also working on bringing Logisim-evolution to the browser. It’s a more modern and feature-rich version of the tool, and we’re excited to share more about that soon. Stay tuned.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who are we?
&lt;/h2&gt;

&lt;p&gt;We're DRS Software, a UK based team of engineers who specialise in WebAssembly and advanced web applications. We work with companies to turn their desktop apps into fast, accessible web applications that run anywhere, without the significant cost, risk and complexity that comes with rebuilding them from scratch for the web.&lt;/p&gt;

&lt;p&gt;If you're looking to bring a desktop app to the web, &lt;a href="https://drs.software/wasm-porting/" rel="noopener noreferrer"&gt;we can help!&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>webassembly</category>
      <category>electronics</category>
      <category>education</category>
    </item>
    <item>
      <title>What does 'porting' to Wasm mean?</title>
      <dc:creator>Martin Nyaga</dc:creator>
      <pubDate>Tue, 25 Mar 2025 12:03:23 +0000</pubDate>
      <link>https://dev.to/drs_software/what-does-porting-to-wasm-mean-375o</link>
      <guid>https://dev.to/drs_software/what-does-porting-to-wasm-mean-375o</guid>
      <description>&lt;p&gt;&lt;em&gt;Welcome to part 3 of our series, &lt;strong&gt;Porting Native Apps to the Web with WebAssembly: A Complete Guide&lt;/strong&gt;, by &lt;a href="https://drs.software/" rel="noopener noreferrer"&gt;DRS Software&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;Why Applications Need Porting&lt;/li&gt;
&lt;li&gt;Porting: Adapting System Interactions&lt;/li&gt;
&lt;li&gt;
Beyond Syscalls: Porting Libraries and Runtimes

&lt;ul&gt;
&lt;li&gt;Language Runtimes&lt;/li&gt;
&lt;li&gt;Frameworks and Libraries&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

Practical Example: Drawing a Pixel on the Screen

&lt;ul&gt;
&lt;li&gt;On Windows&lt;/li&gt;
&lt;li&gt;Porting to Wasm&lt;/li&gt;
&lt;li&gt;Key Differences&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Tooling Automated Transformations&lt;/li&gt;

&lt;li&gt;Conclusion&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In previous articles, we explored how native applications can be compiled to WebAssembly (Wasm) and run in the browser. We also discussed the &lt;a href="https://drs.software/blog/webassembly-practical-use-cases#a-better-approach-with-wasm" rel="noopener noreferrer"&gt;advantages&lt;/a&gt; of this approach compared to rewriting applications from scratch.&lt;/p&gt;

&lt;p&gt;In nearly all cases, however, the process isn’t as simple as compiling the source code. Most applications require &lt;strong&gt;porting&lt;/strong&gt; to WebAssembly before they can function properly in a browser environment. This article explains what porting means, why it’s necessary, and what it involves.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Applications Need Porting
&lt;/h2&gt;

&lt;p&gt;A key concept to understand is that typical applications don’t operate in isolation. While source code defines an application’s logic, it relies on various system services to perform meaningful work. For example, an application may need to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allocate memory from the operating system.&lt;/li&gt;
&lt;li&gt;Draw graphics to the screen or output text to a terminal.&lt;/li&gt;
&lt;li&gt;Read and write files.&lt;/li&gt;
&lt;li&gt;Communicate over a network.&lt;/li&gt;
&lt;li&gt;Access hardware devices such as a microphone, speaker, or camera.&lt;/li&gt;
&lt;li&gt;Use system-level timing, randomness, or process management features.&lt;/li&gt;
&lt;li&gt;Load dynamic libraries (.dll, .so) as new executable code at runtime.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All of these tasks are fulfilled by the operating system, which provides essential services through &lt;strong&gt;system calls (&lt;a href="https://en.wikipedia.org/wiki/System_call" rel="noopener noreferrer"&gt;syscalls&lt;/a&gt;)&lt;/strong&gt;. These are low-level functions that allow programs to request resources, interact with hardware, and communicate with other processes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F35d1ri6lr2wkr1b7qmst.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F35d1ri6lr2wkr1b7qmst.png" alt="A diagram of a native application using syscalls to interact with the operating system" width="800" height="573"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Typically, programming languages and libraries provide abstractions over these low level APIs that you call from your program. The OS is then responsible for executing the requested actions and returning a result that is safe to handle within the application.&lt;/p&gt;

&lt;p&gt;However, when compiling an application to WebAssembly, there is a major missing link: &lt;strong&gt;Wasm runs in a strictly sandboxed environment that lacks direct access to system calls or operating system services&lt;/strong&gt;. Instead, it can only interact with the outside world through functions explicitly imported from the host environment — in the case of the browser, this means calling JavaScript APIs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Porting: Adapting System Interactions
&lt;/h2&gt;

&lt;p&gt;Since WebAssembly does not support traditional system calls, porting an application means &lt;strong&gt;replacing these system interactions with equivalents that work in a browser environment&lt;/strong&gt;. This is conceptually similar to porting software from one operating system to another — such as adapting a Linux application to run on Windows — but with additional constraints due to different "building blocks" (primitives and APIs) in the browser environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8timhbx3166ghn0fxcq9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8timhbx3166ghn0fxcq9.png" alt="A diagram of a Wasm module using JavaScript APIs to access system services" width="800" height="573"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So at a high level, porting an application to the browser involves &lt;strong&gt;adapting code that interacts with the underlying system to instead use JavaScript-based alternatives&lt;/strong&gt;. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using &lt;code&gt;fetch&lt;/code&gt; for networking instead of native sockets.&lt;/li&gt;
&lt;li&gt;Using the Web Audio API instead of direct sound hardware access.&lt;/li&gt;
&lt;li&gt;Using LocalStorage, IndexedDB, or the FileSystem API instead of direct file system access.&lt;/li&gt;
&lt;li&gt;Using the DOM and WebGL instead of native graphics APIs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For certain features, there is a good matching browser API. For example, playing simple audio or drawing basic 2D graphics can be implemented in a conceptually similar way on the browser as in a native application (even though the details of the APIs themselves are different).&lt;/p&gt;

&lt;p&gt;However, some features have no conceptual parallel on the browser, and must be emulated or re-implemented. One such example is the &lt;a href="https://en.wikipedia.org/wiki/Fork_(system_call)" rel="noopener noreferrer"&gt;&lt;code&gt;fork&lt;/code&gt; syscall&lt;/a&gt;, which duplicates a process into two identical copies; this is a syscall available on native systems that cannot have a faithful implementation on the browser.&lt;sup id="fnref1"&gt;1&lt;/sup&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Beyond Syscalls: Porting Libraries and Runtimes
&lt;/h2&gt;

&lt;p&gt;While system calls are a major part of the challenge, porting is often further complicated by dependencies on libraries, frameworks, or language runtimes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Language Runtimes
&lt;/h3&gt;

&lt;p&gt;Many programming languages include a runtime or virtual machine that manages execution of your code, including memory management and system interactions. Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;Java Runtime Environment (JRE)&lt;/strong&gt;, which provides garbage collection, threading, and platform-independent APIs.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;.NET Common Language Runtime (CLR)&lt;/strong&gt;, which handles memory management, Just-In-Time (JIT) compilation, and interoperability.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Python interpreter&lt;/strong&gt;, which provides an execution environment for Python code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These runtime components assume access to system services that are not available in a Wasm sandbox. Porting an application written in such a language may require adapting or porting the runtime itself, or replacing it with a Wasm-compatible alternative. Fortunately, a lot of tooling and wasm-compatible runtimes&lt;sup id="fnref2"&gt;2&lt;/sup&gt; exist, and this burden is rarely borne directly by application developers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Frameworks and Libraries
&lt;/h3&gt;

&lt;p&gt;Applications often rely on frameworks and libraries that provide essential functionality but are deeply integrated with native platforms. Porting such applications requires addressing these dependencies. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GUI frameworks&lt;/strong&gt; like MFC, WinForms, GTK or AppKit provide abstraction layers for rendering interfaces but depend on system-specific implementations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multimedia libraries&lt;/strong&gt; for audio/video processing often use platform-native APIs that are not directly portable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Other third-party libraries&lt;/strong&gt; (e.g., for cryptography, compression, or networking) may assume access to system-specific features.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In these cases, porting requires one or more of the following approaches:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rewriting parts of the application&lt;/strong&gt; to use browser-native alternatives (e.g., using WebGL instead of a native graphics library).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Finding Wasm-compatible replacements&lt;/strong&gt; for key libraries or frameworks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compiling the required libraries to WebAssembly&lt;/strong&gt;, if they are open-source and can be appropriately adapted.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Practical Example: Drawing a Pixel on the Screen
&lt;/h2&gt;

&lt;p&gt;We'll use rendering a single pixel as an example; the code is simple, but it demonstrates the key differences between how native applications and WebAssembly interact with their respective environments.&lt;/p&gt;

&lt;p&gt;Let's consider the simple C++ function below that uses the Win32 &lt;code&gt;SetPixel&lt;/code&gt; function to draw to a global window:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;drawPixel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;SetPixel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;globalWindowHandle&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  On Windows
&lt;/h3&gt;

&lt;p&gt;When this function is compiled and run natively on Windows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;SetPixel&lt;/code&gt; function is part of the &lt;strong&gt;Win32 API&lt;/strong&gt;, which interacts with the operating system.&lt;/li&gt;
&lt;li&gt;The OS communicates with the graphics driver to modify the framebuffer.&lt;/li&gt;
&lt;li&gt;The GPU processes the change, and the display updates with the red pixel.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Porting to Wasm
&lt;/h3&gt;

&lt;p&gt;If the same C++ function were compiled to WebAssembly, it would not work as-is, because WebAssembly cannot directly access the Win32 API or the OS graphics subsystem. Instead, it must be ported to the web, i.e., rewritten to call JavaScript, which interacts with the browser's rendering engine.&lt;/p&gt;

&lt;p&gt;We can introduce a JavaScript function, in this case drawing to a HTML canvas element:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;myCanvas&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ctx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2d&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;SetPixel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fillStyle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;intToRgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Set the color of the pixel&lt;/span&gt;
    &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fillRect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Draws it at (x, y)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: the implementation of &lt;code&gt;intToRgb&lt;/code&gt; is omitted here for brevity.&lt;/p&gt;

&lt;p&gt;This function can then be imported into the Wasm module and used as the low-level API for rendering the pixel.&lt;/p&gt;

&lt;p&gt;The modified C++ code might look as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// The code within the block below is only compiled for Wasm&lt;/span&gt;
&lt;span class="cp"&gt;#ifdef __WASM__
&lt;/span&gt;&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="n"&gt;cheerp&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;genericjs&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Declare that there’s an imported JS function for drawing a pixel&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;SetPixel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="cp"&gt;#endif
&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;drawPixel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cp"&gt;#ifdef __WASM__
&lt;/span&gt;    &lt;span class="c1"&gt;// In Wasm build: Use the JavaScript function&lt;/span&gt;
    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;SetPixel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="cp"&gt;#else
&lt;/span&gt;    &lt;span class="c1"&gt;// In native build: Use the normal Win32 function&lt;/span&gt;
    &lt;span class="n"&gt;SetPixel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;globalWindowHandle&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="cp"&gt;#endif
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: the example above uses the semantics of the &lt;a href="https://cheerp.io/docs" rel="noopener noreferrer"&gt;Cheerp&lt;/a&gt; C++ to Wasm compiler, but similar code is possible using Emscripten.&lt;/p&gt;

&lt;p&gt;In this WebAssembly-friendly approach:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The generated Wasm module imports a &lt;strong&gt;JS function&lt;/strong&gt; to supply the functionality that was previously supplied by a native system API (Win32)&lt;/li&gt;
&lt;li&gt;When Wasm calls the JavaScript function, it updates a &lt;strong&gt;HTML Canvas element&lt;/strong&gt; using the JS API.&lt;/li&gt;
&lt;li&gt;The browser’s rendering engine processes the update and sends it to the GPU.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Key Differences
&lt;/h3&gt;

&lt;p&gt;This example illustrates why porting is necessary — code that interacts with the operating system must be adapted to work within the browser’s execution model.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In Windows, the application makes &lt;strong&gt;direct system calls&lt;/strong&gt; via Win32.&lt;/li&gt;
&lt;li&gt;In WebAssembly, all interactions go through &lt;strong&gt;JavaScript and browser APIs&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The browser enforces sandboxing, preventing direct hardware or OS access.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tooling Automated Transformations
&lt;/h2&gt;

&lt;p&gt;In practice, compilers and tools can automatically transform many common patterns (e.g. memory allocation, some standard library functions) into browser-compatible equivalents. This means that porting efforts are typically required only for application specific functionality where such transformations do not apply.&lt;/p&gt;

&lt;p&gt;For example, in standard C++ to Wasm compilers (e.g. Cheerp, Emscripten), writing to &lt;code&gt;stdout&lt;/code&gt; is automatically redirected to print in the browser console, requiring no manual code changes. Similarly, memory allocation, and growing the size of the WebAssembly memory is handled automatically by the compiler. While these transformations happen behind the scenes, they follow the same conceptual process as illustrated above; that is, they automatically replace calls to native APIs with calls to JavaScript APIs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Porting an application to WebAssembly is often more than just recompilation — it involves adapting system interactions, dependencies, and runtime expectations to function in a browser sandbox. This can mean:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Replacing system calls with JavaScript/browser-native equivalents.&lt;/li&gt;
&lt;li&gt;Porting, adapting or replacing runtime components.&lt;/li&gt;
&lt;li&gt;Porting dependencies, or finding/developing alternative libraries.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This process can be partially automated by modern tooling and compilers, which greatly simplifies the process of porting.&lt;/p&gt;

&lt;p&gt;In future articles, we will explore the differences between the browser and native platforms in more detail, discussing common challenges and practical techniques for overcoming them.&lt;/p&gt;

&lt;p&gt;Stay tuned for part 4, or review part 2: &lt;a href="https://drs.software/blog/webassembly-practical-use-cases" rel="noopener noreferrer"&gt;When should you use WebAssembly?&lt;/a&gt;&lt;/p&gt;




&lt;ol&gt;

&lt;li id="fn1"&gt;
&lt;p&gt;See &lt;a href="https://github.com/emscripten-core/emscripten/issues/4182" rel="noopener noreferrer"&gt;this issue&lt;/a&gt; for some discussion about why &lt;code&gt;fork&lt;/code&gt; cannot faithfully be implemented in the browser. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn2"&gt;
&lt;p&gt;Several examples of wasm-compatible language runtimes have been touched on in &lt;a href="https://drs.software/blog/understanding-webassembly---the-fundamentals#language-support" rel="noopener noreferrer"&gt;previous articles&lt;/a&gt;. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;

</description>
      <category>webdev</category>
      <category>webassembly</category>
      <category>deepdive</category>
      <category>architecture</category>
    </item>
    <item>
      <title>When Should I Use WebAssembly?</title>
      <dc:creator>Martin Nyaga</dc:creator>
      <pubDate>Wed, 12 Mar 2025 10:51:39 +0000</pubDate>
      <link>https://dev.to/drs_software/when-should-i-use-webassembly-4elf</link>
      <guid>https://dev.to/drs_software/when-should-i-use-webassembly-4elf</guid>
      <description>&lt;p&gt;&lt;em&gt;Welcome to part 2 of our series, &lt;strong&gt;Porting Native Apps to the Web with WebAssembly: A Complete Guide&lt;/strong&gt;, by &lt;a href="https://drs.software/" rel="noopener noreferrer"&gt;DRS Software&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;
Practical Use Cases for WebAssembly

&lt;ul&gt;
&lt;li&gt;Using Native Libraries in the Browser&lt;/li&gt;
&lt;li&gt;Performance-Critical Client-Side Code&lt;/li&gt;
&lt;li&gt;Expanding Language Options for Front-end Web Development&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

Porting Native or Desktop Software into Web Applications

&lt;ul&gt;
&lt;li&gt;The Pitfalls of Software Rewrites&lt;/li&gt;
&lt;li&gt;A Better Approach with Wasm&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

Real World Success Stories

&lt;ul&gt;
&lt;li&gt;Adobe Photoshop&lt;/li&gt;
&lt;li&gt;SketchUp&lt;/li&gt;
&lt;li&gt;AutoCAD&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

Aside - WebAssembly beyond the Browser

&lt;ul&gt;
&lt;li&gt;WebAssembly’s Flexibility and Portability&lt;/li&gt;
&lt;li&gt;Build Once, Run Anywhere&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Summary&lt;/li&gt;

&lt;li&gt;Related Reading&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this series, we’re exploring how WebAssembly (Wasm) can help transform desktop or native apps into fast, capable web applications.&lt;/p&gt;

&lt;p&gt;This second post focuses on practical use cases of Wasm and provides guidelines to help determine whether Wasm is the right choice for your project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Practical Use Cases for WebAssembly
&lt;/h2&gt;

&lt;p&gt;Wasm is a powerful and flexible technology with wide applicability. That being said, it fits especially naturally into some primary use-cases that were envisioned in its original design.&lt;/p&gt;

&lt;p&gt;Rather than discuss specific applications or industries, here we focus on the &lt;em&gt;categories of problems&lt;/em&gt; that WebAssembly is especially good at solving, with several concrete examples for each.&lt;/p&gt;

&lt;p&gt;Let’s explore some of its most well suited use cases for the web.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using Native Libraries in the Browser
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9jou1rbvdr28lzpmr25n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9jou1rbvdr28lzpmr25n.png" alt="A diagram of using a native Wasm Library in the browser" width="800" height="595"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wasm enables you to reach for well tested and highly optimized native libraries from a wide range of programming languages. No longer limited to JavaScript, you can compile existing open-source and commercial libraries to Wasm and use them directly in the browser.&lt;/p&gt;

&lt;p&gt;In addition to massively expanding the available libraries, WebAssembly also delivers superior performance, often outperforming equivalent JavaScript implementations.&lt;/p&gt;

&lt;p&gt;Many popular libraries across a variety of languages already offer a Wasm build. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PDF Manipulation&lt;/strong&gt;: Render and edit PDF documents using a mature library like &lt;a href="https://itextpdf.com/" rel="noopener noreferrer"&gt;iText&lt;/a&gt;, &lt;a href="https://cheerpjdemos.leaningtech.com/iTextDemo.html" rel="noopener noreferrer"&gt;running in Wasm&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Physics and Game Engines&lt;/strong&gt;: Implement high performance physics with Wasm-compiled versions of well established engines. For instance, &lt;a href="https://github.com/kripken/ammo.js" rel="noopener noreferrer"&gt;Ammo.js&lt;/a&gt; is a Wasm version of the popular &lt;a href="https://github.com/bulletphysics/bullet3" rel="noopener noreferrer"&gt;bullet physics engine&lt;/a&gt; written in C++.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Video and Image Processing&lt;/strong&gt;: Work with industry standard tools like &lt;a href="https://www.ffmpeg.org/" rel="noopener noreferrer"&gt;ffmpeg&lt;/a&gt;, &lt;a href="https://github.com/ffmpegwasm/ffmpeg.wasm" rel="noopener noreferrer"&gt;directly in the browser&lt;/a&gt; for fast multimedia processing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Processing and Machine Learning&lt;/strong&gt;: Run inference models directly on the browser using &lt;a href="https://onnxruntime.ai/docs/build/web.html" rel="noopener noreferrer"&gt;onnx.wasm&lt;/a&gt; or &lt;a href="https://blog.tensorflow.org/2020/03/introducing-webassembly-backend-for-tensorflow-js.html" rel="noopener noreferrer"&gt;tensorflow.js&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;And much more.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Performance-Critical Client-Side Code
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcjl0n6vq5qzn9p57ee8b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcjl0n6vq5qzn9p57ee8b.png" alt="A diagram of a Wasm Module for performance-critical functionality" width="800" height="608"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;WebAssembly is particularly useful for web applications that require intensive client-side computation. Tasks like real-time graphics rendering, data processing, and machine learning can push JavaScript to its limits, leading to performance bottlenecks. By offloading these critical workloads to Wasm, applications can achieve significantly better speed and efficiency while seamlessly integrating with existing JavaScript code.&lt;/p&gt;

&lt;p&gt;Crucially, incorporating Wasm doesn’t require a major architectural overhaul. Thanks to its straightforward interop with JavaScript, developers can enhance performance-critical parts of an application while keeping the rest of the codebase unchanged. This makes it easy to adopt Wasm incrementally, targeting only the areas that benefit most.&lt;/p&gt;

&lt;p&gt;Some real-world examples highlight Wasm’s impact:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Figma&lt;/strong&gt; saw a 3x improvement in load times &lt;sup id="fnref1"&gt;1&lt;/sup&gt; for large design files by switching its core file processing logic from a JavaScript (asm.js) based implementation to WebAssembly .&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Meet&lt;/strong&gt; leverages Wasm for their client-side machine-learning-based features, such as background blur and background replacement &lt;sup id="fnref2"&gt;2&lt;/sup&gt; . These effects require fast execution of advanced ML models directly in the browser. Wasm provides the level of performance required to achieve real-time results in live video calls.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Expanding Language Options for Front-end Web Development
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsi21lqico3iwb5w1tw03.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsi21lqico3iwb5w1tw03.png" alt="A diagram of multiple source languages being used to develop a web app" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wasm provides a first-class way to build browser applications in languages other than JavaScript. There are several reasons why teams might choose this approach, for example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Familiarity&lt;/strong&gt;: To write in a language that the team is more familiar with (e.g. C#)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-platform Code Sharing&lt;/strong&gt;: To develop functionality for multiple platforms that shares code between web and non-web targets&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability &amp;amp; Maintainability&lt;/strong&gt;: To use a strongly typed, and memory-safe language to ensure maintainability as team grows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Several fully featured web frameworks have been developed to address various aspects of these needs, targeting WebAssembly to achieve fast, lightweight applications as a result. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor" rel="noopener noreferrer"&gt;Blazor&lt;/a&gt;, allows developers to build client-side web apps using C# .NET. &lt;a href="https://fsbolero.io/" rel="noopener noreferrer"&gt;Bolero&lt;/a&gt; is a similar project based on F#.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://leptos.dev/" rel="noopener noreferrer"&gt;Leptos&lt;/a&gt;, &lt;a href="https://yew.rs/" rel="noopener noreferrer"&gt;Yew&lt;/a&gt; and &lt;a href="https://dioxuslabs.com/" rel="noopener noreferrer"&gt;Dioxus&lt;/a&gt; are modern frameworks for building front-end web apps in Rust. These all compile to Wasm.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://doc.qt.io/qt-6/wasm.html" rel="noopener noreferrer"&gt;Qt for WebAssembly&lt;/a&gt; enables compiling C++ Qt GUI applications to WebAssembly, and running them in the browser.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dart.dev/web/wasm" rel="noopener noreferrer"&gt;Flutter&lt;/a&gt; a cross platform application development framework, compiles to Wasm for its web target.&lt;/li&gt;
&lt;li&gt;And many more.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Altogether, Wasm expands the options available for writing robust, production-ready applications on the web, without the overhead or drawbacks of past compile-to-javascript approaches.&lt;/p&gt;

&lt;h2&gt;
  
  
  Porting Native or Desktop Software into Web Applications
&lt;/h2&gt;

&lt;p&gt;And finally, Wasm offers a compelling, highly efficient approach for converting desktop or native applications into web applications by porting them to Wasm. This will be the focus of the rest of this series, so we will spend some time motivating it.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Pitfalls of Software Rewrites
&lt;/h3&gt;

&lt;p&gt;The traditional approach to modernise legacy native/desktop software to the web involves a full rewrite, typically targeting a client/server model for cloud deployment, or as a new web-native application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzgmefav5gdi8x1x7p0m0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzgmefav5gdi8x1x7p0m0.png" alt="A diagram of an application being rewritten into a web app" width="800" height="943"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This approach is infamously problematic, and many essays have been written about the pitfalls of &lt;em&gt;the big rewrite&lt;/em&gt; &lt;sup id="fnref3"&gt;3&lt;/sup&gt; &lt;sup id="fnref4"&gt;4&lt;/sup&gt; &lt;sup id="fnref5"&gt;5&lt;/sup&gt;. In some rare cases, a rewrite might make sense. But for the vast majority of commercially motivated software efforts, the verdict is out - the odds are that this will take longer or cost more than expected, and often result in outright failure.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Unclear Scope and Specifications&lt;/strong&gt;: Long-lived software often evolves beyond documented specifications, and embeds a history of forgotten decisions in the source code. Replicating its behaviour faithfully, in a different language and platform is extremely challenging for even the most talented engineers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;New Technical Debt&lt;/strong&gt;: Realistically, you risk introducing significant new technical debt through new bugs and design flaws in the rewrite effort, duplicating years of debugging and architectural refinements from the original application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Re-skilling and Lost Institutional Knowledge&lt;/strong&gt;: Rewriting software in a different language/platform also requires re-skilling the existing team, or building a new team that is unlikely to deeply understand all the nuances of a long lived software project.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Missed Opportunities&lt;/strong&gt;: By definition, a rewrite requires you to spend a significant amount of time developing a new version of software that will not bring value for a while, while tying up significant resources that might be better invested.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For these and other reasons, rewrites have earned their infamy and should be avoided whenever possible. Fortunately, there is a better way.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Better Approach with Wasm
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnpaqujs95djb1i6i9x44.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnpaqujs95djb1i6i9x44.png" alt="A diagram of an application being ported to the web with Wasm" width="800" height="980"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Instead of undertaking a costly and risky rewrite, Wasm offers a much more pragmatic solution: compile and reuse your existing source code (in part or in full), and run your application directly in the browser. This avoids the pitfalls of rewrites, while offering several significant benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Behaviour Consistency&lt;/strong&gt;: Retain the same business logic and application behavior as the original, ensuring a 1:1 match without any additional effort.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No New Technical Debt&lt;/strong&gt;: Porting an existing battle-tested codebase minimizes the risk of introducing new bugs or design flaws, and leverages all the debugging effort that has been invested in the existing code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Faster Time to Market&lt;/strong&gt;: Since you’re reusing most or all of your existing code, the development, testing and debugging effort is substantially reduced. This results in a faster, more predictable timeline for launching a modernized product.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code Sharing&lt;/strong&gt;: Once ported, your old and new applications can share the same code and functionality, allowing both applications to advance together with minimal duplication of effort.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Leverage Existing Expertise&lt;/strong&gt;: Instead of needing to re-skill or build a new team, your existing developers and domain experts can continue to contribute to the new web application in the same programming language they have always used, making the transition smoother.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance and Security by Default&lt;/strong&gt;: Wasm’s superior performance and security by design deliver a more efficient and secure user experience right out of the box, compared to a JavaScript rewrite, or a client/server model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lower Operational Costs&lt;/strong&gt;: Since Wasm runs entirely client-side, it requires no costly server infrastructure. Compared to a client/server implementation, the savings in operational costs over time are substantial.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By adopting Wasm, you not only avoid the high costs and risks of a complete rewrite, but also achieve faster results with lower operational overhead. This approach is far more efficient and offers lower risk, making it an ideal solution for modernizing existing applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real World Success Stories
&lt;/h2&gt;

&lt;p&gt;This approach isn’t theoretical – it’s already transforming major applications in the real world. Here are a few standout examples where Wasm enabled companies to modernize and scale their applications, without the need for costly and risky rewrites.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adobe Photoshop
&lt;/h3&gt;

&lt;p&gt;An excellent example is &lt;a href="https://www.adobe.com/uk/products/photoshop/online.html" rel="noopener noreferrer"&gt;Photoshop&lt;/a&gt;, the behemoth photo editing application developed by Adobe. Writing a new web-native version of PhotoShop is practically impossible, or at least, inconceivably expensive. But thanks to Wasm, Adobe was able to port the application to the web while reusing the vast majority of its existing C/C++ code, and compiling it to WebAssembly &lt;sup id="fnref6"&gt;6&lt;/sup&gt;. To date, the web and native versions of PhotoShop are essentially different builds of the same codebase!&lt;/p&gt;

&lt;h3&gt;
  
  
  SketchUp
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.sketchup.com/en" rel="noopener noreferrer"&gt;SketchUp&lt;/a&gt; is a popular 3D design tool known for being easy to learn and use for 3D modelling. Initially developed as a desktop application, it was a strategic goal for the team to build a web version - it would significantly broaden the market of users, and help them achieve their goal of making 3D modelling accessible to all.&lt;/p&gt;

&lt;p&gt;Rewriting the complex application in JavaScript was not an option, given its scale. The SketchUp team instead decided to port their application to WebAssembly, an effort that provided an unprecedentedly quick turnaround - the initial port took two engineers only three months &lt;sup id="fnref7"&gt;7&lt;/sup&gt;. The SketchUp web app went on to become one of the most popular apps on the GSuite for education marketplace.&lt;/p&gt;

&lt;h3&gt;
  
  
  AutoCAD
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://web.autocad.com/" rel="noopener noreferrer"&gt;AutoCAD&lt;/a&gt; by AutoDesk - a complex and widely used computer-aided design application - followed a similar journey. After unsuccessful attempts to rewrite the existing desktop application using Flash and JavaScript, WebAssembly finally offered a solid foundation for a serious porting effort &lt;sup id="fnref8"&gt;8&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;Early prototypes proved that Wasm could offer the performance required to run the large C++ application on a browser. They ported the full application to Wasm, delivering a consistent and familiar user experience, while sharing code between the desktop and web applications. This approach allowed them to cut their timeline drastically, without compromising on scope – they faithfully brought the full power of AutoCAD to the browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Aside - WebAssembly beyond the Browser
&lt;/h2&gt;

&lt;p&gt;No discussion of Wasm would be complete without touching on its applications beyond the browser. While WebAssembly is often associated with the web, its design allows for far broader usage, extending its potential into a variety of environments.&lt;/p&gt;

&lt;h3&gt;
  
  
  WebAssembly’s Flexibility and Portability
&lt;/h3&gt;

&lt;p&gt;As a bytecode and virtual machine specification, WebAssembly is not conceptually limited to the browser. Wasm modules make no assumptions about their execution environment, save for from the requirements explicitly defined through their imports and exports. This design makes it particularly well suited to use in a wide variety of environments.&lt;/p&gt;

&lt;p&gt;Wasm runtimes can be (and have already been &lt;sup id="fnref9"&gt;9&lt;/sup&gt;) implemented outside of the browser, giving rise to a new development target for server-side, cloud, and embedded environments. Anywhere you can run a Wasm runtime, you can run Wasm.&lt;/p&gt;

&lt;p&gt;There are established initiatives formed around this idea, most notably &lt;a href="https://wasi.dev/" rel="noopener noreferrer"&gt;WASI&lt;/a&gt;, which introduced the idea of a POSIX-like system interface for Wasm. This allows Wasm modules to interact with OS level functionality in a standardized way. Code from several languages can be built to target WASI, and then run in any WASI compatible runtime on any system.&lt;/p&gt;

&lt;h3&gt;
  
  
  Build Once, Run Anywhere
&lt;/h3&gt;

&lt;p&gt;Despite many existing options for server-side, cloud, and embedded development, Wasm’s simplicity, speed, portability, and security make it a real compelling alternative. The vision is that Wasm modules can truly be built once and ran anywhere - code compiled to a Wasm module can execute on any runtime implementation across operating systems (or even without an operating system!). It’s an ideal similar to Java’s/JVM’s goal to “write once, run anywhere”, but for virtually &lt;em&gt;any&lt;/em&gt; programming language, and with a modern, lightweight runtime.&lt;/p&gt;

&lt;p&gt;This opens up new possibilities for advanced application architectures outside the browser. Some interesting examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Container Workloads&lt;/strong&gt;: Docker now supports &lt;a href="https://docs.docker.com/desktop/features/wasm/" rel="noopener noreferrer"&gt;Wasm workloads&lt;/a&gt; - Instead of building a docker image, you can build a Wasm module, and docker can execute that in the same way. This keeps all the benefits that containerised cloud infrastructures have brought over the years, while layering added flexibility, security and portability benefits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Executing untrusted code&lt;/strong&gt;: Wasm introduces a unique approach for running untrusted code. For example, &lt;a href="https://shopify.dev/docs/apps/build/functions" rel="noopener noreferrer"&gt;Shopify’s functions&lt;/a&gt; allow third party code to execute server-side on Shopify's infrastructure, modifying the behaviour of the platform, with virtually no security risks, due to Wasm’s strict sandbox.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Serverless Architectures&lt;/strong&gt;: The lightweight nature of Wasm runtimes is enabling new serverless platforms based on Wasm, focused on speed and responsiveness. Providers like &lt;a href="https://www.fastly.com/products/edge-compute" rel="noopener noreferrer"&gt;Fastly&lt;/a&gt; and &lt;a href="https://www.fermyon.com/" rel="noopener noreferrer"&gt;Fermyon&lt;/a&gt; are reporting impressive cold-start times, and realising the promise of a “scale-to-zero” architecture where compute can be matched &lt;em&gt;exactly&lt;/em&gt; with demand.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Wasm’s applicability outside the browser is an exciting area of active development. It’s a testament to its design that it has found utility well beyond its intended browser use cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Wasm is a flexible tool with growing adoption in the browser and beyond. Whether for high-performance web applications, cross-platform development, or porting existing applications, Wasm offers a compelling alternative to traditional approaches, and is a useful technology to have in your toolkit.&lt;/p&gt;

&lt;p&gt;Specifically, the concrete examples presented here show that Wasm is not just a theoretical solution, but a proven path for bringing powerful native applications to the web, without the risks and costs of a full rewrite. By reusing and building on top of existing code, companies can deliver performant, browser-based experiences in a fraction of the time.&lt;/p&gt;

&lt;p&gt;In the next articles of the series, we’ll dive deeper into the process of porting existing desktop applications to WebAssembly. We’ll cover key strategies, best practices, and real-world techniques to help ensure a smooth transition.&lt;/p&gt;

&lt;p&gt;Stay tuned for part 3, or review part 1: &lt;a href="https://dev.to/blog/understanding-webassembly---the-fundamentals"&gt;Understanding WebAssembly - The Fundamentals&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Related Reading
&lt;/h2&gt;

&lt;p&gt;A good companion post with a concrete case study is &lt;a href="https://drs.software/blog/modernising-legacy-applications/" rel="noopener noreferrer"&gt;Porting C++/MFC applications to the web with Cheerp&lt;/a&gt;. It motivates the benefits of porting applications to the web in the first place, and showcases the specific benefits of Wasm.&lt;/p&gt;




&lt;ol&gt;

&lt;li id="fn1"&gt;
&lt;p&gt;Read about Figma's &lt;a href="https://www.figma.com/blog/webassembly-cut-figmas-load-time-by-3x/" rel="noopener noreferrer"&gt;Wasm migration effort&lt;/a&gt;. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn2"&gt;
&lt;p&gt;Read about Google meet's &lt;a href="https://research.google/blog/background-features-in-google-meet-powered-by-web-ml/" rel="noopener noreferrer"&gt;Web based ML features&lt;/a&gt;. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn3"&gt;
&lt;p&gt;Essay: Things You Should Never Do, Part I, by &lt;a href="https://www.joelonsoftware.com/2000/04/06/things-you-should-never-do-part-i/" rel="noopener noreferrer"&gt;Joel on Software&lt;/a&gt; ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn4"&gt;
&lt;p&gt;Essay: The best decision we've made was to abandon a complete code rewrite, by &lt;a href="https://www.lessannoyingcrm.com/blog/code-rewrite-cautionary-tale" rel="noopener noreferrer"&gt;Less Annoying CRM&lt;/a&gt; ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn5"&gt;
&lt;p&gt;Essay: The Myth of the Software Rewrite, by &lt;a href="https://daedtech.com/the-myth-of-the-software-rewrite/" rel="noopener noreferrer"&gt;Daedtech&lt;/a&gt; ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn6"&gt;
&lt;p&gt;Read about &lt;a href="https://web.dev/articles/ps-on-the-web" rel="noopener noreferrer"&gt;PhotoShop's porting story&lt;/a&gt; ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn7"&gt;
&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=zgOGZgAPUjQ&amp;amp;t=331s" rel="noopener noreferrer"&gt;SketchUp's porting story&lt;/a&gt; at GoogleIO ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn8"&gt;
&lt;p&gt;&lt;a href="https://youtu.be/BnYq7JapeDA?si=tnHG0dl9uGlzBVx5&amp;amp;t=1325" rel="noopener noreferrer"&gt;AutoCAD's porting story&lt;/a&gt; at Google IO ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn9"&gt;
&lt;p&gt;Example server-side Wasm runtimes include &lt;a href="https://github.com/bytecodealliance/wasmtime" rel="noopener noreferrer"&gt;Wasmtime&lt;/a&gt;, and &lt;a href="https://wasmedge.org/" rel="noopener noreferrer"&gt;Wasm Edge&lt;/a&gt; ↩&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;

</description>
      <category>webassembly</category>
      <category>webdev</category>
      <category>deepdive</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Understanding WebAssembly: The Fundamentals</title>
      <dc:creator>Martin Nyaga</dc:creator>
      <pubDate>Fri, 28 Feb 2025 14:45:48 +0000</pubDate>
      <link>https://dev.to/drs_software/understanding-webassembly-the-fundamentals-dpn</link>
      <guid>https://dev.to/drs_software/understanding-webassembly-the-fundamentals-dpn</guid>
      <description>&lt;p&gt;&lt;em&gt;Welcome to the first entry in our series, &lt;strong&gt;Porting Native Apps to the Web with WebAssembly: A Complete Guide&lt;/strong&gt;, by &lt;a href="https://drs.software/" rel="noopener noreferrer"&gt;DRS Software&lt;/a&gt;!&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;
The Birth of WebAssembly

&lt;ul&gt;
&lt;li&gt;Going Beyond JavaScript&lt;/li&gt;
&lt;li&gt;From Asm.JS to Wasm&lt;/li&gt;
&lt;li&gt;Wasm is Born&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

What is WebAssembly?

&lt;ul&gt;
&lt;li&gt;Wasm Bytecode&lt;/li&gt;
&lt;li&gt;Wasm is a Compilation Target&lt;/li&gt;
&lt;li&gt;Language Support&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Running a Wasm Module on the Browser&lt;/li&gt;

&lt;li&gt;

The Anatomy of a Wasm Module

&lt;ul&gt;
&lt;li&gt;Passing data between Wasm and JavaScript&lt;/li&gt;
&lt;li&gt;Memory&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

Design Benefits

&lt;ul&gt;
&lt;li&gt;Speed&lt;/li&gt;
&lt;li&gt;Portability&lt;/li&gt;
&lt;li&gt;Safety&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Summary&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this series, you'll discover how WebAssembly (Wasm) can help transform desktop or native apps into fast, capable web applications. We'll explore the fundamentals of Wasm, discuss architectural considerations, and provide practical strategies for porting native applications to the web with Wasm.&lt;/p&gt;

&lt;p&gt;Whether you're an engineering leader, architect, or developer, this guide will help you develop the right mental models to approach a porting effort and to set you up for success.&lt;/p&gt;

&lt;p&gt;To start, let's look at the history and design of WebAssembly, its role in modern web browsers, and why it's a game-changer for web applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Birth of WebAssembly
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Going Beyond JavaScript
&lt;/h3&gt;

&lt;p&gt;The web's ubiquity has driven a demand for increasingly advanced applications in the browser. In response, browsers have continuously evolved, adding new capabilities to match the growing complexity of modern web apps.&lt;/p&gt;

&lt;p&gt;However, JavaScript — the web's only built-in programming language — has historically posed challenges to this advancement. Among other limitations, it limits the ability for web apps to leverage existing software and libraries developed in languages other than JavaScript.&lt;/p&gt;

&lt;p&gt;This led to the "compile-to-JavaScript" movement that started in the 2010s — an ecosystem of tools and techniques aimed at compiling code written in other programming languages to JavaScript, making it runnable in the browser.&lt;/p&gt;

&lt;h3&gt;
  
  
  From Asm.JS to Wasm
&lt;/h3&gt;

&lt;p&gt;Among the compile-to-JavaScript technologies that emerged, one of the most prominent was &lt;a href="http://asmjs.org/spec/latest/" rel="noopener noreferrer"&gt;Asm.js&lt;/a&gt; -- a well defined subset of JavaScript carefully designed to be an efficient compilation target for software written in languages like C/C++.&lt;/p&gt;

&lt;p&gt;By using only specific JavaScript features, Asm.js could provide significant performance benefits over hand-written JavaScript. For the first time, C/C++ code could be compiled to Asm.js and run in the browser, and provide &lt;strong&gt;better performance than JavaScript&lt;/strong&gt; code. This unlocked a new world of interesting use cases. The impact of Asm.js, driven by its novel design, was so significant, that it prompted some browsers to develop specific optimizations &lt;sup id="fnref1"&gt;1&lt;/sup&gt;&lt;sup&gt;,&lt;/sup&gt;&lt;sup id="fnref2"&gt;2&lt;/sup&gt; for Asm.js code.&lt;/p&gt;

&lt;p&gt;Asm.js demonstrated the potential of compiling native code for the web, but its reliance on JavaScript ultimately limited its capabilities. Despite its &lt;a href="https://en.wikipedia.org/wiki/Asm.js#Code_generation" rel="noopener noreferrer"&gt;clever optimizations&lt;/a&gt; to achieve impressive performance, it became clear that a faster, more flexible, more capable and more long-term solution could be realised by a purpose built technology -- one that could take inspiration from the design of Asm.js, but was not constrained to JavaScript as its runtime &lt;sup id="fnref3"&gt;3&lt;/sup&gt;, and that could be standardised and widely adopted at the browser level &lt;sup id="fnref4"&gt;4&lt;/sup&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Wasm is Born
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://arstechnica.com/information-technology/2015/06/the-web-is-getting-its-bytecode-webassembly/" rel="noopener noreferrer"&gt;In 2015&lt;/a&gt;, WebAssembly (Wasm) was announced as a cross browser initiative to develop and standardise a purpose-built, assembly-like language for web browsers, with the express goal of being able to run code compiled from other languages in the browser.&lt;/p&gt;

&lt;p&gt;Today, Wasm is supported by all major browsers, has become an &lt;a href="https://webassembly.org/" rel="noopener noreferrer"&gt;open standard&lt;/a&gt;, and has a rapidly growing ecosystem of tools and technologies built around it. Its standardisation ensures longevity, stability and a commitment to backward compatibility, making it an excellent platform on which to base architectural decisions today.&lt;/p&gt;

&lt;p&gt;As of January 2025, WebAssembly is used on &lt;a href="https://chromestatus.com/metrics/feature/timeline/popularity/2237" rel="noopener noreferrer"&gt;over 4.5% of websites&lt;/a&gt; with adoption growing exponentially. Major companies -- including Adobe, Figma, AutoCAD, Google, Microsoft, Shopify and more -- are investing heavily in WebAssembly, and using it to power some of their most widely used products.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is WebAssembly?
&lt;/h2&gt;

&lt;p&gt;Wasm is a low level, assembly-like language optimised for safe and efficient execution in modern web browsers. Its binary instruction format prioritises compact, fast, and portable code that can achieve near native performance&lt;sup id="fnref5"&gt;5&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;On the browser, Wasm is designed to run alongside and inter-operate with JavaScript, extending the possibilities for client-side applications.&lt;/p&gt;

&lt;p&gt;We will review its design at a high level here, but you can find full design details at &lt;a href="https://webassembly.org" rel="noopener noreferrer"&gt;webassembly.org&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Wasm Bytecode
&lt;/h3&gt;

&lt;p&gt;Wasm is a &lt;a href="https://en.wikipedia.org/wiki/Bytecode" rel="noopener noreferrer"&gt;bytecode&lt;/a&gt; -- a set of instructions in a binary format that runs on a virtual machine (VM). All modern browsers today include a mature Wasm VM by default.&lt;/p&gt;

&lt;p&gt;It is conceptually similar to other languages that have a bytecode executed in a virtual machine (e.g. Java or .NET), with the major difference being that Wasm code is not constrained to any single source language; it can be generated from a wide variety of languages.&lt;/p&gt;

&lt;p&gt;Wasm code can be disassembled into a text representation (WebAssembly Text Format, or WAT):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;;; Module start
(module
  ;; Add function
  (func $add (param i32 i32) (result i32)
    local.get 1
    local.get 0
    i32.add)
  ;; Sub function
  (func $sub (param i32 i32) (result i32)
    local.get 0
    local.get 1
    i32.sub)
  ;; Exports
  (export "add" (func $add))
  (export "sub" (func $sub))
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;An example of a simple Wasm module in its text format (WAT). This module defines and exports an &lt;code&gt;add&lt;/code&gt; and a &lt;code&gt;sub&lt;/code&gt; function.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Wasm is a Compilation Target
&lt;/h3&gt;

&lt;p&gt;In contrast to JavaScript, Wasm is not intended to be written directly (although it can be). Wasm is a compilation target; this means that source code from other programming languages is compiled to Wasm code using a compiler. The resulting Wasm code can then be executed on a Wasm runtime, for example, the browser.&lt;/p&gt;

&lt;p&gt;This is one of the most powerful aspects of Wasm - it provides a language agnostic way to run code written in almost any programming language in a fast, platform-independent way.&lt;/p&gt;

&lt;h3&gt;
  
  
  Language Support
&lt;/h3&gt;

&lt;p&gt;A large number of languages today have production ready Wasm tooling.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;C/C++&lt;/strong&gt;: Can be compiled to JS/Wasm using &lt;a href="https://cheerp.io/" rel="noopener noreferrer"&gt;Cheerp&lt;/a&gt;,
&lt;a href="https://emscripten.org/" rel="noopener noreferrer"&gt;Emscripten&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Go&lt;/strong&gt;: Supports the &lt;a href="https://go.dev/wiki/WebAssembly" rel="noopener noreferrer"&gt;GOARCH=wasm target&lt;/a&gt; by default&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rust&lt;/strong&gt;: Supports a &lt;a href="https://www.rust-lang.org/what/wasm" rel="noopener noreferrer"&gt;wasm target&lt;/a&gt; by
default (--target wasm32-unknown-unknown). Tools like &lt;a href="https://github.com/rustwasm/wasm-bindgen" rel="noopener noreferrer"&gt;wasm-bindgen&lt;/a&gt; and
&lt;a href="https://github.com/rustwasm/wasm-pack" rel="noopener noreferrer"&gt;wasm-pack&lt;/a&gt; provide better ergonomics for Wasm development&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;C# .NET&lt;/strong&gt;:
&lt;a href="https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor" rel="noopener noreferrer"&gt;Blazor&lt;/a&gt; is a
full stack or client-only framework that compiles into a combination of Wasm
and JavaScript. F# has a similar framework built on top of Blazor called
&lt;a href="https://fsbolero.io/" rel="noopener noreferrer"&gt;Bolero&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kotlin&lt;/strong&gt;: Has &lt;a href="https://kotlinlang.org/docs/wasm-overview.html" rel="noopener noreferrer"&gt;alpha support&lt;/a&gt; for Wasm&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Swift&lt;/strong&gt;: &lt;a href="https://swiftwasm.org/" rel="noopener noreferrer"&gt;SwiftWasm&lt;/a&gt; is a mature community project to support Wasm compilation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Python&lt;/strong&gt;: &lt;a href="https://pyodide.org/en/stable/" rel="noopener noreferrer"&gt;Pyodide&lt;/a&gt; is a complete python distribution compiled to Wasm&lt;/li&gt;
&lt;li&gt;And several more.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Running a Wasm Module on the Browser
&lt;/h2&gt;

&lt;p&gt;Wasm code is packaged and distributed as &lt;code&gt;.wasm&lt;/code&gt; files called Wasm &lt;strong&gt;modules&lt;/strong&gt;. The following example demonstrates a simple WebAssembly module that imports a &lt;code&gt;console.log&lt;/code&gt; function, and exports a single function (&lt;code&gt;exportedFunc&lt;/code&gt;). The module is loaded and instantiated through the JavaScript code below, which proceeds to execute the exported function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(module
  (func $log (import "console" "log") (param i32))
  (func (export "exportedFunc")
    i32.const 42
    call $log))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;A sample Wasm module with a single exported function, that logs 42 to the console when called.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;importObject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;console&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;log&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nx"&gt;WebAssembly&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;instantiateStreaming&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;example.wasm&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="nx"&gt;importObject&lt;/span&gt;
&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;instance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exportedFunc&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;JS code to instantiate and interact with a Wasm module.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Anatomy of a Wasm Module
&lt;/h2&gt;

&lt;p&gt;The key high level elements of a Wasm module are summarised below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx2j50nne61t5yw5xcztz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx2j50nne61t5yw5xcztz.png" alt="A Diagram of a Wasm module" width="800" height="717"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;High level structure of a Wasm module.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Code:&lt;/strong&gt; Or, functions. These are implementations of logic in the Wasm module as stateless blocks of Wasm instructions. These functions can accept arguments and can return values when called.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Imports:&lt;/strong&gt; Wasm modules can import definitions (memory, functions etc.) from the host (browser) environment. This allows Wasm modules to use functionality provided by the host. For example, a Wasm module might import a function from JS to draw an array of pixels to a canvas, log to the console, or send a notification to the user.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exports:&lt;/strong&gt; Wasm modules can export definitions (memory, functions, etc.) to the host environment. This allows them to expose useful functionality to JavaScript as callable functions. For example, a Wasm module might export a function to perform a specific statistical calculation, compute the next frame in a game loop, or run an ML inference model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory:&lt;/strong&gt; Wasm modules have access to a linear, growable, untyped memory. Think of this as a large array of bytes that both JavaScript and Wasm can access.&lt;/li&gt;
&lt;li&gt;Other internal sections (&lt;a href="https://webassembly.github.io/spec/core/syntax/modules.html#types" rel="noopener noreferrer"&gt;types&lt;/a&gt;, &lt;a href="https://webassembly.github.io/spec/core/syntax/modules.html#tables" rel="noopener noreferrer"&gt;tables&lt;/a&gt;, &lt;a href="https://webassembly.github.io/spec/core/syntax/modules.html#globals" rel="noopener noreferrer"&gt;globals&lt;/a&gt;, &lt;a href="https://webassembly.github.io/spec/core/syntax/modules.html#element-segments" rel="noopener noreferrer"&gt;element segments&lt;/a&gt;, &lt;a href="https://webassembly.github.io/spec/core/syntax/modules.html#data-segments" rel="noopener noreferrer"&gt;data segments&lt;/a&gt;, &lt;a href="https://webassembly.github.io/spec/core/syntax/modules.html#start-function" rel="noopener noreferrer"&gt;start function&lt;/a&gt;, &lt;a href="https://webassembly.github.io/spec/core/appendix/custom.html" rel="noopener noreferrer"&gt;custom sections&lt;/a&gt;), whose details are omitted here for brevity.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Memory, Code, Imports, and Exports form the essential components to understand Wasm’s anatomy from an architectural perspective.&lt;/p&gt;

&lt;h3&gt;
  
  
  Passing data between Wasm and JavaScript
&lt;/h3&gt;

&lt;p&gt;On the browser, Wasm modules need to communicate with JavaScript code to provide receive useful input or provide output.&lt;/p&gt;

&lt;p&gt;Generally speaking, Wasm functions can only accept and return simple numeric types (like integers and floats)&lt;sup id="fnref6"&gt;6&lt;/sup&gt;. To handle complex data (like strings or objects), both JavaScript and Wasm can use the &lt;strong&gt;shared linear memory&lt;/strong&gt; to communicate.&lt;/p&gt;

&lt;p&gt;For example, to pass a string from JavaScript to Wasm, you can:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Encode the string as bytes&lt;/li&gt;
&lt;li&gt;Write those bytes into a specific location in the shared linear memory.&lt;/li&gt;
&lt;li&gt;Call a Wasm function, giving it the location of the string and its length.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Wasm code can then interpret these bytes into a readable string.&lt;/p&gt;

&lt;p&gt;This mechanism requires that the host environment and the Wasm module both know how to correctly interpret the bytes in memory. Handling this manually can be complex, and so the necessary “glue” code is typically generated by tooling rather than written by hand.&lt;/p&gt;

&lt;h3&gt;
  
  
  Memory
&lt;/h3&gt;

&lt;p&gt;Wasm virtual machines are 32 bit, which has implications for porting&lt;br&gt;
applications as we'll see later in the series. This also means that Wasm modules can address up to 4GB (or 2&lt;sup&gt;32&lt;/sup&gt; bytes) of linear memory. This is sufficient in most cases, but there are active proposals to support 64 bit and larger memory sizes&lt;sup id="fnref7"&gt;7&lt;/sup&gt; for more demanding use-cases.&lt;/p&gt;

&lt;p&gt;We will discuss further details about JS/Wasm interop and the Wasm memory model in a future post in the series.&lt;/p&gt;

&lt;h2&gt;
  
  
  Design Benefits
&lt;/h2&gt;

&lt;p&gt;Wasm's design offers a few key benefits, as explicitly discussed in its &lt;a href="https://webassembly.github.io/spec/core/intro/introduction.html#design-goals" rel="noopener noreferrer"&gt;design goals&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Speed
&lt;/h3&gt;

&lt;p&gt;Wasm can execute at near native speed, enabling otherwise unachievable&lt;br&gt;
performance on client-side web applications. Its performance often surpasses JavaScript as a result of its design:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wasm uses a &lt;strong&gt;compact binary format&lt;/strong&gt;, which can be downloaded, decoded, and executed more efficiently than JavaScript’s text format.&lt;/li&gt;
&lt;li&gt;As a compilation target, it is often &lt;strong&gt;optimized ahead of time&lt;/strong&gt; (AOT), while JavaScript primarily relies on just-in-time (JIT) compilation for optimisation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Supports SIMD&lt;/strong&gt; (single instruction, multiple data) instructions, enabling vector computations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Wasm is not only fast, but also predictable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The linear memory model in Wasm, combined with &lt;strong&gt;explicit memory management&lt;/strong&gt; (in source languages like C/C++/Rust) allows strict control over memory layout and allocation.&lt;/li&gt;
&lt;li&gt;JavaScript, on the other hand, relies on the browser’s &lt;strong&gt;garbage collection&lt;/strong&gt;, which can lead to unpredictable pauses in code execution, with no control over when these occur.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Altogether, Wasm's design makes it easier to write well performing code by default. For example, Figma saw &lt;a href="https://www.figma.com/blog/webassembly-cut-figmas-load-time-by-3x/" rel="noopener noreferrer"&gt;a 3x improvement in load times&lt;/a&gt; of  heavy files by switching to WebAssembly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Portability
&lt;/h3&gt;

&lt;p&gt;A Wasm module makes no assumptions about the platform on which it executes (including the browser). By design, its dependencies are made explicit in the form of imports. This makes Wasm modules executable on any spec-compliant Wasm runtime, provided the required imports can be supplied at runtime.&lt;/p&gt;

&lt;p&gt;This design feature of Wasm has led to the development of many use-cases for Wasm outside the browser, despite browser based use-cases being its initial motivation. Wasm can now power not just browser applications, but also server-side runtimes, IoT devices and more.&lt;/p&gt;

&lt;h3&gt;
  
  
  Safety
&lt;/h3&gt;

&lt;p&gt;Wasm code is executed in a memory-safe sandbox, isolating the running program from all other programs on the host system. By design, Wasm programs cannot interfere with the execution of, or memory from any other running code on the system, and can only access its well defined linear memory.&lt;/p&gt;

&lt;p&gt;Wasm code can only escape the sandbox through imports explicitly supplied by the host, providing a clear access control mechanism for Wasm code. For browser use cases, this means that access to the DOM, any web APIs and the underlying system is only through explicitly provided JavaScript functions. In this way, Wasm code is subject to a permissions model that is as strict (or stricter) than JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Wasm has matured into a foundational platform, on top of which a new generation of tooling, frameworks and application architectures is actively being developed, with a multitude of production ready apps being shipped today. It is transforming web development with its speed, portability, and safety.&lt;/p&gt;

&lt;p&gt;In this introduction, we’ve explored Wasm’s history, core features, and&lt;br&gt;
benefits.In future articles, we will dive deeper into practical applications of Wasm, and specifically, practical ways to use Wasm to bring native applications to the web, with patterns and tips to help you succeed.&lt;/p&gt;

&lt;p&gt;📌 Follow &lt;a href="https://drs.software/blog/" rel="noopener noreferrer"&gt;DRS Software&lt;/a&gt; for future updates to the series!&lt;/p&gt;




&lt;ol&gt;

&lt;li id="fn1"&gt;
&lt;p&gt;MS Edge developed &lt;a href="https://blogs.windows.com/msedgedev/2015/05/07/bringing-asm-js-to-chakra-microsoft-edge/" rel="noopener noreferrer"&gt;a specialized pipeline&lt;/a&gt; for asm.js code. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn2"&gt;
&lt;p&gt;&lt;a href="https://blog.chromium.org/2013/05/chrome-28-beta-more-immersive-web.html" rel="noopener noreferrer"&gt;Optimizations were introduced&lt;/a&gt; in V8 specifically with asm.js in mind. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn3"&gt;
&lt;p&gt;A good explanation about why WebAssembly is faster than asm.js can be found &lt;a href="https://hacks.mozilla.org/2017/03/why-webassembly-is-faster-than-asm-js/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn4"&gt;
&lt;p&gt;Why create a new standard when there is already asm.js? Some commentary can be found &lt;a href="https://webassembly.org/docs/faq/" rel="noopener noreferrer"&gt;here&lt;/a&gt; on the official WebAssembly website. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn5"&gt;
&lt;p&gt;WebAssembly's high level goals are listed &lt;a href="https://webassembly.org/docs/high-level-goals/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn6"&gt;
&lt;p&gt;&lt;a href="https://bytecodealliance.org/articles/reference-types-in-wasmtime" rel="noopener noreferrer"&gt;Recent proposals&lt;/a&gt; extend Wasm's primitive types new opaque “reference types” to allow passing more complex objects across the Wasm &amp;lt;-&amp;gt; host boundary, but the details of this are omitted for brevity. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn7"&gt;
&lt;p&gt;&lt;a href="https://github.com/WebAssembly/memory64" rel="noopener noreferrer"&gt;Memory64&lt;/a&gt; is an active proposal to support 64 bit pointers and larger memory in Wasm. While implemented in some browsers, this is not stable at the time of writing. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;

</description>
      <category>webassembly</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>deepdive</category>
    </item>
  </channel>
</rss>
