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擴張を作る
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
さっちゃん
March 23, 2017
Programming
1.7k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
最速で最速のRuby擴張を作る
CrystalでRubyの擴張を書く
https://github.com/ne-sachirou/sample_ruby_extension_in_crystal
さっちゃん
March 23, 2017
More Decks by さっちゃん
See All by さっちゃん
敎へない敎師と、考へる機械
ne_sachirou
0
28
火星曆
ne_sachirou
0
55
みんなのオブザーバビリティプラットフォームを作ってるんだがパフォーマンスがやばい #mackerelio #srenext
ne_sachirou
0
1.7k
作ってよかったgraceful shutdownライブラリ #kyotogo
ne_sachirou
0
1.5k
path 依存型って何?
ne_sachirou
0
880
野生の onbording と onbording 設計 #kyototechtalk
ne_sachirou
0
770
メトリックはいかにして見え續ける樣になったか #devio2022
ne_sachirou
0
150
名實一致
ne_sachirou
0
780
まかれるあなとみあ ―Mackerel のしくみを理解する 30 分― @ Hatena Engineer Seminar #16
ne_sachirou
0
3.4k
Other Decks in Programming
See All in Programming
Snowflakeで業務アプリを作ろう。 Snowflakeのアプリ機能解説&実践ガイド
ayumu_yamaguchi
1
190
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
130
Hello, Hiroshima Geospatial Data! — Exploring DoboX with Python
ra0kley
0
180
業務時間外もAIに働いてもらう話
colorful12
3
10k
不幸な GC
chencmd
0
890
高専キャリア LT 発表内容
crysta1221
6
5.6k
GKE アップグレード前に知っておきたい Blue/Green と PDB の関係
stkk
0
160
LLMは4年分のCompose移行を再現できるのか?実プロダクト279件のXMLで探る自動化の境界線
makun
0
450
コンパウンドプロダクト開発のためのローカルプロセスマネージャー再発明 #layerxgo
izumin5210
0
660
RSSとCodexを使ってX投稿自動化してみた
ochtum
0
110
信頼性の目標を誰も求めてない
shubox
0
500
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
4.4k
Featured
See All Featured
How to Ace a Technical Interview
jacobian
281
24k
How to build a perfect <img>
jonoalderson
1
6k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
230
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
470
Code Reviewing Like a Champion
maltzj
528
40k
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
Being A Developer After 40
akosma
91
590k
Un-Boring Meetings
codingconduct
0
410
Fireside Chat
paigeccino
42
4k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.2k
Thoughts on Productivity
jonyablonski
76
5.4k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Transcript
最速で最速の Ruby擴張を作る
.。oO(さっちゃんですよヾ(〃l _ l)ノ゙☆)
Ruby
Ruby 最速で開發出來る⾔語
None
Crystal
Crystal LLVMでcompile出來るRuby-likeな⾔語
Crystal LLVMでcompile出來るRuby-likeな⾔語 Ruby-likeなsyntax 型推論 macroによるDSL Cのlibをそのまま使へる → 最速の開發
Crystal LLVMでcompile出來るRuby-likeな⾔語 型による最適化 LLVMによる最適化 macroによるcompile時計算 Cのlibをover head無く使へる → 最速の實⾏
Rubyの實⾏速度が遅い
Rubyの實⾏速度が遅い ↓ Cで擴張を作る
Rubyの實⾏速度が遅い ↓ Cで擴張を作る ↓ 實⾏速度は速く成ったが 開發速度が遅く成った
Rubyのeco systemに頼りながら 開發速度を落とさず 遲い部分をCrystalで速く出來ないだらうか
既存の試み manastech/crystal_ruby 頑張る前に放棄されてゐる 全然使へない 動かない phoffer/crystalized_ruby 頑張った跡 rb_define_module_function等を⼿動で呼ばなければならない もう動かない
♥ Ruby meets Crystal ♥ ne-sachirou/sample_ruby_extension_in_crystal
ne-sachirou/sample_ruby_extension_in_crystal ruby hello_cr, def hello_cr : Nil puts "Hello, World!”
end hello_cr
ne-sachirou/sample_ruby_extension_in_crystal ruby Fib, module Fib def self.fib_cr(n : Int32) :
Int32 (1..n-1).reduce([1,1]){|ns|[ns[1],ns[0]+ns[1]]}[1] end end p Fib.fib_cr
ne-sachirou/sample_ruby_extension_in_crystal Benchmark 同じalgorithmで、fibonacci數列の31番⽬を100万回計算する def self.fib_rb(n) ns = [1, 1] i
= 1 while i < n ns0 = ns[0] ns[0] = ns[1] ns[1] = ns0 + ns[1] i += 1 end ns[1] end
ne-sachirou/sample_ruby_extension_in_crystal Benchmark 同じalgorithmで、fibonacci數列の31番⽬を100万回計算する C 0.1秒
ne-sachirou/sample_ruby_extension_in_crystal Benchmark 同じalgorithmで、fibonacci數列の31番⽬を100万回計算する C 0.1秒 Ruby 3.0秒
ne-sachirou/sample_ruby_extension_in_crystal Benchmark 同じalgorithmで、fibonacci數列の31番⽬を100万回計算する C 0.1秒 Ruby 3.0秒 Crystal 0.2秒
ne-sachirou/sample_ruby_extension_in_crystal macro ruby(name, code) {{ code }} {% if code.class_name
== "Def" %} Ruby.ruby_def {{ name }}, {{ code }} {% elsif code.class_name == "ModuleDef" %} Ruby.ruby_module_def {{ name }}, {{ code }} {% end %} end LLVMで速いbinaryを作る ⾃動でRubyにmodule/methodを登録する `rake compile`
ne-sachirou/sample_ruby_extension_in_crystal gem化をマテ!