Helix makes writing Ruby classes in Rust safe and fun. Find out how!
Previously…
View Slide
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
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