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
wtnabe
August 24, 2024
Programming
99
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ruby de Wasm
Kanazawa.rb meetup #144 のLT大会で発表した Ruby の Wasm 対応の概要、できること、個人的に期待していることの資料
wtnabe
August 24, 2024
More Decks by wtnabe
See All by wtnabe
新しいフロントプロセスとドキュメントフォーマットを考えてみた
wtnabe
0
40
Rubyでもモノリポしたい - 調査、おさわり編 -
wtnabe
0
69
Ruby de Railway Oriented Programming
wtnabe
0
120
Bindanのススメ
wtnabe
0
70
そのオブジェクト、何を保証してくれますか? - GuideRailのススメ -
wtnabe
0
80
Effective Jekyll
wtnabe
0
100
5 min Jekyll/Liquid Plugin cooking
wtnabe
0
69
Cloud Native Buildpacksって結局どうなの?
wtnabe
0
86
Decoupled System with Turbo Frame
wtnabe
1
180
Other Decks in Programming
See All in Programming
[DroidKaigi 26] How We Moved from Android Studio to Slack
thisaay
0
160
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
120
My Marp Sample
sinoue0108
0
140
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
250
高専、大学編入、そして未踏へ〜プロダクト開発とキャリアの歩み - Technical College, University Transfer, and On to “Mitou” / My Journey in Product Development and Career
pkmiya
0
130
AIの中の人になってみる
htkym
0
150
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
0
200
新人はどこまで自力でやり、どこからAIに頼るべきか/エンジニア育成に向き合う_先輩たちの悩みと知見共有会
toppan_digital_dev
1
500
go-spidermonkeyでAIエージェントのCode Modeを実装する
syumai
3
1.5k
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
410
Pythonの実行はどこまで賢くなったのか? CPythonとPyPyから見る最適化のしくみ
curekoshimizu
4
2.5k
PyConJP2026_wat_Python × Signal Processing: How to Draw Pictures with Sound Using Spectrogram Art
wat
0
650
Featured
See All Featured
The untapped power of vector embeddings
frankvandijk
2
1.9k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
Fireside Chat
paigeccino
42
4k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
690
How to make the Groovebox
asonas
2
2.4k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
430
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.9k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
430
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
460
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
Rails Girls Zürich Keynote
gr2m
96
14k
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) | あーありがち