{"id":63148,"date":"2019-04-05T04:19:17","date_gmt":"2019-04-05T11:19:17","guid":{"rendered":"http:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/"},"modified":"2019-04-05T04:19:17","modified_gmt":"2019-04-05T11:19:17","slug":"how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study","status":"publish","type":"post","link":"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/","title":{"rendered":"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)"},"content":{"rendered":"<link rel=\"canonical\" href=\"https:\/\/www.smashingmagazine.com\/2019\/04\/webassembly-speed-web-app\/\"><title>How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)<\/title><\/p>\n<article>\n<header>\n<h1>How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)<\/h1>\n<address>Robert Aboukhalil<\/address>\n<p>                  <time datetime=\"2019-04-05T12:00:29+02:00\">2019-04-05T12:00:29+02:00<\/time><time datetime=\"2019-04-05T11:06:39+00:00\">2019-04-05T11:06:39+00:00<\/time><\/header>\n<p>If you haven\u2019t heard, here\u2019s the TL;DR: WebAssembly is a new language that runs in the browser alongside JavaScript. Yes, that\u2019s right. JavaScript is no longer the only language that runs in the browser!<\/p>\n<p>But beyond just being \u201cnot JavaScript\u201d, its distinguishing factor is that you can compile code from languages such as C\/C++\/Rust (<em>and more!<\/em>) to WebAssembly and run them in the browser. Because WebAssembly is statically typed, uses a linear memory, and is stored in a compact binary format, it is also very fast, and could eventually allow us to run code at  \u201cnear-native\u201d speeds, i.e. at speeds close to what you\u2019d get by running the binary on the command line. The ability to leverage existing tools and libraries for use in the browser and the associated potential for speedup, are two reasons that make WebAssembly so compelling for the web.<\/p>\n<p>So far, WebAssembly has been used for all sorts of applications, ranging from gaming (e.g.<a href=\"http:\/\/www.continuation-labs.com\/projects\/d3wasm\/\"> Doom 3<\/a>), to porting desktop applications to the web (e.g. <a href=\"http:\/\/blogs.autodesk.com\/autocad\/autocad-web-app-google-io-2018\/\">Autocad<\/a> and <a href=\"https:\/\/www.figma.com\/blog\/webassembly-cut-figmas-load-time-by-3x\/\">Figma<\/a>). It is even used outside the browser, for example as an efficient and flexible language for <a href=\"https:\/\/blog.cloudflare.com\/webassembly-on-cloudflare-workers\/\">serverless computing<\/a>.<\/p>\n<p>This article is a case study on using WebAssembly to speed up a data analysis web tool. To that end, we\u2019ll take an existing tool written in C that performs the same computations, compile it to WebAssembly, and use it to replace slow JavaScript calculations.<\/p>\n<p><strong>Note<\/strong>: <em>This article delves into some advanced topics such as compiling C code, but don\u2019t worry if you don\u2019t have experience with that; you will still be able to follow along and get a sense for what is possible with WebAssembly.<\/em><\/p>\n<div data-component=\"FeaturePanel\" data-audience=\"non-subscriber\" data-remove=\"true\"><\/div>\n<h3>Background<\/h3>\n<p>The web app we will work with is <a href=\"http:\/\/fastq.bio\/\">fastq.bio<\/a>, an interactive web tool that provides scientists with a quick preview of the quality of their DNA sequencing data; sequencing is the process by which we read the \u201cletters\u201d (i.e. nucleotides) in a DNA sample.<\/p>\n<p>Here\u2019s a screenshot of the application in action:<\/p>\n<figure><a href=\"https:\/\/i0.wp.com\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/06e27be8-1fef-468b-9d23-40ae53e0a354\/webassembly-speed-web-app1.png?ssl=1\"><br \/>\n\t\t<img data-recalc-dims=\"1\" decoding=\"async\" srcset=\"http:\/\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/04\/webassembly-speed-web-app1.png 400w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_800\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/06e27be8-1fef-468b-9d23-40ae53e0a354\/webassembly-speed-web-app1.png 800w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_1200\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/06e27be8-1fef-468b-9d23-40ae53e0a354\/webassembly-speed-web-app1.png 1200w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_1600\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/06e27be8-1fef-468b-9d23-40ae53e0a354\/webassembly-speed-web-app1.png 1600w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_2000\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/06e27be8-1fef-468b-9d23-40ae53e0a354\/webassembly-speed-web-app1.png 2000w\" src=\"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/04\/webassembly-speed-web-app1.png?w=900\" sizes=\"100vw\" alt=\"Interactive plots showing the user metrics for assessing the quality of their data\"><\/a><figcaption>\n\t\t\tA screenshot of fastq.bio in action (<a href=\"https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/06e27be8-1fef-468b-9d23-40ae53e0a354\/webassembly-speed-web-app1.png\">Large preview<\/a>)<br \/>\n\t\t<\/figcaption><\/figure>\n<p>We won\u2019t go into the details of the calculations, but in a nutshell, the plots above provide scientists a sense for how well the sequencing went and are used to identify data quality issues at a glance.<\/p>\n<p>Although there are dozens of command line tools available to generate such quality control reports, the goal of fastq.bio is to give an interactive preview of data quality without leaving the browser. This is especially useful for scientists who are not comfortable with the command line.<\/p>\n<p>The input to the app is a plain-text file that is output by the sequencing instrument and contains a list of DNA sequences and a quality score for each nucleotide in the DNA sequences. The format of that file is known as \u201cFASTQ\u201d, hence the name fastq.bio.<\/p>\n<p>If you\u2019re curious about the FASTQ format (not necessary to understand this article), check out the <a href=\"https:\/\/en.wikipedia.org\/wiki\/FASTQ_format\">Wikipedia page<\/a> for FASTQ. (Warning: The FASTQ file format is known in the field to induce facepalms.)<\/p>\n<h3>fastq.bio: The JavaScript Implementation<\/h3>\n<p>In the original version of fastq.bio, the user starts by selecting a FASTQ file from their computer. With the <code>File<\/code> object, the app reads a small chunk of data starting at a random byte position (using the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/File\/Using_files_from_web_applications\">FileReader API<\/a>). In that chunk of data, we use JavaScript to perform basic string manipulations and calculate relevant metrics. One such metric helps us track how many A\u2019s, C\u2019s, G\u2019s and T\u2019s we typically see at each position along a DNA fragment.<\/p>\n<p>Once the metrics are calculated for that chunk of data, we plot the results interactively with <a href=\"https:\/\/plot.ly\/\">Plotly.js<\/a>, and move on to the next chunk in the file. The reason for processing the file in small chunks is simply to improve the user experience: processing the whole file at once would take too long, because FASTQ files are generally in the hundreds of gigabytes. We found that a chunk size between 0.5 MB and 1 MB would make the application more seamless and would return information to the user more quickly, but this number will vary depending on the details of your application and how heavy the computations are.<\/p>\n<p>The architecture of our original JavaScript implementation was fairly straightforward:<\/p>\n<figure><a href=\"https:\/\/i0.wp.com\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/8b9e9792-f8e8-457a-a269-d75162c443c6\/webassembly-speed-web-app2.png?ssl=1\"><br \/>\n\t\t<img data-recalc-dims=\"1\" decoding=\"async\" srcset=\"http:\/\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/04\/webassembly-speed-web-app2.png 400w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_800\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/8b9e9792-f8e8-457a-a269-d75162c443c6\/webassembly-speed-web-app2.png 800w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_1200\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/8b9e9792-f8e8-457a-a269-d75162c443c6\/webassembly-speed-web-app2.png 1200w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_1600\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/8b9e9792-f8e8-457a-a269-d75162c443c6\/webassembly-speed-web-app2.png 1600w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_2000\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/8b9e9792-f8e8-457a-a269-d75162c443c6\/webassembly-speed-web-app2.png 2000w\" src=\"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/04\/webassembly-speed-web-app2.png?w=900\" sizes=\"100vw\" alt=\"Randomly sample from the input file, calculate metrics using JavaScript, plot the results, and loop around\"><\/a><figcaption>\n\t\t\tThe architecture of the JavaScript implementation of fastq.bio (<a href=\"https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/8b9e9792-f8e8-457a-a269-d75162c443c6\/webassembly-speed-web-app2.png\">Large preview<\/a>)<br \/>\n\t\t<\/figcaption><\/figure>\n<p>The box in red is where we do the string manipulations to generate the metrics. That box is the more compute-intensive part of the application, which naturally made it a good candidate for runtime optimization with WebAssembly.<\/p>\n<div><\/div>\n<h3>fastq.bio: The WebAssembly Implementation<\/h3>\n<p>To explore whether we could leverage WebAssembly to speed up our web app, we searched for an off-the-shelf tool that calculates QC metrics on FASTQ files. Specifically, we sought a tool written in C\/C++\/Rust so that it was amenable to porting to WebAssembly, and one that was already validated and trusted by the scientific community.<\/p>\n<p>After some research, we decided to go with <a href=\"https:\/\/github.com\/lh3\/seqtk\">seqtk<\/a>, a commonly-used, open-source tool written in C that can help us evaluate the quality of sequencing data (and is more generally used to manipulate those data files).<\/p>\n<p>Before we compile to WebAssembly, let\u2019s first consider how we would normally compile seqtk to binary to run it on the command line. According to the Makefile, this is the <code>gcc<\/code> incantation you need:<\/p>\n<pre><code># Compile to binary\n$ gcc seqtk.c \n   -o seqtk \n   -O2 \n   -lm \n   -lz\n<\/code><\/pre>\n<p>On the other hand, to compile seqtk to WebAssembly, we can use the <a href=\"https:\/\/emscripten.org\/\">Emscripten toolchain<\/a>, which provides drop-in replacements for existing build tools to make working in WebAssembly easier. If you don\u2019t have Emscripten installed, you can download a docker image we prepared on <a href=\"https:\/\/hub.docker.com\/r\/robertaboukhalil\/emsdk\/tags\">Dockerhub<\/a> that has the tools you\u2019ll need (you can also <a href=\"https:\/\/emscripten.org\/docs\/getting_started\/downloads.html\">install it from scratch<\/a>, but that usually takes a while):<\/p>\n<pre><code>$ docker pull robertaboukhalil\/emsdk:1.38.26\n$ docker run -dt --name wasm-seqtk robertaboukhalil\/emsdk:1.38.26\n<\/code><\/pre>\n<p>Inside the container, we can use the <code>emcc<\/code> compiler as a replacement for <code>gcc<\/code>:<\/p>\n<pre><code># Compile to WebAssembly\n$ emcc seqtk.c \n    -o seqtk.js \n    -O2 \n    -lm \n    -s USE_ZLIB=1 \n    -s FORCE_FILESYSTEM=1\n<\/code><\/pre>\n<p>As you can see, the differences between compiling to binary and WebAssembly are minimal:<\/p>\n<ol>\n<li>Instead of the output being the binary file <code>seqtk<\/code>, we ask Emscripten to generate a <code>.wasm<\/code> and a <code>.js<\/code> that handles instantiation of our WebAssembly module<\/li>\n<li>To support the zlib library, we use the flag <code>USE_ZLIB<\/code>; zlib is so common that it\u2019s already been ported to WebAssembly, and Emscripten will include it for us in our project<\/li>\n<li>We enable Emscripten\u2019s virtual file system, which is a POSIX-like file system (<a href=\"https:\/\/github.com\/emscripten-core\/emscripten\/blob\/incoming\/src\/library_fs.js\">source code here<\/a>), except it runs in RAM within the browser and disappears when you refresh the page (unless you save its state in the browser using IndexedDB, but that\u2019s for another article).<\/li>\n<\/ol>\n<p>Why a virtual file system? To answer that, let\u2019s compare how we would call seqtk on the command line vs. using JavaScript to call the compiled WebAssembly module:<\/p>\n<pre><code># On the command line\n$ .\/seqtk fqchk data.fastq\n\n# In the browser console\n> Module.callMain([\"fqchk\", \"data.fastq\"])\n<\/code><\/pre>\n<p>Having access to a virtual file system is powerful because it means we don\u2019t have to rewrite seqtk to handle string inputs instead of file paths. We can mount a chunk of data as the file <code>data.fastq<\/code> on the virtual file system and simply call seqtk\u2019s <code>main()<\/code> function on it.<\/p>\n<p>With seqtk compiled to WebAssembly, here\u2019s the new fastq.bio architecture:<\/p>\n<figure><a href=\"https:\/\/i0.wp.com\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/a6d54294-e93c-496c-96b0-1888062913c5\/webassembly-speed-web-app3.png?ssl=1\"><br \/>\n\t\t<img data-recalc-dims=\"1\" decoding=\"async\" srcset=\"http:\/\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/04\/webassembly-speed-web-app3.png 400w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_800\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/a6d54294-e93c-496c-96b0-1888062913c5\/webassembly-speed-web-app3.png 800w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_1200\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/a6d54294-e93c-496c-96b0-1888062913c5\/webassembly-speed-web-app3.png 1200w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_1600\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/a6d54294-e93c-496c-96b0-1888062913c5\/webassembly-speed-web-app3.png 1600w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_2000\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/a6d54294-e93c-496c-96b0-1888062913c5\/webassembly-speed-web-app3.png 2000w\" src=\"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/04\/webassembly-speed-web-app3.png?w=900\" sizes=\"100vw\" alt=\"Randomly sample from the input file, calculate metrics within a WebWorker using WebAssembly, plot the results, and loop around\"><\/a><figcaption>\n\t\t\tArchitecture of the WebAssembly + WebWorkers implementation of fastq.bio (<a href=\"https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/a6d54294-e93c-496c-96b0-1888062913c5\/webassembly-speed-web-app3.png\">Large preview<\/a>)<br \/>\n\t\t<\/figcaption><\/figure>\n<p>As shown in the diagram, instead of running the calculations in the browser\u2019s main thread, we make use of <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Web_Workers_API\/Using_web_workers\">WebWorkers<\/a>, which allow us to run our calculations in a background thread, and avoid negatively affecting the responsiveness of the browser. Specifically, the WebWorker controller launches the Worker and manages communication with the main thread. On the Worker\u2019s side, an API executes the requests it receives.<\/p>\n<p>We can then ask the Worker to run a seqtk command on the file we just mounted. When seqtk finishes running, the Worker sends the result back to the main thread via a Promise. Once it receives the message, the main thread uses the resulting output to update the charts. Similar to the JavaScript version, we process the files in chunks and update the visualizations at each iteration.<\/p>\n<div><\/div>\n<h3>Performance Optimization<\/h3>\n<p>To evaluate whether using WebAssembly did any good, we compare the JavaScript and WebAssembly implementations using the metric of how many reads we can process per second. We ignore the time it takes for generating interactive graphs, since both implementations use JavaScript for that purpose.<\/p>\n<p>Out of the box, we already see a ~9X speedup:<\/p>\n<figure><a href=\"https:\/\/i0.wp.com\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/93e8c09d-8a86-4cd7-bc68-8bfb2e7e11de\/webassembly-speed-web-app4.png?ssl=1\"><br \/>\n\t\t<img data-recalc-dims=\"1\" decoding=\"async\" srcset=\"http:\/\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/04\/webassembly-speed-web-app4.png 400w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_800\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/93e8c09d-8a86-4cd7-bc68-8bfb2e7e11de\/webassembly-speed-web-app4.png 800w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_1200\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/93e8c09d-8a86-4cd7-bc68-8bfb2e7e11de\/webassembly-speed-web-app4.png 1200w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_1600\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/93e8c09d-8a86-4cd7-bc68-8bfb2e7e11de\/webassembly-speed-web-app4.png 1600w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_2000\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/93e8c09d-8a86-4cd7-bc68-8bfb2e7e11de\/webassembly-speed-web-app4.png 2000w\" src=\"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/04\/webassembly-speed-web-app4.png?w=900\" sizes=\"100vw\" alt=\"Bar chart showing that we can process 9X more lines per second\"><\/a><figcaption>\n\t\t\tUsing WebAssembly, we see a 9X speedup compared to our original JavaScript implementation. (<a href=\"https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/93e8c09d-8a86-4cd7-bc68-8bfb2e7e11de\/webassembly-speed-web-app4.png\">Large preview<\/a>)<br \/>\n\t\t<\/figcaption><\/figure>\n<p>This is already very good, given that it was relatively easy to achieve (that is once you understand WebAssembly!).<\/p>\n<p>Next, we noticed that although seqtk outputs a lot of generally useful QC metrics, many of these metrics are not actually used or graphed by our app. By removing some of the output for the metrics we didn\u2019t need, we were able to see an even greater speedup of 13X:<\/p>\n<figure><a href=\"https:\/\/i0.wp.com\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/558e9305-830e-4fc5-ae6d-0285d352c366\/webassembly-speed-web-app5.png?ssl=1\"><br \/>\n\t\t<img data-recalc-dims=\"1\" decoding=\"async\" srcset=\"http:\/\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/04\/webassembly-speed-web-app5.png 400w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_800\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/558e9305-830e-4fc5-ae6d-0285d352c366\/webassembly-speed-web-app5.png 800w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_1200\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/558e9305-830e-4fc5-ae6d-0285d352c366\/webassembly-speed-web-app5.png 1200w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_1600\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/558e9305-830e-4fc5-ae6d-0285d352c366\/webassembly-speed-web-app5.png 1600w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_2000\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/558e9305-830e-4fc5-ae6d-0285d352c366\/webassembly-speed-web-app5.png 2000w\" src=\"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/04\/webassembly-speed-web-app5.png?w=900\" sizes=\"100vw\" alt=\"Bar chart showing that we can process 13X more lines per second\"><\/a><figcaption>\n\t\t\tRemoving unnecessary outputs gives us further performance improvement. (<a href=\"https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/558e9305-830e-4fc5-ae6d-0285d352c366\/webassembly-speed-web-app5.png\">Large preview<\/a>)<br \/>\n\t\t<\/figcaption><\/figure>\n<p>This again is a great improvement given how easy it was to achieve\u2014by literally commenting out printf statements that were not needed.<\/p>\n<p>Finally, there is one more improvement we looked into. So far, the way fastq.bio obtains the metrics of interest is by calling two different C functions, each of which calculates a different set of metrics. Specifically, one function returns information in the form of a histogram (i.e. a list of values that we bin into ranges), whereas the other function returns information as a function of DNA sequence position. Unfortunately, this means that the same chunk of file is read twice, which is unnecessary.<\/p>\n<p>So we merged the code for the two functions into one\u2014albeit messy\u2014function (without even having to brush up on my C!). Since the two outputs have different numbers of columns, we did some wrangling on the JavaScript side to disentangle the two. But it was worth it: doing so allowed us to achieve a >20X speedup!<\/p>\n<figure><a href=\"https:\/\/i0.wp.com\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/41d4b2ef-fa85-4a1f-ba23-f4abbbf44ac4\/webassembly-speed-web-app6.png?ssl=1\"><br \/>\n\t\t<img data-recalc-dims=\"1\" decoding=\"async\" srcset=\"http:\/\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/04\/webassembly-speed-web-app6.png 400w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_800\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/41d4b2ef-fa85-4a1f-ba23-f4abbbf44ac4\/webassembly-speed-web-app6.png 800w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_1200\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/41d4b2ef-fa85-4a1f-ba23-f4abbbf44ac4\/webassembly-speed-web-app6.png 1200w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_1600\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/41d4b2ef-fa85-4a1f-ba23-f4abbbf44ac4\/webassembly-speed-web-app6.png 1600w,\n\t\t\t        https:\/\/res.cloudinary.com\/indysigner\/image\/fetch\/f_auto,q_auto\/w_2000\/https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/41d4b2ef-fa85-4a1f-ba23-f4abbbf44ac4\/webassembly-speed-web-app6.png 2000w\" src=\"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/04\/webassembly-speed-web-app6.png?w=900\" sizes=\"100vw\" alt=\"Bar chart showing that we can process 21X more lines per second\"><\/a><figcaption>\n\t\t\tFinally, wrangling the code such that we only read through each file chunk once gives us >20X performance improvement. (<a href=\"https:\/\/cloud.netlifyusercontent.com\/assets\/344dbf88-fdf9-42bb-adb4-46f01eedd629\/41d4b2ef-fa85-4a1f-ba23-f4abbbf44ac4\/webassembly-speed-web-app6.png\">Large preview<\/a>)<br \/>\n\t\t<\/figcaption><\/figure>\n<h3>A Word Of Caution<\/h3>\n<p>Now would be a good time for a caveat. Don\u2019t expect to always get a 20X speedup when you use WebAssembly. You might only get a 2X speedup or a 20% speedup. Or you may get a slow down if you load very large files in memory, or require a lot of communication between the WebAssembly and the JavaScript.<\/p>\n<h3>Conclusion<\/h3>\n<p>In short, we\u2019ve seen that replacing slow JavaScript computations with calls to compiled WebAssembly can lead to significant speedups. Since the code needed for those computations already existed in C, we got the added benefit of reusing a trusted tool. As we also touched upon, WebAssembly won\u2019t always be the right tool for the job (<em>gasp!<\/em>), so use it wisely.<\/p>\n<h4>Further Reading<\/h4>\n<ul>\n<li>\u201c<a href=\"http:\/\/levelupwasm.com\/\">Level Up With WebAssembly<\/a>,\u201d Robert Aboukhalil<br \/><em>A practical guide to building WebAssembly applications.<\/em><\/li>\n<li><a href=\"https:\/\/github.com\/robertaboukhalil\/aioli\">Aioli<\/a> (on GitHub)<br \/><em>A framework for building fast genomics web tools.<\/em><\/li>\n<li><a href=\"https:\/\/github.com\/robertaboukhalil\/fastq.bio\">fastq.bio source code<\/a> (on GitHub)<br \/><em>An interactive web tool for quality control of DNA sequencing data.<\/em><\/li>\n<li>\u201c<a href=\"https:\/\/www.smashingmagazine.com\/2017\/05\/abridged-cartoon-introduction-webassembly\/\">An Abridged Cartoon Introduction To WebAssembly<\/a>,\u201d Lin Clark<\/li>\n<\/ul>\n<div>\n  <img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/04\/logo-red-5.png?w=900\" alt=\"Smashing Editorial\"><span>(rb, ra, il)<\/span>\n<\/div>\n<\/article>\n<p class=\"wpematico_credit\"><small>Powered by <a href=\"http:\/\/www.wpematico.com\" target=\"_blank\">WPeMatico<\/a><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) Robert Aboukhalil 2019-04-05T12:00:29+02:002019-04-05T11:06:39+00:00 If you haven\u2019t heard, here\u2019s the TL;DR: WebAssembly is a new language that runs in the browser alongside JavaScript. Yes, that\u2019s right. JavaScript is&#8230;<a class=\"moretag\" href=\"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/\"> Read the full article&#8230;<\/a><\/p>\n","protected":false},"author":4,"featured_media":63149,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[371],"tags":[],"class_list":["post-63148","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-user-experience"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) Robert Aboukhalil 2019-04-05T12:00:29+02:002019-04-05T11:06:39+00:00If you haven\u2019t heard, here\u2019s the TL;DR: WebAssembly is a new language that runs in the browser alongside JavaScript. Yes, that\u2019s right. JavaScript is no longer\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Guest Contribution\"\/>\n\t<meta name=\"keywords\" content=\"user experience\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Design for Immersive Technologies | User Experience for Games, Virtual Reality (VR) and Augmented\/Mixed Reality (AR\/MR)\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) | Design for Immersive Technologies\" \/>\n\t\t<meta property=\"og:description\" content=\"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) Robert Aboukhalil 2019-04-05T12:00:29+02:002019-04-05T11:06:39+00:00If you haven\u2019t heard, here\u2019s the TL;DR: WebAssembly is a new language that runs in the browser alongside JavaScript. Yes, that\u2019s right. JavaScript is no longer\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-04-05T11:19:17+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-04-05T11:19:17+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) | Design for Immersive Technologies\" \/>\n\t\t<meta name=\"twitter:description\" content=\"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) Robert Aboukhalil 2019-04-05T12:00:29+02:002019-04-05T11:06:39+00:00If you haven\u2019t heard, here\u2019s the TL;DR: WebAssembly is a new language that runs in the browser alongside JavaScript. Yes, that\u2019s right. JavaScript is no longer\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/04\\\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\\\/#article\",\"name\":\"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) | Design for Immersive Technologies\",\"headline\":\"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)\",\"author\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.taterboy.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/webassembly-speed-web-app1.png?fit=400%2C312&ssl=1\",\"width\":400,\"height\":312},\"datePublished\":\"2019-04-05T04:19:17-07:00\",\"dateModified\":\"2019-04-05T04:19:17-07:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/04\\\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/04\\\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\\\/#webpage\"},\"articleSection\":\"User Experience\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/04\\\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.taterboy.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/category\\\/user-experience\\\/#listItem\",\"name\":\"User Experience\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/category\\\/user-experience\\\/#listItem\",\"position\":2,\"name\":\"User Experience\",\"item\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/category\\\/user-experience\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/04\\\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\\\/#listItem\",\"name\":\"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/04\\\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\\\/#listItem\",\"position\":3,\"name\":\"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/category\\\/user-experience\\\/#listItem\",\"name\":\"User Experience\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#organization\",\"name\":\"Design for Immersive Technologies\",\"description\":\"User Experience for Games, Virtual Reality (VR) and Augmented\\\/Mixed Reality (AR\\\/MR)\",\"url\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/#author\",\"url\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/\",\"name\":\"Guest Contribution\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/04\\\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d2aad73eb0f48c67b141e9fc978a0e498969791ed623346e361d02d19775b0bb?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Guest Contribution\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/04\\\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\\\/#webpage\",\"url\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/04\\\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\\\/\",\"name\":\"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) | Design for Immersive Technologies\",\"description\":\"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) Robert Aboukhalil 2019-04-05T12:00:29+02:002019-04-05T11:06:39+00:00If you haven\\u2019t heard, here\\u2019s the TL;DR: WebAssembly is a new language that runs in the browser alongside JavaScript. Yes, that\\u2019s right. JavaScript is no longer\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/04\\\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/author\\\/guestcontribution\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.taterboy.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/webassembly-speed-web-app1.png?fit=400%2C312&ssl=1\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/04\\\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\\\/#mainImage\",\"width\":400,\"height\":312},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/2019\\\/04\\\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\\\/#mainImage\"},\"datePublished\":\"2019-04-05T04:19:17-07:00\",\"dateModified\":\"2019-04-05T04:19:17-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/\",\"name\":\"Design for Immersive Technologies\",\"description\":\"User Experience for Games, Virtual Reality (VR) and Augmented\\\/Mixed Reality (AR\\\/MR)\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.taterboy.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) | Design for Immersive Technologies","description":"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) Robert Aboukhalil 2019-04-05T12:00:29+02:002019-04-05T11:06:39+00:00If you haven\u2019t heard, here\u2019s the TL;DR: WebAssembly is a new language that runs in the browser alongside JavaScript. Yes, that\u2019s right. JavaScript is no longer","canonical_url":"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/","robots":"max-image-preview:large","keywords":"user experience","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/#article","name":"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) | Design for Immersive Technologies","headline":"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)","author":{"@id":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/#author"},"publisher":{"@id":"https:\/\/www.taterboy.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/04\/webassembly-speed-web-app1.png?fit=400%2C312&ssl=1","width":400,"height":312},"datePublished":"2019-04-05T04:19:17-07:00","dateModified":"2019-04-05T04:19:17-07:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/#webpage"},"isPartOf":{"@id":"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/#webpage"},"articleSection":"User Experience"},{"@type":"BreadcrumbList","@id":"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.taterboy.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/#listItem","name":"User Experience"}},{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/#listItem","position":2,"name":"User Experience","item":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/#listItem","name":"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/#listItem","position":3,"name":"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)","previousItem":{"@type":"ListItem","@id":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/#listItem","name":"User Experience"}}]},{"@type":"Organization","@id":"https:\/\/www.taterboy.com\/blog\/#organization","name":"Design for Immersive Technologies","description":"User Experience for Games, Virtual Reality (VR) and Augmented\/Mixed Reality (AR\/MR)","url":"https:\/\/www.taterboy.com\/blog\/"},{"@type":"Person","@id":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/#author","url":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/","name":"Guest Contribution","image":{"@type":"ImageObject","@id":"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/d2aad73eb0f48c67b141e9fc978a0e498969791ed623346e361d02d19775b0bb?s=96&d=mm&r=g","width":96,"height":96,"caption":"Guest Contribution"}},{"@type":"WebPage","@id":"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/#webpage","url":"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/","name":"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) | Design for Immersive Technologies","description":"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) Robert Aboukhalil 2019-04-05T12:00:29+02:002019-04-05T11:06:39+00:00If you haven\u2019t heard, here\u2019s the TL;DR: WebAssembly is a new language that runs in the browser alongside JavaScript. Yes, that\u2019s right. JavaScript is no longer","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.taterboy.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/#breadcrumblist"},"author":{"@id":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/#author"},"creator":{"@id":"https:\/\/www.taterboy.com\/blog\/author\/guestcontribution\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/04\/webassembly-speed-web-app1.png?fit=400%2C312&ssl=1","@id":"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/#mainImage","width":400,"height":312},"primaryImageOfPage":{"@id":"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/#mainImage"},"datePublished":"2019-04-05T04:19:17-07:00","dateModified":"2019-04-05T04:19:17-07:00"},{"@type":"WebSite","@id":"https:\/\/www.taterboy.com\/blog\/#website","url":"https:\/\/www.taterboy.com\/blog\/","name":"Design for Immersive Technologies","description":"User Experience for Games, Virtual Reality (VR) and Augmented\/Mixed Reality (AR\/MR)","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.taterboy.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Design for Immersive Technologies | User Experience for Games, Virtual Reality (VR) and Augmented\/Mixed Reality (AR\/MR)","og:type":"article","og:title":"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) | Design for Immersive Technologies","og:description":"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) Robert Aboukhalil 2019-04-05T12:00:29+02:002019-04-05T11:06:39+00:00If you haven\u2019t heard, here\u2019s the TL;DR: WebAssembly is a new language that runs in the browser alongside JavaScript. Yes, that\u2019s right. JavaScript is no longer","og:url":"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/","article:published_time":"2019-04-05T11:19:17+00:00","article:modified_time":"2019-04-05T11:19:17+00:00","twitter:card":"summary","twitter:title":"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) | Design for Immersive Technologies","twitter:description":"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study) Robert Aboukhalil 2019-04-05T12:00:29+02:002019-04-05T11:06:39+00:00If you haven\u2019t heard, here\u2019s the TL;DR: WebAssembly is a new language that runs in the browser alongside JavaScript. Yes, that\u2019s right. JavaScript is no longer"},"aioseo_meta_data":{"post_id":"63148","title":null,"description":null,"keywords":null,"keyphrases":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_custom_image_width":null,"og_custom_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"created":"2021-02-07 21:10:03","updated":"2026-09-01 08:03:18","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"twitter_image_url":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.taterboy.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/\" title=\"User Experience\">User Experience<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHow We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.taterboy.com\/blog"},{"label":"User Experience","link":"https:\/\/www.taterboy.com\/blog\/category\/user-experience\/"},{"label":"How We Used WebAssembly To Speed Up Our Web App By 20X (Case Study)","link":"https:\/\/www.taterboy.com\/blog\/2019\/04\/how-we-used-webassembly-to-speed-up-our-web-app-by-20x-case-study\/"}],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8wzr5-gqw","jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.taterboy.com\/blog\/wp-content\/uploads\/2019\/04\/webassembly-speed-web-app1.png?fit=400%2C312&ssl=1","_links":{"self":[{"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/posts\/63148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/comments?post=63148"}],"version-history":[{"count":0,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/posts\/63148\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/media\/63149"}],"wp:attachment":[{"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/media?parent=63148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/categories?post=63148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.taterboy.com\/blog\/wp-json\/wp\/v2\/tags?post=63148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}