---
title: "We Patched Ruby On Rails for a 10% Performance Bump"
description: "Rails response time improved by more than 10% in a patch that also reduced allocated objects by 29%, motivated by memory and performance problems observed in production Heroku applications. The work began with customer reports of R14 out-of-memory errors, swap usage, and suspected memory leaks, then used a customer app and reusable benchmarks to reproduce issues. The derailed benchmarks perf:objects task and memory_profiler exposed allocation hot spots, including arrays joined into strings and duplicated hashes; refactoring reduced unnecessary objects, while routing changes produced a 31% speed increase for constrained URL generation. The resulting savings required no application changes and were planned for the next Rails version, with Rails 5 pre-release testing mentioned."
---

# We Patched Ruby On Rails for a 10% Performance Bump

[Heroku](https://yomu.fyi/company/heroku) · Richard Schneeman · Aug 6, 2015

**Type:** Benchmark

## Summary

Rails response time improved by more than 10% in a patch that also reduced allocated objects by 29%, motivated by memory and performance problems observed in production Heroku applications. The work began with customer reports of R14 out-of-memory errors, swap usage, and suspected memory leaks, then used a customer app and reusable benchmarks to reproduce issues. The derailed benchmarks perf:objects task and memory\_profiler exposed allocation hot spots, including arrays joined into strings and duplicated hashes; refactoring reduced unnecessary objects, while routing changes produced a 31% speed increase for constrained URL generation. The resulting savings required no application changes and were planned for the next Rails version, with Rails 5 pre-release testing mentioned.

## Context

Heroku applications were experiencing R14 out-of-memory errors, rapid swap usage, slow performance, and concerns about memory leaks. Customer reports and dashboard metrics exposed these problems, prompting investigation into Rails and application memory use.

## Approach / What changed

Reusable benchmarks reproduced customer issues, while derailed benchmarks and memory\_profiler identified Rails allocation hot spots. The patch refactored code to avoid temporary arrays and duplicated hashes, modify objects in place where appropriate, and use pooled frozen strings; routing code was also optimized.

## Takeaways

- The patch improved Rails response time by more than 10% and reduced allocated objects by 29%.
- A constrained URL-generation route using GitHub-style routes became 31% faster after routing optimizations.
- Applications can receive the improvements by upgrading Rails without changing how their Rails apps are written.

**Tags:** [Performance](https://yomu.fyi/topic/performance), [Ruby](https://yomu.fyi/topic/ruby), [Ruby on Rails](https://yomu.fyi/topic/ruby-on-rails)

- Source: [Heroku](https://www.heroku.com/blog/patching-rails-performance)
- Source URL: https://www.heroku.com/blog/patching-rails-performance
- Ingested by Yomu: 2026-09-09T14:24:18.258Z

[Read original post](https://www.heroku.com/blog/patching-rails-performance)
