Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
WebAssemblyとそのデモ
Search
komadamnak
June 23, 2020
Programming
15
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
WebAssemblyとそのデモ
About WebAssembly and its demo.
komadamnak
June 23, 2020
Other Decks in Programming
See All in Programming
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
260
最近”作らせてる” ローカルAIアプリの話
akit37
0
470
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
120
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.2k
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
160
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
35
17k
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
350
Jetpack Compose Mechanisms
skydoves
3
820
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.6k
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
2
960
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
430
Featured
See All Featured
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
570
Raft: Consensus for Rubyists
vanstee
142
7.8k
Building Adaptive Systems
keathley
44
3.2k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
410
GraphQLとの向き合い方2022年版
quramy
50
15k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Rails Girls Zürich Keynote
gr2m
96
14k
Code Reviewing Like a Champion
maltzj
529
40k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
570
Transcript
WebAssembly ͱͦͷԠ༻ ۨాफල Sohobb.Inc June 26, 2020
WebAssembly WebAssembly ͱ ެࣜαΠτΑΓ binary instruction format for a stack-based
vir- tual machine.(ελοΫϕʔεͷԾϚγϯʹର͢Δό ΠφϦͷ໋ྩίʔυ) ! Σϒϒϥβ্Ͱ࣮ߦͰ͖ΔόΠφϦݴޠ 2 / 20
WebAssembly WebAssembly ͱ ଞͷϓϩάϥϛϯάݴޠͰهड़͞ΕͨίʔυΛɺ wasm(WebAssembly) ϑΝΠϧʹίϯύΠϧ͢Δɻ wasm ϑΝΠϧΛϒϥβ্ʹ import ͯ͠ɺར༻͢Δ͜ͱ͕Ͱ
͖Δɻ ͭ·Γɺweb ͷϓϥοτϑΥʔϜʹ͓͍ͯ html , css , javascript + wasm 3 / 20
WebAssembly ରԠݴޠ › C › C++ › Rust › Go
› Typescript ͳͲ 4 / 20
WebAssembly 5 / 20
WebAssembly WebAssembly ͷత Javascript ɺҎԼͷΑ͏ͳࠜຊతͳऑ (ಛ) ͕͋Δɻ › ωΠςΟϒʹඖఢ͢Δεϐʔυग़ͤͳ͍ɻ ›
ݴޠతʹɺϝϞϦΛҙࣝͯ͠ίʔυΛॻ͘͜ͱ͕͍͠ɻ 6 / 20
WebAssembly WebAssembly ͷత ҰํͰɺWebAssembly ͰɺRust ͱ͍ͬͨਫ४ͳݴޠΛ ͬͯهड़͢Δ͜ͱ͕Ͱ͖Δɻ ·ͨɺόΠφϦʹίϯύΠϧ͢ΔͨΊɺ߹ʹΑͬͯωΠςΟϒ ϨϕϧͷΛ࣮ݱ͢Δ͜ͱ͕Ͱ͖Δɻ 7
/ 20
WebAssembly ͷԠ༻ྫ Making really tiny WebAssembly graphics demos XʢݱΞϧϑΝϕοτͷࢠձࣾʣͷݩࣾһͷهࣄɻ 8
/ 20
WebAssembly ͷԠ༻ྫ Figure: http://cliffle.com/blog/bare-metal-wasm/ 9 / 20
WebAssembly ͷԠ༻ྫ Figure: هࣄͰ࡞͞ΕͨσϞ 10 / 20
WebAssembly ͷԠ༻ྫ 1 Rust Λͬͯ Image Buffer Λૢ࡞͢ΔͨΊͷ WASM Λ
࡞ 2 WASM ͔Βදࣔ༻ͷը૾ͷ buffer Λ࡞ 3 Javascript ͔ΒΞχϝʔγϣϯ୯ҐͰɺWASM ͷϞδϡʔ ϧΛݺͼग़͢ɻ 4 wasm Ϟδϡʔϧɺbuffer Λߋ৽ɻ 5 Javascript ϝϞϦ্ͷ buffer Λࢀরͯ͠ canvas ʹ දࣔɻ 11 / 20
WebAssembly ͷԠ༻ྫ Figure: JS ͱ WASM ͷ࿈ܞ 12 / 20
WASM(Rust) ଆ install ˍ create ˍ build rustup target add
wasm32-unknown-unknown cargo new --lib demo cargo build --target wasm32-unknown-unknown -- release ্͔ΒͦΕͧΕɺwebassembly ίϯύΠϧ༻ͷڥͷՃɺϓϩ δΣΫτͷ࡞ɺ͓Αͼ webassembly ͷίϯύΠϧ 13 / 20
WebAssembly ͷԠ༻ྫ WASM(Rust) ଆ ը૾ͷେ͖͞Λࢦఆ͠ɺbuffer Λ static ʹએݴ͢Δ u32 ʹ͍ͭͯ
RGBA ۭؒʹ͓͚Δ 1 ϐΫηϧ͋ͨΓʹ͔ͭ͏ใྔ 4byte = 32bit 14 / 20
WebAssembly ͷԠ༻ྫ WASM(Rust) ଆ BUFFER ͷϝϞϦ্ͷ index Λฦ͢ function Λ࣮͠ɺjs
ʹ Ҿ͖͢ɻ 15 / 20
WebAssembly ͷԠ༻ྫ WASM(Rust) ଆ BUFFER Λߋ৽͢Δ function 16 / 20
WebAssembly ͷԠ༻ྫ WASM(Rust) ଆ JS ʹҾ͖͢ BUFFER ߋ৽༻ͷ function 17
/ 20
WebAssembly ͷԠ༻ྫ JS ଆ WASM ϑΝΠϧΛ import ͠ɺbuffer function
Λऔಘ͢Δɻ 18 / 20
WebAssembly ͷԠ༻ྫ Figure: هࣄͰ࡞͞ΕͨσϞ 19 / 20
ͦͷଞ ͦͷଞͷ › WASM ϑΝΠϧͷܰྔԽπʔϧ (wabt, binaryen, etc...) › طଘϑϨʔϜϫʔΫ,
πʔϧͷରԠ (Next.js, webpack ,ASP.NET Core, etc...) 20 / 20