Paweł Aniszewski

Speeding up Web Apps performance with WebAssembly and Emscripten

Is WebAssembly really a 'go faster' button for JavaScript? Learn its true strength for CPU-bound tasks and porting existing native libraries.

Speeding up Web Apps performance with WebAssembly and Emscripten
#1about 2 minutes

Compiling C to WebAssembly using only Clang

Learn the basics of WebAssembly and see how to compile a simple C function without extra tooling, highlighting the manual memory management required.

#2about 4 minutes

Simplifying WebAssembly development with Emscripten

Emscripten acts as a toolchain that emulates an OS environment, providing a standard library and tools like Embind to easily bind C++ classes to JavaScript.

#3about 3 minutes

Interoperability and non-blocking execution with Emscripten

Use Emscripten's macros like EM_JS to call JavaScript from C++ and proxy heavy computations to a web worker to keep the main UI thread responsive.

#4about 1 minute

Identifying key use cases for WebAssembly

WebAssembly is ideal for CPU-bound tasks or for reusing existing native C, C++, or Rust libraries in the browser, as seen in apps like Figma and SQL.js.

#5about 3 minutes

Benchmarking Wasm performance with SIMD instructions

A benchmark shows that while scalar operations in Wasm are only slightly faster than JavaScript, using SIMD instructions provides a significant performance boost for numerical computations.

#6about 3 minutes

Case study: Porting the libsecp crypto library to Wasm

See how the native Bitcoin Core library libsecp is compiled to WebAssembly using Emscripten's AutoTools wrappers, resulting in a 9x performance increase over its JavaScript equivalent.

#7about 5 minutes

Weighing the pros and cons of using WebAssembly

Evaluate the trade-offs by understanding when to use Wasm for performance gains versus the costs of maintenance, memory management, and increased bundle size.

#8about 3 minutes

Using WebAssembly for code reuse across platforms

The Privymix project uses WebAssembly not for speed, but to maintain a single C++ client library for cryptography that can be deployed across multiple environments.

#9about 6 minutes

Practical tips for building and optimizing Wasm libraries

Learn best practices for maintaining Wasm libraries, including API design with TypeScript wrappers, CI version pinning, and using Emscripten flags to reduce bundle size.

#10about 1 minute

Summary of key takeaways for using WebAssembly

A final review of the core concepts, emphasizing that WebAssembly is a powerful tool for reusing native code and handling CPU-bound work, not a simple "go faster" wrapper.

Related jobs
Jobs that call for the skills explored in this talk.

Featured Partners

Related Articles

View all articles

From learning to earning

Jobs that call for the skills explored in this talk.