Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Rust and WebAssembly for the masses
Search
Sendil Kumar N
February 05, 2020
Technology
1
110
Rust and WebAssembly for the masses
Sendil Kumar N
February 05, 2020
Tweet
Share
More Decks by Sendil Kumar N
See All by Sendil Kumar N
[Heapcon-2023] Building High Performance Web Applications
sendilkumarn
0
72
Building Reactive Microservices with Kotlin & running on Kubernetes
sendilkumarn
0
160
Building Reactive Microservices with JHipster & K8s
sendilkumarn
0
18
Designing High Performance React Applications
sendilkumarn
1
140
Batching, Suspense, and Server Components
sendilkumarn
0
33
DevNexus_Building_with__Zero_Trust_Architecture_Copy.pdf
sendilkumarn
0
55
Lessons Learnt with Visual Testing and Snapshots
sendilkumarn
0
100
Easy Microservices with K8s & Istio
sendilkumarn
0
85
KHipster - Kotlin Hipster
sendilkumarn
0
220
Other Decks in Technology
See All in Technology
なぜCodeceptJSを選んだか
goataka
0
160
KubeCon NA 2024 Recap / Running WebAssembly (Wasm) Workloads Side-by-Side with Container Workloads
z63d
1
250
コンテナセキュリティのためのLandlock入門
nullpo_head
2
320
バクラクのドキュメント解析技術と実データにおける課題 / layerx-ccc-winter-2024
shimacos
2
1.1k
宇宙ベンチャーにおける最近の情シス取り組みについて
axelmizu
0
110
継続的にアウトカムを生み出し ビジネスにつなげる、 戦略と運営に対するタイミーのQUEST(探求)
zigorou
0
600
生成AIをより賢く エンジニアのための RAG入門 - Oracle AI Jam Session #20
kutsushitaneko
4
260
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
150
終了の危機にあった15年続くWebサービスを全力で存続させる - phpcon2024
yositosi
18
17k
社内イベント管理システムを1週間でAKSからACAに移行した話し
shingo_kawahara
0
190
20241220_S3 tablesの使い方を検証してみた
handy
4
630
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
210
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
Code Review Best Practice
trishagee
65
17k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Producing Creativity
orderedlist
PRO
341
39k
Embracing the Ebb and Flow
colly
84
4.5k
A Philosophy of Restraint
colly
203
16k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Agile that works and the tools we love
rasmusluckow
328
21k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Documentation Writing (for coders)
carmenintech
66
4.5k
Scaling GitHub
holman
458
140k
Transcript
@sendilkumarn Hej! Stockholm
@sendilkumarn Every progra!"ing language has trade-offs. Choose one that solves
your problem, not creates one.
Rust and WebAssembly Sendil Kumar N
@sendilkumarn Sendil Kumar
@sendilkumarn
@sendilkumarn Netherlands
@sendilkumarn Senior Software Engineer @uber
@sendilkumarn Passionate about Open Source Senior Software Engineer @uber
@sendilkumarn Passionate about Open Source Senior Software Engineer @uber Team
member @JHipster
@sendilkumarn Passionate about Open Source Senior Software Engineer @uber Team
member @JHipster Hacking on WebAssembly
What is WASM? How WASM helps? DEMO Why Rust? Rust
and WASM DEMO WASM Roadmap Agenda @sendilkumarn
WebAssembly @sendilkumarn
Yet Another Frontend framework?
@sendilkumarn 00 61 73 6D 01 00 00 00 Native
Code WebAssembly Binary JavaScript Javascript Engine
@sendilkumarn func add is called Stack get_local $lhs LHS RHS
get_local $rhs i32.add SUM Structured stack machine
@sendilkumarn 00 61 73 6D 01 00 00 00 Size
& Load time efficient
@sendilkumarn Native Speed 00 61 73 6D 01 00 00
00
@sendilkumarn madewithwebassembly.com
Why not JavaScript? @sendilkumarn
JavaScript is awesome @sendilkumarn
JavaScript is easy @sendilkumarn
JavaScript is weird* * - sometimes @sendilkumarn
[] + {} @sendilkumarn
[] + {} “[object Object]” @sendilkumarn
{} + [] @sendilkumarn
0 {} + [] @sendilkumarn
[] + {} === {} + [] @sendilkumarn
[] + {} === {} + [] True @sendilkumarn
@sendilkumarn JavaScript Tuning
@sendilkumarn Types
@sendilkumarn Polymorphism
@sendilkumarn Unpredictable Performance
@sendilkumarn Runtime exceptions
@sendilkumarn A B
@sendilkumarn A B [empty x 5] []
@sendilkumarn A B [1, empty x 4] [1, 2, empty
x 3] [1, 2, 3, empty x 2] [1, 2, 3, 4, empty x 1] [1, 2, 3, 4, 5] [1] [1, 2] [1, 2, 3] [1, 2, 3, 4] [1, 2, 3, 4, 5]
@sendilkumarn A B Holey Array Packed Array
@sendilkumarn How WebAssembly address the problems?
@sendilkumarn Speed
@sendilkumarn Near Native perf.
@sendilkumarn ˜30% faster than JS
@sendilkumarn Boundary Crossing
@sendilkumarn Not always faster
@sendilkumarn WebAssembly is secure
@sendilkumarn Linear Memory Model
@sendilkumarn Shared Array Buffer
@sendilkumarn How it works… Why it is faster?
@sendilkumarn JavaScript Execution
@sendilkumarn Load JavaScript
@sendilkumarn a.js AST 1001010010101101010 Execute Profiler Parse Interpret Compile 100101001010
Optimise 1010 GC
@sendilkumarn WebAssembly Execution
@sendilkumarn Load WebAssembly
@sendilkumarn Decode Compile Execute 00 61 73 6D 00 61
73 6D 00 61 73 6D
@sendilkumarn PARSE COMPILE OPTIMISE EXECUTE GC JavaScript execution DECODE COMPILE
EXECUTE WebAssembly execution
@sendilkumarn PARSE COMPILE OPTIMISE EXECUTE GC JavaScript execution DECODE COMPILE
EXECUTE WebAssembly execution I am faster
@sendilkumarn PARSE COMPILE OPTIMISE EXECUTE GC JavaScript execution DECODE COMPILE
EXECUTE WebAssembly execution Optimised already
@sendilkumarn Streaming compilation
@sendilkumarn Typed
@sendilkumarn (module )
@sendilkumarn (module (func $add (param $lhs i32) (param $rhs i32)
(result i32) (get_local $lhs) (get_local $rhs) (i32.add) ) )
@sendilkumarn (module (func $add (param $lhs i32) (param $rhs i32)
(result i32) (get_local $lhs) (get_local $rhs) (i32.add) ) (export “add” (func $add)) )
@sendilkumarn i32 i64 f32 f64 00 61 73 6D 01
00 00 00 WebAssembly Binary JavaScript Javascript Engine
Demo bit.ly/wasm2020-001 @sendilkumarn
Why Rust? @sendilkumarn
@sendilkumarn Blazingly fast @sendilkumarn
@sendilkumarn Memory Safety
@sendilkumarn Productivity
@sendilkumarn Friendly compiler
@sendilkumarn Better tooling support
@sendilkumarn Awesome co!"unity
@sendilkumarn Modern language
@sendilkumarn Crates
@sendilkumarn wasm_bindgen https://github.com/rustwasm/wasm-bindgen
@sendilkumarn i32 i64 f32 f64 00 61 73 6D 01
00 00 00 WebAssembly Binary JavaScript Javascript Engine
@sendilkumarn 00 61 73 6D 01 00 00 00 WebAssembly
Binary JavaScript Javascript Engine Binding JS file JS API WEB API JS SYS WEB SYS
@sendilkumarn wasm_pack https://github.com/rustwasm/wasm-pack
@sendilkumarn PACK PUBLISH TEST BUILD
@sendilkumarn wasm_snip https://github.com/rustwasm/wasm-snip
@sendilkumarn twiggy https://github.com/rustwasm/twiggy
@sendilkumarn Rust demo First demo wasm-game-of-life
@sendilkumarn Future
@sendilkumarn Threads
@sendilkumarn ⚠ Exception Handling
@sendilkumarn ♻ Garbage Collection
@sendilkumarn WebAssembly provides a platform to plug and play best
parts from different languages and use them together.
@sendilkumarn Questions…
@sendilkumarn Thanks… @sendilkumarn dev.to/sendilkumarn sendilkumarn.com/blog