Using Ruby to generate faster Ruby code through partial evaluation 3.26 http://spkr8.com/t/1810

Description:

Ruby performance has become a focus of the Ruby community in recent years. Both new implementations of Ruby (i.e. YARV, JRuby, IronRuby, MacRuby, and Rubinius) and "best-practices" have been introduced to address performance issues. We take a complementary approach in our work, applying source-to-source translation to partially evaluate Ruby. Partial evaluation pre-computes the parts of a program known before run-time to avoid performing these calculations at run-time. We introduce our partial evaluator and two Ruby-embedded DSLs we developed to aid our implementation---RubyWrite and ShadowBoxing. The partial evaluator takes a Ruby source program as input and outputs an equivalent Ruby program with statically known values pre-computed. RubyWrite enables us to easily represent and manipulate the abstract syntax tree (AST). ShadowBoxing lets us write succinct rules to "unparse" the AST back to Ruby source. Our approach sits neatly between making programmers entirely responsible for performance and faster Ruby implementations, providing a tool that can be used on any implementation to help improve performance.

Comments on this Talk

Have an account? Sign in or register.

Leave a Comment

4 Ratings: 3.26

Delivery: 3.45

Content: 3.08