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
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
1.1k
Давайте все заблокируем
hellsquirrel
0
370
Wasmысле?
hellsquirrel
0
280
Магия декларативныx схем.
hellsquirrel
0
400
ML for HolyJS
hellsquirrel
0
190
Идеальный способ заблюрить белочку
hellsquirrel
0
190
ML/DL на фронте
hellsquirrel
0
250
InsertableStreams
hellsquirrel
0
120
WebRTC-404
hellsquirrel
0
580
Other Decks in Programming
See All in Programming
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
570
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
560
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
650
進化を続けるGo toolsの現在地 / The Current State of Ever-Evolving Go Tools
hond0413
0
230
源内ハンズオン概要編
hideg
0
190
Foundation Models frameworkで画像分析
ryodeveloper
1
620
Android CLI
fornewid
0
220
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
300
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
1
1k
変わらないものが、変わるものを決める — 意図駆動開発 × イベントソーシング × イミュータブル | What Doesn't Change Decides What Can — IDD × Event Sourcing × Immutability
tomohisa
0
1.8k
SlackアプリとLambdaの 連携を構築した話
pawn_4_s
1
120
Japan Community Day at Kubecon + CloudNativeCon Japan 2026: Learning Container Privilege Control by Building My Own Low-Level Container Runtime
ternbusty
1
160
Featured
See All Featured
Deep Space Network (abreviated)
tonyrice
0
260
Technical Leadership for Architectural Decision Making
baasie
3
490
Accessibility Awareness
sabderemane
1
180
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
240
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.2k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
490
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
[SF Ruby Conf 2025] Rails X
palkan
2
1.3k
Automating Front-end Workflow
addyosmani
1369
210k
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