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
はじめてのWebAssembly
Search
Kazuki Shibata
May 18, 2017
Technology
2
1.9k
はじめてのWebAssembly
Nihonbashi.js #1の資料です。
Kazuki Shibata
May 18, 2017
Tweet
Share
More Decks by Kazuki Shibata
See All by Kazuki Shibata
microCMSでif文を作る
shibe97
1
1k
SvelteKitでJamstackを試す
shibe97
1
1.1k
フロントエンドのトレンド〜サーバーレスSPA、Jamstack〜
shibe97
16
4.8k
Jamstack × PWA におけるキャッシュ戦略
shibe97
3
1.1k
CSR / SSR / SSGの動向2020
shibe97
2
1.5k
Jamstack×microCMS 実装編
shibe97
4
870
SentryでSPAのエラーログを収集する
shibe97
1
1.6k
useRefについて調べてみた
shibe97
1
140
フロントエンドエンジニアのキャリアパス
shibe97
9
3.7k
Other Decks in Technology
See All in Technology
【Pycon mini 東海 2024】Google Colaboratoryで試すVLM
kazuhitotakahashi
2
500
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
7
820
TypeScript、上達の瞬間
sadnessojisan
46
13k
The Role of Developer Relations in AI Product Success.
giftojabu1
0
120
なぜ今 AI Agent なのか _近藤憲児
kenjikondobai
4
1.4k
SSMRunbook作成の勘所_20241120
koichiotomo
2
130
Why does continuous profiling matter to developers? #appdevelopercon
salaboy
0
190
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
0
110
Amazon Personalizeのレコメンドシステム構築、実際何するの?〜大体10分で具体的なイメージをつかむ〜
kniino
1
100
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
Taming you application's environments
salaboy
0
190
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
89
Teambox: Starting and Learning
jrom
133
8.8k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
For a Future-Friendly Web
brad_frost
175
9.4k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Building an army of robots
kneath
302
43k
Building Adaptive Systems
keathley
38
2.3k
Transcript
͡Ίͯͷ8FC"TTFNCMZ ࣲాف!TIJCF /JIPOCBTIJKT
σβΠφʔ / ϑϩϯτΤϯυΤϯδχΞ :BIPP+"1"/ͷࠂܥπʔϧͷ ϑϩϯτΤϯυΛ୲͍ͯ͠·͢ ࣲా ف @shibe97
+BWB4DSJQUେ͖ͬࢠͰ͢
͚Ͳ
ͪΐͬͱ͖ͨ
ͱ͍͏ΑΓ
3FBDU 3FEVY͖ͨ
Կ͔৽͍͠ͷʹखΛग़ͯ͠ΈΑ͏ɾɾɾ
None
+BWB4DSJQUͷ
͍ͩͿ͘ͳ͚ͬͨͲɺॏ͍ॲཧʹऑ͍ʢϒϥβݻ·Δʣ ܕ͕໌ࣔతͰͳ͍ ίϯύΠϧܕͰͳ͘ɺΠϯλϓϦλܕݴޠ 'JSFGPYʢ4QJEFS.POLFZʣ &EHFʢ$IBLSBʣ $ISPNFʢ7ʣ
ͦͦ͜ΜͳෳࡶͳͷΛ࡞ΔͨΊʹੜͨ͠ݴޠ͡Όͳ͍ "KBYͷීٴͱڞʹαʔόαΠυͷॲཧ͕ΫϥΠΞϯταΠυʹ Ҡ͖ͬͯͨ͋ͨΓ͔Βແཧ͕ग़࢝Ίͨ
+BWB4DSJQU࣮ߦ࣌ͷྲྀΕ ϒϥβ͕+BWB4DSJQUͷߏจղੳΛߦ͍ɺ"45ʢ"CTUSVDU4ZOUBY 5SFFʣʹม "45ΛόΠτίʔυʹม͠ɺԾϚγϯ্Ͱಈ࡞ͤ͞Δ ܕใ͕ݻ·͖ͬͯͨΒɺ෦తʹػցޠʹม ʢ+VTUJO5JNFίϯύΠϧʣ
ࣄલʹܕఆ͕ٛͰ͖Εʜ
asm.js
BTNKTͬͯͲΜͳͷ .P[JMMB͕ఏএͨ͠+BWB4DSJQUͷߴԽٕज़ ͋͘·Ͱ+BWB4DSJQUϑΝΠϧ ͋Δϧʔϧʹै͏ͱܕใΛ༩͑Δ͜ͱ͕Ͱ͖Δ ʢϒϥβଆͷαϙʔτ͕ͪΖΜඞཁʣ
function AddFunctions(){ "use asm"; function add1(value){ value = value |
0; // Ҿ int ͩͱ໌ࣔ var result = 0; // int ͱͯ͠એݴ result = (value + 1) | 0; // int Ωϟετ return result; } return { add1: add1 } }
BTNKTʹΑΔҾͷܕఆٛ JOU WBMVFWBMVFc EPVCMF WBMVF WBMVF qPBU WBMVFG WBMVF
BTNKTͷͭΒΈ ԋࢉ͔͠Ͱ͖ͳ͍ จࣈྻΦϒδΣΫτΛແཧΓදݱ͠Α͏ͱ͢ΔͱɺόΠφϦ͕ བྷΜͰ͖ͯπϥ͍ ਓ͕ॻ͘ݴޠ͡Όͳ͍
ଞͷݴޠ͔Βม͢Εʜ
--7.ίϯύΠϧͷΈ $ $ 0CKFDUJWF$ (P 3VTU தؒݴޠ +BWB4DSJQU ͦͷଞݴޠ
˞+BWB4DSJQU༻ͷ--7.ϕʔείϯύΠϥ
มͰ͖ͨɺ͔͠͠ʜ ϑΝΠϧ༰ྔ͕େ͖͍ )FMMP8PSME͚ͩͰ, BTNKT.P[JMMB͕ߟ͑ͨͷ͕ͩɺશϒϥβϕϯμʔڠྗͯ͠ ͬͱ͍ܰܗࣜ࡞ͬͪΌ͏ʁ
ʢXBTNʣ
ݱঢ়ɺXBTNʹมͰ͖Δݴޠ $ $ 3VTU
Α͠ɺ3VTUͩʂ
ͬ͘͟Γ3VTUͬͯʁ όʔδϣϯϦϦʔε .P[JMMB͕։ൃ 'JSFGPY͔Β3VTUͰॻ͍ͨίʔυ͕ಈ͍͍ͯΔ ҆શੑɺฒྻੑʹ༏Ε͍ͯΔ
3VTUͷओͳ༻్ 4ZTUFN1SPHSBNNJOH /FUXPSL1SPHSBNNJOH ,FSOFM 8FC"TTFNCMZ
+BWB4DSJQU 1)1 3VCZ +BWB $ 3VTU ʢݸਓͷݟղͰ͢ʣ
FNTDSJQUFO +BWB4DSJQU"1* 8FC"TTFNCMZͰͷར༻ྫ index.rs index.wasm TypedArray
ࢼ͠ʹ3VTUͰ%0.Λు͖ग़ͤΔ͔ ͬͯΈͨ
XFCQMBUGPSNͱ͍͏DSBUFΛ͏ /PEFͰ͍͏QBDLBHFతͳͷ
)5.-ͷத <script> var Module = {} fetch('index.wasm') .then((response) => response.arrayBuffer())
.then((buffer) => { Module.wasmBinary = buffer; var script = document.createElement('script'); script.src = 'index.js'; document.body.appendChild(script); }) </script>
σϞ
ͳΜ͔3FBDUDSFBUF&MFNFOU ͬΆ͕͋͞Δ
+49తͳͷ͕͋Ε ͍͍ײ͡ͳΔͷͰʁ
ͱࢥͬͨΒ͋ͬͨ
KTYSTSFBDUST
͚Ͳ·ͩ։ൃͷॳظஈ֊ͬΆ͍Ͱ͢
5PEP.7$ IUUQSVTUXFCQMBUGPSNHJUIVCJPSVTUUPEPNWD
·ͱΊ ͍ͭʹ+BWB4DSJQUҎ֎ͷݴޠϒϥβͰಈ͔ͤΔ࣌ʹ 3VTU·ͩ8FCΞϓϦ੍࡞ʹऑ͍͕ɺࠓޙ͍ͯͬͨ͠߹ʹ ϑϩϯτΤϯυ͕มΘΔՄೳੑ͕͋Γͦ͏
5IBOLT 5XJUUFS(JU)VC!TIJCF