# Rails is a JIT compiler

> Rails enums can be optimized with JIT compilation for faster code execution.
- Title: Rails is a JIT compiler · Rails at Scale | Shortify
- Summary: Rails enums can be optimized with JIT compilation for faster code execution. Rails enums improve performance when compiled with JIT by reducing dynamic…
- Keywords: rails, jit, enum, performance, active record, ruby, technology, startups, compiler, Rails at Scale
- Source: Rails at Scale — https://railsatscale.com/2026-10-21-rails-is-a-jit-compiler
- Author: Max Bernstein
- Published: 2026-10-21T00:00:00+00:00
- Read time: 1 min
- Topics: rails, jit, enum, performance, active record, ruby, technology, startups
## The title was bait
The article's title was designed to attract readers but promises run-time code generation.

> See the PR for a sneak peek
## Sam's optimization question
Sam asked how to optimize Rails enums in Roundhouse using a specific code snippet for order status checks.
## Rails enum implementation
Rails generates methods for enum values using public_send to compare database values.
## Dynamic behavior issue
The generated methods use public_send causing slow method dispatch without caching.
## Nerd sniping Aaron
The author asked Aaron to fix the enum implementation using module_eval for static method generation.
## Performance improvements
The fix increased shippable? performance from 1.72M i/s to 18.5M i/s with JIT compilation.
## Key lessons
Static method generation improves performance by avoiding dynamic lookups and public_send calls.
## Key takeaway

Rails enums improve performance when compiled with JIT by reducing dynamic method lookups.