Slide 1

Slide 1 text

chrome://modern-webassembly

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

WebAssembly?

Slide 4

Slide 4 text

aka, WASM [਋ই્]

Slide 5

Slide 5 text

https://blog.logrocket.com/webassembly-how-and-why-559b7f96cd71 WebAssembly? - ਢীࢲ ز੘ೞח ࢜۽਍ ঱য - ׮ܲ ঱য۽ ࠗఠ ஹ౵ੌ - ୭੸ച غҊ ੌҙࢿ ੓ח ࢿמ - ੗߄झ௼݀౟ܳ ؀୓ ೞ૑ ঋ਺

Slide 6

Slide 6 text

WebAssembly

Slide 7

Slide 7 text

https://blog.logrocket.com/webassembly-how-and-why-559b7f96cd71 WebAssembly? - ਢীࢲ ز੘ೞח ࢜۽਍ ঱য - ׮ܲ ঱য۽ ࠗఠ ஹ౵ੌ - ୭੸ച غҊ ੌҙࢿ ੓ח ࢿמ - ੗߄झ௼݀౟ܳ ؀୓ ೞ૑ ঋ਺

Slide 8

Slide 8 text

wasm-pack build WAT .wasm

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

WebAssembly Instructions Stack 0 0 (I32, i32) -> (i32) 1 (I64, i64) -> () 0 Type 0 1 Type 1 0 Code for Func 0 1 Code for Func 1 1 3 4 5 6 8 0 1 2 3 4 $type0 Memory Type Function Code $func0 i32.store
 i32.load 2 7 ArrayBuffer i32.add
 get_local $p1
 get_local $p1 pop push

Slide 11

Slide 11 text

Value Types i32, i64, f32, f64 Linear Memory Access ii32.load, i64.load, f32.load, f64.load, i64.store, f32.store, f64.store, and more Local, Global Variable get_local, set_local, tee_local, get_global, set_global Control constructs and instructions nop, block, loop, if, else, br, br_if, br_table, return, end Calls call, call_indirect Constants i32.const, i64.const, f32.const, f64.const, Operators i32.add, i32.sub, i32.mul, f32.add, f32.sub, f32.mul, f32.div, f32.abs, f64.add, f64.sub, and more

Slide 12

Slide 12 text

https://hacks.mozilla.org/2017/07/memory-in-webassembly-and-why-its-safer-than-you-think/

Slide 13

Slide 13 text

https://hacks.mozilla.org/2017/07/memory-in-webassembly-and-why-its-safer-than-you-think/

Slide 14

Slide 14 text

https://hacks.mozilla.org/2017/07/memory-in-webassembly-and-why-its-safer-than-you-think/

Slide 15

Slide 15 text

https://hacks.mozilla.org/2017/07/memory-in-webassembly-and-why-its-safer-than-you-think/

Slide 16

Slide 16 text

https://hacks.mozilla.org/2017/07/memory-in-webassembly-and-why-its-safer-than-you-think/

Slide 17

Slide 17 text

https://hacks.mozilla.org/2017/07/memory-in-webassembly-and-why-its-safer-than-you-think/

Slide 18

Slide 18 text

https://hacks.mozilla.org/2017/07/memory-in-webassembly-and-why-its-safer-than-you-think/

Slide 19

Slide 19 text

https://blog.logrocket.com/webassembly-how-and-why-559b7f96cd71 WebAssembly? - ਢীࢲ ز੘ೞח ࢜۽਍ ঱য - ׮ܲ ঱য۽ ࠗఠ ஹ౵ੌ - ୭੸ച غҊ ੌҙࢿ ੓ח ࢿמ - ੗߄झ௼݀౟ܳ ؀୓ ೞ૑ ঋ਺

Slide 20

Slide 20 text

https://www.youtube.com/watch?v=njt-Qzw0mVY

Slide 21

Slide 21 text

https://www.youtube.com/watch?v=njt-Qzw0mVY

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Javascript
 Source Code Ignition
 (JS Interpreter) TurboFan
 (Optimization Compiler) Deoptimize Optimize
 (Profile Data) Bytecode Optimized
 Code Collecting
 Information Profiling Data Javascript Pipeline

Slide 24

Slide 24 text

Liftoff
 (WebAssembly baseline compiler) Hot Swap Execution
 Immediately WASM TurboFan
 (Optimization Compiler) Off-thread
 Optimization WebAssembly Pipeline

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

https://developers.google.com/web/updates/2019/02/hotpath-with-wasm

Slide 29

Slide 29 text

https://developers.google.com/web/updates/2019/02/hotpath-with-wasm

Slide 30

Slide 30 text

WebAssembly? - ਢীࢲ ز੘ೞח ࢜۽਍ ঱য - ׮ܲ ঱য۽ ࠗఠ ஹ౵ੌ - ୭੸ച غҊ ੌҙࢿ ੓ח ࢿמ - ੗߄झ௼݀౟ܳ ؀୓ ೞ૑ ঋ਺

Slide 31

Slide 31 text

WebAssembly Javascript

Slide 32

Slide 32 text

WebAssembly ??

Slide 33

Slide 33 text

https://github.com/ragingwind/wasm-hnpwa

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

Demo

Slide 38

Slide 38 text

WebAssembly

Slide 39

Slide 39 text

Implicit Caching Liftoff
 (WebAssembly baseline compiler) Hot Swap Execution
 Immediately WASM TurboFan
 (Optimization Compiler) Off-thread
 Optimization https://www.youtube.com/watch?v=kZrl91SPSpc

Slide 40

Slide 40 text

Implicit Caching Liftoff
 (WebAssembly baseline compiler) Hot Swap Execution
 Immediately WASM TurboFan
 (Optimization Compiler) Off-thread
 Optimization HTTP Cache Loads Optimized Module https://www.youtube.com/watch?v=kZrl91SPSpc New Session

Slide 41

Slide 41 text

Implicit Caching

Slide 42

Slide 42 text

Implicit Caching WebAssembly HTTP Cache Keep your URLs stable

Slide 43

Slide 43 text

https://www.youtube.com/watch?v=kZrl91SPSpc Startup Time

Slide 44

Slide 44 text

SharedArrayBuffer Threads Worker
 CPU Core WASM Instance Worker
 CPU Core WASM Instance Worker
 CPU Core WASM Instance https://www.youtube.com/watch?v=kZrl91SPSpc atomic.wait atomic.notify

Slide 45

Slide 45 text

Threads in C https://github.com/ragingwind/wasm-hello-world/tree/master/clang-thread

Slide 46

Slide 46 text

Threads in Rust https://github.com/ragingwind/wasm-hello-world/tree/master/rust-thread worker.js lib.rs

Slide 47

Slide 47 text

Threads in Rust https://github.com/ragingwind/wasm-hello-world/tree/master/rust-thread

Slide 48

Slide 48 text

https://medium.com/google-earth/performance-of-web-assembly-a-thread-on-threading-54f62fd50cf7 Threads

Slide 49

Slide 49 text

https://www.youtube.com/watch?v=kZrl91SPSpc Threads

Slide 50

Slide 50 text

Threads https://www.youtube.com/watch?v=kZrl91SPSpc

Slide 51

Slide 51 text

✅ ❌ Threads

Slide 52

Slide 52 text

SIMD Single Instruction, Multiple Data

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

https://github.com/google/mediapipe/blob/master/mediapipe/docs/web.md Chrome Canary with #enable-webassembly-simd

Slide 55

Slide 55 text

https://www.youtube.com/watch?v=kZrl91SPSpc

Slide 56

Slide 56 text

https://www.youtube.com/watch?v=kZrl91SPSpc

Slide 57

Slide 57 text

https://www.youtube.com/watch?v=kZrl91SPSpc

Slide 58

Slide 58 text

https://www.youtube.com/watch?v=kZrl91SPSpc

Slide 59

Slide 59 text

https://www.youtube.com/watch?v=kZrl91SPSpc

Slide 60

Slide 60 text

Tooling Updates - Native LLVM + WASM (clang +Binaryen) - Asyncify, Using asynchronous APIs - Debugging, WAT format, Source map, Native debugging

Slide 61

Slide 61 text

Native LLVM Backend https://www.youtube.com/watch?v=kZrl91SPSpc

Slide 62

Slide 62 text

Native LLVM Backend https://www.youtube.com/watch?v=kZrl91SPSpc

Slide 63

Slide 63 text

https://dassur.ma/things/c-to-webassembly/

Slide 64

Slide 64 text

Native LLVM Backend https://v8.dev/blog/emscripten-llvm-wasm

Slide 65

Slide 65 text

Native LLVM Backend https://v8.dev/blog/emscripten-llvm-wasm

Slide 66

Slide 66 text

Tooling Updates - Native LLVM + WASM (clang +Binaryen) - Asyncify, Using asynchronous APIs - Debugging, WAT format, Source map, Native debugging

Slide 67

Slide 67 text

Asyncify https://www.youtube.com/watch?v=kZrl91SPSpc

Slide 68

Slide 68 text

Asyncify https://www.youtube.com/watch?v=kZrl91SPSpc

Slide 69

Slide 69 text

$ emcc example.c -O3 -o a.html -s ASYNCIFY -s 'ASYNCIFY_IMPORTS=["do_fetch"]' Asyncify

Slide 70

Slide 70 text

Tooling Updates - Native LLVM + WASM (clang +Binaryen) - Asyncify, Using asynchronous APIs - Debugging, WAT format, Source map, Native debugging

Slide 71

Slide 71 text

WAT Debugging

Slide 72

Slide 72 text

Sourcemap, Native Debugging $ rustc -g --target wasm32-unknown-unknown -O ./src/lib.rs -o ./pkg/square.wasm

Slide 73

Slide 73 text

WebAssembly

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

https://hacks.mozilla.org/2019/11/announcing-the-bytecode-alliance/

Slide 76

Slide 76 text

https://github.com/WebAssembly/interface-types/blob/master/proposals/interface-types/Explainer.md Interface Types

Slide 77

Slide 77 text

https://hacks.mozilla.org/2019/08/webassembly-interface-types/

Slide 78

Slide 78 text

WebAssembly