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入門
Search
NearMeの技術発表資料です
PRO
January 19, 2025
Programming
210
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の技術発表資料です
LLM + 強化学習
nearme_tech
PRO
0
17
PosthogのA/Bテスト機能の紹介
nearme_tech
PRO
1
27
AIフレンドリーなプロダクトに向けて
nearme_tech
PRO
2
57
初めてのLean言語
nearme_tech
PRO
0
87
Apache Airflow Workflow orchestration without turning cron into spaghetti
nearme_tech
PRO
2
30
実務で役立つ幾何学 ボロノイ図の基礎から グラフ・ネットワーク応用まで
nearme_tech
PRO
1
64
SQL/ID抽出タスクから考える 実践的なハルシネーション対策
nearme_tech
PRO
1
74
OpenCode & Local LLM
nearme_tech
PRO
0
240
OpenCode Introduction
nearme_tech
PRO
0
64
Other Decks in Programming
See All in Programming
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
260
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
680
PHP Application における Kubernetes 内 gRPC 通信
ganchiku
0
590
『コードを書く以外の』エンジニアリング〜課金基盤移行プロジェクト推進のためのTips4選
yuriko1211
0
590
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
500
Cloudflare is Agents
chimame
0
150
React本体のコードリーディング
high_g_engineer
1
140
言葉の格闘技のススメ~紙とペンと言葉から始める、キャリアの描き方~
progresscicada
2
140
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
550
SlackアプリとLambdaの 連携を構築した話
pawn_4_s
1
110
Built Our Own Background Agent at LayerX
layerx
PRO
9
5.1k
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
510
Featured
See All Featured
The agentic SEO stack - context over prompts
schlessera
0
860
Making the Leap to Tech Lead
cromwellryan
135
10k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
350
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
330
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Tell your own story through comics
letsgokoyo
1
1k
Prompt Engineering for Job Search
mfonobong
0
400
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.5k
Producing Creativity
orderedlist
PRO
348
40k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
30 Presentation Tips
portentint
PRO
1
360
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