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
Helix: Ruby Native Extensions Without Fear
Search
Godfrey Chan
April 26, 2017
Programming
0
160
Helix: Ruby Native Extensions Without Fear
Helix makes writing Ruby classes in Rust safe and fun. Find out how!
Godfrey Chan
April 26, 2017
Tweet
Share
More Decks by Godfrey Chan
See All by Godfrey Chan
Virtual EmberConf 2022: Platform State of the Union
chancancode
0
210
Virtual EmberConf 2021: Platform State of the Union
chancancode
0
200
Virtual EmberConf 2020: Platform State of the Union
chancancode
1
300
Thinking in TypeScript
chancancode
0
240
The Lifecycle of a Rails Request
chancancode
3
13k
Dropping Down To The Metal™ (2018)
chancancode
0
95
Using Skylight to Solve Real-World Performance Problems
chancancode
1
290
Prying Open The Black Box (EmberConf 2018)
chancancode
0
320
Bending The Curve: Putting Rust in Ruby with Helix
chancancode
2
2.6k
Other Decks in Programming
See All in Programming
Temporalを取り巻く仕様を整理する
sajikix
0
110
ドメイン駆動設計の実践
masuda220
PRO
17
5.1k
20240706_CDKConf
takuyay0ne
0
1.2k
DDDを志して3年経ったら「DDDの皮を被ったクリーンアーキテクチャ」になった話【デブサミ2024夏】
texmeijin
1
620
Architectures with Lightweight Stores: New Rules and Options
manfredsteyer
PRO
0
100
Modern Angular: Renovation for Your Applications
manfredsteyer
PRO
0
140
Jetpack for KMP
fornewid
1
290
CSC307 Lecture 10
javiergs
PRO
0
310
CSC307 Lecture 14
javiergs
PRO
0
220
GraphQL はいいぞ! ~Laravel で学ぶ GraphQL 入門~
azuki
1
160
CSC307 Lecture 06
javiergs
PRO
0
360
Cloudflare Workers x AWS Lambdaの組み合わせユースケース / Cloudflare Workers x AWS Lambda Combination Use Case
seike460
PRO
2
310
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
353
29k
Building a Scalable Design System with Sketch
lauravandoore
458
32k
How to train your dragon (web standard)
notwaldorf
79
5.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
248
12k
Rebuilding a faster, lazier Slack
samanthasiow
78
8.5k
Testing 201, or: Great Expectations
jmmastey
33
6.9k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
325
21k
10 Git Anti Patterns You Should be Aware of
lemiorhan
652
58k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
13
430
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
44
4.7k
What’s in a name? Adding method to the madness
productmarketing
PRO
21
2.9k
Visualization
eitanlees
139
14k
Transcript
Previously…
Ruby is slow… – Usually it doesn’t matter – Most
workload are I/O bound – But occasionally it does…
“Best of both worlds” – Native extensions – JSON gem
– Very fast – Transparent to the user – Date, Pathname, etc…
Turbo Rails…? – String#blank? – Sam Saffron’s fast_blank – 50
LOC in C – 20x speedup
But C… – Unsafe – Risky – segfaults! – Maintenance
burden – Contribution barrier
Skylight Agent – Started with Ruby – Too much overhead
– Native extension! – But C…
Meet Rust – Like C: compiled, statically typed, very fast
– Unlike C: enjoyable to use, guarantees safety – “If it compiles, it doesn’t crash” – Same guarantee as Ruby, but without GC
Zero-cost abstractions™ – In Ruby: tension between abstractions and performance
– Symbol#to_proc, Enumerable#map, etc – In Rust: no such tradeoff – Compiler is magic
fast_blank in Rust* * boilerplate not included
fast_blank in Helix
The vision – Keep writing the Ruby you love… –
…without the fear of eventually hitting a wall – Start with Ruby – Move to Helix when appropriate
Last year – Good proof-of-concept – Too hard to use
– Missing basic features
This year – Deploy to production – Polish, documentation –
Features – Focus on Rails
Demo! – End-to-end example – Deploy to Heroku – It
works!™
▶ http://chancancode.tv/helix
Good use cases – CPU-bound – Simple inputs – Avoid
chatty APIs
Good use cases
Good use cases – Use Rust libraries – Leverage Rust
web browser tech – Mailer, Background job, Action Cable
None
Roadmap – Greenfield project – Drop-in replacement – Reopen class
– Ship to production – Binary distribution – Non-traditional use-cases – Performance parity with C – Miscellaneous features and QoL improvements
usehelix.com