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
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
700
Prototyping Kubernetes CRI With Ruby and gRPC
remore
3
1.3k
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
美味しいスイスチーズを作ろう🧀🐭
taigamikami
1
140
Dynamic Workersについて
yusukebe
1
410
脅威をエンジニアリングの糧にして:恐怖を乗り越えた先にあったもの / Turn threats into fuel for engineering: what lay beyond overcoming fear
nrslib
1
340
Oracle AI Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
6
1.5k
オンコールの負荷軽減のためのBits Assistant 活用方法 / How to Use Bits Assistant to Reduce the Workload on On-Call Staff
sms_tech
1
320
シンデレラなんかになりたくない!ガラスの靴が割れた時代にどう歩く?
nomizone
0
220
AI フレンドリーなエラー監視を TypeScript で実現する
shinyaigeek
2
160
Diagnosing performance problems without the guesswork
elenatanasoiu
0
120
最低限これだけ押さえれ大丈夫_Claude Enterprise/Team企業展開ガバナンス入門
tkikuchi
1
490
大学生が本気でDatabricksを活用してDiscordサークルをデータ駆動させてみた
phantomjuju
1
270
権限管理設計を完全に理解した
rsugi
2
230
AI-DLCを活用した高品質・安全なAI駆動開発実践 / AI Driven Development
yoshidashingo
1
230
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
97
6.6k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
410
Discover your Explorer Soul
emna__ayadi
2
1.1k
Writing Fast Ruby
sferik
630
63k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.8k
sira's awesome portfolio website redesign presentation
elsirapls
0
260
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
140
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
820
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
190
Code Reviewing Like a Champion
maltzj
528
40k
Building Applications with DynamoDB
mza
96
7.1k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
590
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!