Last Updated: February 25, 2016
·
1.715K
· alanandrade

Is your Rails dev. environment slow?

Read if you use the asset pipeline

The reasons for your development environment to be slow could vary a lot, however, I'd like to share something that happened to us and I hope it works for you too.

Problem

Our Rails app was serving pages fast enough ~1-1.5 seconds, but the page would render after 15 seconds.

The "problem" was on the browser. Rails by default sets the config.assets.debug flag as true for development. This will serve your javascripts and css separately. The browser was literally choking with more than 150 connections trying to retrieve them.

Solution

  1. Go to config/environments/development.rb
  2. Use this configuration: config.assets.debug = false

Cons

Your Javascripts and CSS will be on 1 file each. It's supposed to make it harder to debug.

Pros

Speed.