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
Wasm 101
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Polina Gurtovaya
March 19, 2020
Programming
520
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Wasm 101
WebAssembly с нуля :)
Polina Gurtovaya
March 19, 2020
More Decks by Polina Gurtovaya
See All by Polina Gurtovaya
Не учите алгоритмы
hellsquirrel
1
1k
Давайте все заблокируем
hellsquirrel
0
370
Wasmысле?
hellsquirrel
0
270
Магия декларативныx схем.
hellsquirrel
0
400
ML for HolyJS
hellsquirrel
0
190
Идеальный способ заблюрить белочку
hellsquirrel
0
190
ML/DL на фронте
hellsquirrel
0
240
InsertableStreams
hellsquirrel
0
120
WebRTC-404
hellsquirrel
0
570
Other Decks in Programming
See All in Programming
AI時代、エンジニアはどう育つのか -未経験エンジニアの成長を間近で見て考えたこと-
thasu0123
0
130
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
1.1k
The Bowling Game- From Imperative to Functional Programming - Part 1
philipschwarz
PRO
0
330
act2-costs.pdf
sumedhbala
0
120
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
130
関数型プログラミングのメリットって何だろう?
wanko_it
0
180
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
1
190
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
7
1.9k
アルゴリズムは何を圧縮しているのか ─ Haskell から育った「圧縮代数」というメンタルモデル
naoya
16
3.5k
Apache Hive: そしてCloud Native Lakehouseへ
okumin
1
140
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
150
使用 Meilisearch 建立新聞搜尋工具
johnroyer
0
150
Featured
See All Featured
The Cult of Friendly URLs
andyhume
79
6.9k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
220
Exploring anti-patterns in Rails
aemeredith
3
440
Paper Plane (Part 1)
katiecoart
PRO
1
9.7k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.4k
Designing for Timeless Needs
cassininazir
1
370
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
630
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
240
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
Marketing to machines
jonoalderson
1
5.6k
Building an army of robots
kneath
306
46k
Transcript
Wasm 101
2
3
4
5 Ссылка на слайды и прочие материалы будет в конце
доклада
Wasm 101
7 Wasm можно использовать везде кроме IE
8 WebAssembly Core
9 WebAssembly is a binary instruction format for a stack-based
virtual machine.
10 (func (export "add") (param i32) (param i32) (result i32)
local.get 0 local.get 1 i32.add) add(1, 2) Module Memory Function Instruction Table
11 .wasm и .wat У WebAssembly есть текстовое представление
12 (module (func $i (import "imports" "logger") (param i32)) (memory
(import "imports" "importedMemory") 1) (func (export "exportedFunc") i32.const 42 call $i) (func (export "add") (param i32 i32) (result i32) local.get 0 local.get 1 i32.add) (data (i32.const 0) "Fifty"))
Embeddings 13
Wasm и JavaScript — лучшие друзья 14 (module (func $i
(import "imports" "logger") (param i32)) (memory (import "imports" "importedMemory") 1) (func (export "exportedFunc") i32.const 42 call $i) (func (export "add") (param i32 i32) (result i32) local.get 0 local.get 1 i32.add) (data (i32.const 0) "tver.io")) const importedMemory = new WebAssembly.Memory({ initial: 1, maximum: 10 }); WebAssembly.instantiateStreaming(fetch("simple.wasm"), { imports: { logger: function(arg) { console.log("first function call", arg); }, importedMemory } }).then(obj => { obj.instance.exports.exportedFunc(); const three = obj.instance.exports.add(1, 2); console.log("1 + 2 =", three); var memoryArray = new Uint32Array(importedMemory.buffer, 0, 10); console.log( "reading from memory", new TextDecoder("utf8").decode(memoryArray) ); });
Мы поняли, что: Wasm = IR Wasm легко парсить Wasm
= легкий формат Wasm = песочница 15
Portability в примерах Pyodide Squoosh Unity 16
17 WebAssembly embeddings
18 Wasm это технология для Web?
19 Да: пилится под Web
20 Wasm design principles Модульность из коробки Живет в песочнице
Работает быстро Не ломает Web
21 Нет: может быть любой embedder
22 C/C++ wasm (emscripten)
23 JS vs. asm.js vs. wasm
Hello world на 300Кб 24
25 emcc -O3 \ -s ENVIRONMENT="web" \ -s EXTRA_EXPORTED_RUNTIME_METHODS='["cwrap"]' \
-I libwebp libwebp/src/{dec,dsp,demux,enc,mux,utils}/*.c \ -o encoder.js encoder.c Вот так можно скомпилировать libwebp в wasm
26 Что насчет других языков? wasm-pack Assembly Script
27 Performance
28 Скорость wasm зависит окружения
29 V8
30 V8
31 Чтобы все было быстро, делайте так: WebAssembly.instantiateStreaming Content-Type: application/wasm
32 Что планируется дальше? Status: MVP SIMD Threads
33 Wasm и webpack { test: /\.wasm$/, type: "javascript/auto", loader:
"file-loader" },
34 Как дебажить?
35 Как дебажить?
36 Wasm дополняет JS-экосистему Wasm = predictable performance Фууух, почти
все :)
37 Спасибо! @polina_gurtovaya @pgurtovaya
[email protected]
37 @evilmartians @evilmartians_ru evilmartians.com github.com/HellSquirrel/wasm-101-talk