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
WASM入門
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
NearMeの技術発表資料です
PRO
January 19, 2025
Programming
230
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
WASM入門
NearMeの技術発表資料です
PRO
January 19, 2025
More Decks by NearMeの技術発表資料です
See All by NearMeの技術発表資料です
AIエージェントのための 隔離された安全なインフラ設計
nearme_tech
PRO
0
22
Claude Code × git worktree で並列開発 (続き) -差分のサービスだけを併設する-
nearme_tech
PRO
1
69
Claude Code × git worktree で並列開発 — サブモジュール構成のリポジトリで成立させる —
nearme_tech
PRO
0
79
LLM + 強化学習
nearme_tech
PRO
0
37
PosthogのA/Bテスト機能の紹介
nearme_tech
PRO
1
110
AIフレンドリーなプロダクトに向けて
nearme_tech
PRO
2
70
初めてのLean言語
nearme_tech
PRO
0
110
Apache Airflow Workflow orchestration without turning cron into spaghetti
nearme_tech
PRO
2
50
実務で役立つ幾何学 ボロノイ図の基礎から グラフ・ネットワーク応用まで
nearme_tech
PRO
1
93
Other Decks in Programming
See All in Programming
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
130
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
350
残高管理から台帳サービスへの進化
artoy
1
200
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
6.6k
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
220
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
190
AmebaブログはKMPから卒業します
kmars0605
0
180
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
790
Railsバージョンを4倍にした話
optim
0
350
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
0
880
ActionController meets Protocol Buffers
sorah
0
520
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
180
Featured
See All Featured
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
930
Fireside Chat
paigeccino
43
4.1k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.7k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
Chasing Engaging Ingredients in Design
codingconduct
0
360
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Optimising Largest Contentful Paint
csswizardry
37
4k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
410
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
460
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Heart Work Chapter 1 - Part 1
lfama
PRO
10
37k
Transcript
0 WASM⼊⾨ 2025-01-17 第111回NearMe技術勉強会 @yujiosaka
1 WASMとは? • 低レベルのバイトコードフォーマット • C、C++、Rust等の⾔語のコンパイル対象 • ⾼性能なウェブアプリケーションを実現する • サーバーサイドでの利⽤が増加している
2 Write once, run anywhere Java バイトコード JVM ARM X86
中間表現
3 Write once, run anywhere WASM バイトコード WASM ランタイム ARM
X86 中間表現
4 Write once, run anywhere WASM ランタイム WASM バイトコード ARM
X86 Wasmtime 中間表現
5 WASMの特徴 • 性能 ‒ ほぼネイティブの速度で実⾏ • 多⾔語対応 ‒ 様々なプログラミング⾔語をサポート
• クロスプラットフォーム ‒ ブラウザやネイティブのランタイムに対応 • セキュリティ ‒ サンドボックス環境で実⾏ • クロスアーキテクチャ ‒ 複数のCPUアーキテクチャで実⾏(例:ARM、x86)
6 Confidential 6
7 性能 7
8 検証
9 コラッツ問題 3 Step ステップ数 n 5 8 4 2
1 10 16 1. 任意の正の整数nで開始 2. nが偶数なら2で割る 3. nが奇数なら3倍して1を⾜す 4. nが1になるまでこのプロセスを繰り返す 9
10 JavaScript vs. Rust function collatzSteps(n) { let counter =
0; while (n !== 1) { if (n % 2 === 0) { n /= 2; } else { n = 3 * n + 1; } counter++; } return counter; } pub fn collatz_steps(mut n: u64) -> u64 { let mut counter = 0; while n != 1 { if n % 2 == 0 { n /= 2; } else { n = 3 * n + 1; } counter += 1; } return counter; }
11 n = 670617279 の場合(必要ステップ数:986) 関数 Opt/Sec JS 32,172 WASM
1,465,898
12 n = 7 の場合(必要ステップ数:16) 関数 Opt/Sec JS 21,627,204 WASM
77,805,618
13 多⾔語対応 13
14 WASMにコンパイル可能な⾔語
15 クロスプラットフォーム 15
16 フロント エンド バック エンド エッジ 2025年時点でのユースケース
17 セキュリティ 17
18 JavaScriptの関数をインポートする use wasm_bindgen::prelude::*; #[wasm_bindgen] extern “C” { #[wasm_bindgen(js_namespace =
console)] fn log(s: &str) } #[wasm_bindgen] pub fn hello_world(name: &str) { log(&format!(“Hello, {}!”, name)); }
19 サンドボックスの実⾏環境 Shared Linear Memory hello_world(name: &str) log helloWorld(name: string)
console.log エクス ポート イン ポート 書き 込む 読み 込む 呼び 出す WASMモジュール
20 クロスアーキテクチャ 20
21 Numpyのディストリビューションとの⽐較
22 Thank you