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
Ruby de Wasm
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
wtnabe
August 24, 2024
Programming
89
0
Share
Ruby de Wasm
Kanazawa.rb meetup #144 のLT大会で発表した Ruby の Wasm 対応の概要、できること、個人的に期待していることの資料
wtnabe
August 24, 2024
More Decks by wtnabe
See All by wtnabe
Rubyでもモノリポしたい - 調査、おわわり編 -
wtnabe
0
43
Ruby de Railway Oriented Programming
wtnabe
0
89
Bindanのススメ
wtnabe
0
55
そのオブジェクト、何を保証してくれますか? - GuideRailのススメ -
wtnabe
0
71
Effective Jekyll
wtnabe
0
94
5 min Jekyll/Liquid Plugin cooking
wtnabe
0
57
Cloud Native Buildpacksって結局どうなの?
wtnabe
0
70
Decoupled System with Turbo Frame
wtnabe
1
170
join-kanazawarb-or-7years-passed-since-it-was-borned
wtnabe
0
840
Other Decks in Programming
See All in Programming
From Formal Specification to Property Based Test
ohbarye
0
2.4k
PicoRuby for IoT: Connecting to the Cloud with MQTT
yuuu
2
770
UaaL×Androidアプリのメモリ計測 — Memory Profilerの先へ
rio432
0
150
KMP × Kotlin 2.3 - How Android Got Slower While iOS Builds Improved by 47%
rio432
0
170
2026年のソフトウェア開発を考える(2026/05版) / Software Engineering Scrum Fest Niigata 2026 Edition
twada
PRO
23
12k
🦞OpenClaw works with AWS
licux
1
350
20260514_its_the_context_window_stupid.pdf
heita
0
930
AIベース静的検査器の偽陽性率を抑える工夫3選
orgachem
PRO
4
450
サプライチェーン攻撃対策「層を重ねて落ちない壁」を10日間で組み上げた話 #TechLeadConf2026
kashewnuts
1
250
cloudnative conference 2026 flyle
azihsoyn
0
170
Agentic UI in the Frontend: Architectures with Open Standards @JAX 2026 in Mainz
manfredsteyer
PRO
0
110
Road to RubyKaigi: Play Hard(ware)
makicamel
1
570
Featured
See All Featured
Game over? The fight for quality and originality in the time of robots
wayneb77
1
170
What does AI have to do with Human Rights?
axbom
PRO
1
2.1k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Marketing to machines
jonoalderson
1
5.2k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
200
Design in an AI World
tapps
1
210
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
540
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
280
Darren the Foodie - Storyboard
khoart
PRO
3
3.3k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
350
Measuring & Analyzing Core Web Vitals
bluesmoon
9
820
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Transcript
Ruby de Wasm Kanazawa.rb meetup #144 2024-08-24 (Sat) at ITBP武蔵
@wtnabe
Ruby 3.2からWASM標準対応 って知ってた? Ruby 3.2.0 Released GitHub - ruby/ruby.wasm: ruby.wasm
is a collection of WebAssembly ports of the CRuby.
TryRuby playground ブラウザでRubyが動くやつ Opal と Wasm の Ruby が動く あの_Whyたんが起源のサイト
ruby.wasmの特徴 RubyでWasmプログラムを書ける RubyがWasmプログラムとして動く RubyがWASI環境で動く RubyがJavaScript環境で動く
ブラウザでただ動かす場合 npmからwasm版rubyをロードすればおk <html> <script src="https://cdn.jsdelivr.net/npm/@ruby/
[email protected]
.. <script type="text/ruby"> require "js" puts
RUBY_VERSION # (Printed to the Web browser console) JS.global[:document].write "Hello, world!" </script> </html>
めっちゃ簡単
でも… JSで書けばよくない?
じゃあ何が嬉しいのか?
ruby.wasmの特長 RubyでWasmプログラムを書ける RubyがWasmプログラムとして動く RubyがWASI環境で動く RubyがJavaScript環境で動く
Wasm/WASIについて WasmはVMのバイナリフォーマット WASIはWasmアプリケーションのAPI ( ABI )
RubyそのものがWasm/WASI対応する ということは コードは何も変えずに自分の書いたRubyコードがWASI環境で動く Ruby本体とスクリプトを一体にしてportableに! コンテナ(dockerとか)のWASI対応も進んでいる CI/CDでもいきなり動く可能性
うまい話ばかりではない (当然)既存のコードが全部そのまま動くわけではない Wasmからネイティブに変換が走って起動が遅くなるケースも 特にRubyの場合、Rubyが起動してアプリが動作可能な状態になる までのスピンアップが重い(その前の変換が走るとさらに重い)
最近のWasmのトピック より高速なRubyのWebAssembly実装「Ruvy」 、Shopifyがオープン ソースで公開。Ruby仮想マシンとRubyアプリを組み合わせてビル ド - Publickey Google、Google Sheetsの計算エンジンをWebAssemblyに最適化 し、2倍の性能を実現したと発表
- Publickey Wasm版PostgreSQLに生成AIを組み合わせた「Postgres.new」無料 公開。自然言語でクエリ、エンベディングの作成、CSVからテーブ ル自動生成など - Publickey
Rubyに限らず Wasmで何ができるか、という動きは とてもアクティブで面白い。
個人的に期待していること JSON, YAML, Date, Timeなどが扱いやすい高級sh scriptとしての RubyのコードをWasm moduleとして動かしたい jqとかyqとかムツカシイ WASIネイティブコンテナサービスで動くならCI/CDでちょっとし
た加工のためにDockerfileやawkで工夫したりしなくて済む Linuxまるごとコンテナじゃないので準備もpullも動作も軽い
結局WASIと ruby.wasmの進歩任せになるのでは? WASI/Proposals.md at main · WebAssembly/WASI RubyGems on ruby.wasm
- Speaker Deck
ぐぬぬ
参考 Wasmで少しだけ手軽にRubyとRubyスクリプトを持ち運ぶ (2024- 05-25) | あーありがち