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
Ruby de Wasm
Search
wtnabe
August 24, 2024
Programming
110
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
51
Rubyでもモノリポしたい - 調査、おさわり編 -
wtnabe
0
80
Ruby de Railway Oriented Programming
wtnabe
0
130
Bindanのススメ
wtnabe
0
76
そのオブジェクト、何を保証してくれますか? - GuideRailのススメ -
wtnabe
0
84
Effective Jekyll
wtnabe
0
110
5 min Jekyll/Liquid Plugin cooking
wtnabe
0
75
Cloud Native Buildpacksって結局どうなの?
wtnabe
0
93
Decoupled System with Turbo Frame
wtnabe
1
190
Other Decks in Programming
See All in Programming
AI-Powered Domain-Driven Design
ziobrando
0
200
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
510
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
sbt 2.0: takeoff
eed3si9n
0
170
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
エージェントを使い続けるためのメタワーク / Meta-work for keeping using the agent
rkaga
4
1.4k
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
8.6k
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
230
ActionController meets Protocol Buffers
sorah
0
660
オーケストレーション記述言語 Katari
yukikurage
0
160
コーディング自動化の次へ。人の介入をゼロにするファクトリーとサポートAIによる実践
timakin
5
4.2k
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
2
1.1k
Featured
See All Featured
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
450
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
330
Ruling the World: When Life Gets Gamed
codingconduct
0
410
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
320
The Mindset for Success: Future Career Progression
greggifford
PRO
0
540
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
310
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
410
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3.1k
Product Roadmaps are Hard
iamctodd
55
13k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.1k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
370
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) | あーありがち