Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
WebAssembly in NodeJS
Search
Willian Martins
October 17, 2017
Technology
660
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
WebAssembly in NodeJS
My presentation about WASM in NodeJS @ NodeJS Meetup Berlin
Willian Martins
October 17, 2017
More Decks by Willian Martins
See All by Willian Martins
Empirical Observations on the The Future of Scalable UI Architecture
wmsbill
0
180
Além do else! Categorizando Pokemóns com Pattern Matching no JavaScript
wmsbill
0
900
De volta ao Futuro do JS: As próximas features e propostas incríveis
wmsbill
0
120
Back to the future of JS II: Beyond what we can foresee
wmsbill
0
150
A, B, C. 1, 2, 3. Iterables you and me.
wmsbill
0
140
Back to the future of JS II: Beyond what we can foresee
wmsbill
0
150
Back to the future of JS.
wmsbill
0
11
Node conf ar 2018.
wmsbill
0
670
Back to the future of JS
wmsbill
1
100
Other Decks in Technology
See All in Technology
[General] 개발자로 해외 기업에서 일하기
skydoves
1
310
[dbts2026]数十PBの超巨大データ×AI活用を支えるSnowflakeの実力〜大規模環境におけるアーキテクチャと運用のリアル〜
y_matsubara
0
110
AIコーディングはじめました
miso
0
150
IBC 2026 動画技術関連レポート / IBC 2026 Report
cyberagentdevelopers
PRO
2
440
レガシーコードに対する loop engineering的なAI開発プロセス導入について
kubell_hr
0
280
登壇はいいぞ! 〜Kaigi on Railsに登壇して起きた3つの変化〜
occhi
0
110
AX時代の自治体支援リソース再配分と役割分担の再構成:戦略とロードマップ(概要)
sishi2026
0
200
AI時代の組織作り:チーム開発から「個人×AI」への移行と、持続可能な「開発資本」の築き方
ham0215
2
310
In-Context Learning再入門。ICLの勾配降下的解釈の研究動向を追ってみる。
dai08srhg
1
710
Copilot Coworkで「みのるん式」やってみた
minorun365
PRO
2
1.6k
DBTS2026 盛り上がってますか!?Databricksが実現するAI時代のデータ基盤
akuwano
1
190
Kiro Crew 入門 (手を離しても進む仕事) | 目指せ Kiro マスター 11
inariku
PRO
4
510
Featured
See All Featured
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
970
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
GraphQLとの向き合い方2022年版
quramy
50
15k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
470
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
380
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
760
Speed Design
sergeychernyshev
33
2.2k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.4k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.8k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
450
The SEO Collaboration Effect
kristinabergwall1
1
620
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.8k
Transcript
The Need for Speed and WebAssembly Willian Martins Autumn 2017
None
Timeline…
How did we achieve it Moore law Pushed Tech industries
to evolve until today Allowed huge computation power even on small devices
All this power for what? Faster applications More immersive games
Virtual reality Augmented reality Live video/image processing Big Data/Machine learning
The languages over time
But what about JS?
JS - Early days Created in 1995 by Brendan Eich
Was written in 11 days Designed to be easy and simple Designed to be a glue code for dynamic Web
None
JS - 2008 until now 2008 - JIT Compiler by
google w/ Chrome Jump of performance Allowed more complex applications What is the next step?
Willian Elia @wmsbill
None
WE’RE HIRING!!
What is WebAssembly?
What’s WebAssembly? New binary format Run compiled programs (C, C++,
Rust) on a browser Works alongside Javascript Performance and flexibility API
Why WebAssembly is faster?
V8 - JiT in action
V8 - JiT in action
V8 - JiT in action
V8 - JiT in action
V8 - JiT in action
V8 - JiT in action
V8 - JiT in action
JiT: Code life cycle in summary 1. Parse 2. Compile
3. Optimize (de-optimize) 4. Execute 5. Garbage Collector
WebAssembly
WebAssembly is fast Parse Compile Optimize Execute GC Decode Compile
+ Optimize Execute JS WASM
WebAssembly is fast WASM is more compact -> Faster FETCH
of the source WASM is closer to machine code -> Faster DECODING, COMPILING and OPTIMISING No need to RE-OPTIMISE No garbage collection
So WebAssembly looks fast, let’s see how to use it
How to run WASM modules Current situation: not possible to
run WASM modules on their own Need for some Javascript glue
WebAssembly JS API 1. Fetch/Load the module binary 2. Instantiate
it 3. Access exported functionalities
fs.readFile(‘./module.wasm’, async function(err, file) => { const { instance }
= await WebAssembly.instantiate(file); // Do something with the compiled results! });
How to generate a WASM file
Compile C to WASM + JS WASM emcc my-module.c -o
my-module.js -s WASM=1
Then we can simply import the generated JS code as
a module
Export functions to JS Keyword EMSCRIPTEN_KEEPALIVE EMSCRIPTEN_KEEPALIVE int sum(int x,
int y) { return x + y; } Expose only the interface of the WASM module to JS
What about WebAssembly memory? How can we access it?
Memory management Emscripten provide three useful functions to manage WebAssembly
memory _malloc(memoryNeeded) getValue(ptr, type) setValue(ptr, value, type)
Elia @eliamain
DEMO TIME
The WASM implementation was still slower
Why??
JIT handover
“Currently, calling a WebAssembly function in JS code is slower
than it needs to be. The JIT doesn’t know how to deal directly with WebAssembly, so it has to route the WebAssembly to something that does. … This can be up to 100x slower than it would be if the JIT knew how to handle it directly. ” Lin Clark
The future of WebAssembly
Future features Formal Specification Threads supports SIMD acronym to Single
Instruction Multiple Data (back to Stage 3 on TC39) Exception handling Garbage collection Direct DOM access ES6 Module integration
Danke! Thank you!
What about Native modules?