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
A PoC-ish Trick: LLVM IR Generation with Ruby
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
remore
November 11, 2016
Technology
1.4k
1
Share
A PoC-ish Trick: LLVM IR Generation with Ruby
A Lightning Talk at RubyConf 2016
remore
November 11, 2016
More Decks by remore
See All by remore
Turning CDN edge into a Rack web server with ruby.wasm
remore
0
680
Prototyping Kubernetes CRI With Ruby and gRPC
remore
3
1.2k
How I made a pure-Ruby word2vec program more than 3x faster
remore
3
3.2k
Code, Arguments and Startups
remore
0
1.8k
詳解🔍Burn🔥
remore
4
5.4k
DockerCon 2015 Quick Recap
remore
0
460
dockerfileview: A Dockerfile viewer to trace ancestry of the base image
remore
2
460
Burn: 8-Bit Game Development With Ruby
remore
3
1.1k
Other Decks in Technology
See All in Technology
AWS Agent Registry の基礎・概要を理解する/aws-agent-registry-intro
ren8k
3
380
No Types Needed, Just Callable Method Check
dak2
1
1.4k
20年前の「OSS革命」に学ぶ AI時代の生存戦略
samakada
0
450
エージェントスキルを作って自分のインプットに役立てよう
tsubakimoto_s
0
400
Claude Code を安全に使おう勉強会 / Claude Code Security Basics
masahirokawahara
11
35k
Good Enough Types: Heuristic Type Inference for Ruby
riseshia
1
250
コミュニティ・勉強会を作るのは目的じゃない
ohmori_yusuke
0
230
[OpsJAWS 40]リリースしたら終わり、じゃなかった。セキュリティ空白期間をAWS Security Agentで埋める
sh_fk2
3
240
EBS暗号化に失敗してEC2が動かなくなった話
hamaguchimmm
2
210
生成AIが変える SaaS の競争原理と弁護士ドットコムのプロダクト戦略
bengo4com
1
1.3k
みんなで作るAWS Tips 100連発 (FinOps編)
schwrzktz
1
310
20260428_Product Management Summit_Loglass_JoeHirose
loglassjoe
2
2.5k
Featured
See All Featured
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
250
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.1k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
450
Deep Space Network (abreviated)
tonyrice
0
120
How to train your dragon (web standard)
notwaldorf
97
6.6k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.6k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
190
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
170
Music & Morning Musume
bryan
47
7.2k
Google's AI Overviews - The New Search
badams
0
980
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
530
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Transcript
A PoC-ish Trick: LLVM IR Generation with Ruby A Lightning
Talk at RubyConf 2016 Kei Sawada (@remore)
None
a modern, fast, and open source language for data science
and technical computing
Julia is 4 years old young Good performance, as fast
as C Dynamic typing Julia has Capability to call C functions directly without wrappers or special APIs a compiler that used LLVM to translate Julia programs into ef cient executable code
In short,
Write some Julia code then you will get LLVM IR
without hassle
debussy:~ guest$ julia _ _ _ _(_)_ | A fresh
approach to technical computin (_) | (_) (_) | Documentation: http://docs.julialang.o _ _ _| |_ __ _ | Type "?help" for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.4.6 (2016-06-19 17:16 UTC) _/ |\__'_|_|_|\__'_| | |__/ | x86_64-apple-darwin15.5.0 julia>
debussy:~ guest$ julia _ _ _ _(_)_ | A fresh
approach to technical computin (_) | (_) (_) | Documentation: http://docs.julialang.o _ _ _| |_ __ _ | Type "?help" for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.4.6 (2016-06-19 17:16 UTC) _/ |\__'_|_|_|\__'_| | |__/ | x86_64-apple-darwin15.5.0 julia> function hello() "rubyconf" end hello (generic function with 1 method) julia>
debussy:~ guest$ julia _ _ _ _(_)_ | A fresh
approach to technical computin (_) | (_) (_) | Documentation: http://docs.julialang.o _ _ _| |_ __ _ | Type "?help" for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.4.6 (2016-06-19 17:16 UTC) _/ |\__'_|_|_|\__'_| | |__/ | x86_64-apple-darwin15.5.0 julia> function hello() "rubyconf" end hello (generic function with 1 method) julia> hello() "rubyconf" julia>
julia> code_llvm(hello, ()) define %jl_value_t* @julia_hello_21549() { top: ret %jl_value_t*
inttoptr (i64 4447575696 to %jl_value_t*) } julia>
julia> code_llvm(hello, ()) define %jl_value_t* @julia_hello_21549() { top: ret %jl_value_t*
inttoptr (i64 4447575696 to %jl_value_t*) } julia> code_native(hello, ()) .section __TEXT,__text,regular,pure_instructions Filename: none Source line: 2 pushq %rbp movq %rsp, %rbp movabsq $4447575696, %rax ## imm = 0x109189E90 Source line: 2 popq %rbp ret julia>
OK Julia is a thing But we are in
None
What if
You can write some Ruby code which can be translated
into Julia where you can get LLVM IR easily?
Ruby -> Julia -> LLVM IR
None
Julializer Allow you to convert your arbitrary Ruby code into
Julia code
Time to DEMO!
For more examples and attempts, check out: github.com/remore/julializer github.com/remore/virtual_module Thanks!