Emscripten and asm.js: C++'s role in the modern web
summary
LLVM+clang → Emscripten emits JavaScript (an asm.js subset) that views program memory as an ArrayBuffer heap with typed‑array views, uses tricks like or|0 coercion for 32‑bit integers, and maps C++ exceptions onto JS exceptions. Measured performance sits around 50–67% of native on large benchmarks (Box2D, Bullet, Lua VM, zlib); big builds take seconds (roughly 5–10s) to compile, current limits include 32‑bit integer emulation and no shared‑memory threads (only web workers).
AI-written summary · about
chapters (10)
- 0:00The case for C++ on the web
- 2:00Compiling C++ to JavaScript
- 4:29Working with Emscripten
- 6:06Architecture and libraries
- 8:28Emitted code and asm.js
- 14:49Fundamental design differences
- 21:06Performance optimization
- 25:15Benchmarks and real-world use
- 31:43Handling exceptions
- 37:54Q&A and closing thoughts
related talks
45mEmscripten
39mBringing the power of C++ to the web
39mWebAssembly for the rest of us
23mA Love Story Between JavaScript and C++
30mNative Speed on the Web: JavaScript and asm.js
42mWebAssembly: A New Compilation Target for the Web
46mTurbocharging Client-Side Processing: Leveraging asm.js
42mWebAssembly? Web and Assembler? WTF!
