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
100
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
71
Building Reactive Microservices with Kotlin & running on Kubernetes
sendilkumarn
0
150
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
210
Other Decks in Technology
See All in Technology
AWS⼊社という選択肢、⾒えていますか
iwamot
2
1.1k
[JAWS-UG金沢支部×コンテナ支部合同企画]コンテナとは何か
furuton
3
340
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
1
340
透過型SMTPプロキシによる送信メールの可観測性向上: Update Edition / Improved observability of outgoing emails with transparent smtp proxy: Update edition
linyows
2
180
Spring Frameworkの新標準!? ~ RestClientとHTTPインターフェース入門 ~
ogiwarat
2
250
ドメイン名の終活について - JPAAWG 7th -
mikit
29
16k
福岡新卒エンジニアの会
teba_eleven
1
180
スクラムチームを立ち上げる〜チーム開発で得られたもの・得られなかったもの〜
ohnoeight
1
280
Windows Autopilot Deployment by OSD Guy
tamaiyutaro
0
300
FOSS4G 2024 Japan コアデイ 一般発表25 PythonでPLATEAUのデータを手軽に扱ってみる
ra0kley
1
130
Lexical Analysis
shigashiyama
1
130
What to do after `laravel new`
mattstauffer
0
140
Featured
See All Featured
Faster Mobile Websites
deanohume
305
30k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Bash Introduction
62gerente
608
210k
A designer walks into a library…
pauljervisheath
202
24k
GraphQLとの向き合い方2022年版
quramy
43
13k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Being A Developer After 40
akosma
86
590k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
4 Signs Your Business is Dying
shpigford
180
21k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
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