Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Measuring Sprockets Sass rendering

branch: master
Octocat-spinner-32 app I SMELL SLOW
Octocat-spinner-32 vendor I SMELL SLOW
Octocat-spinner-32 .gitignore I SMELL SLOW
Octocat-spinner-32 Gemfile I SMELL SLOW
Octocat-spinner-32 Gemfile.lock I SMELL SLOW
Octocat-spinner-32 README.md I SMELL SLOW
Octocat-spinner-32 render.rb try measuring Sprockets::Index
README.md

Sprockets is slow to render Sass in Rails that has a reasonable number of @imports. Trying to figure out why.

Here I have taken out my project's assets and set up the "render.rb" script to manually bootstrap Sass, Compass and Sprockets to compare:

  1. Direct Sass rendering (no Sprockets)
  2. Sprockets rendering without its own cache
  3. Monkeypatched Sprockets rendering (experimenting)

The results I'm getting are pretty consistent:

$ bundle exec ruby render.rb 

Rendering a changed stylesheet 20 times:
                        user     system      total        real
direct:             4.330000   0.260000   4.590000 (  4.572378)
sprockets:         11.250000   0.510000  11.760000 ( 11.751674)
sprockets hacked:   7.230000   0.300000   7.530000 (  7.510054)

Direct Sass is reasonably fast. Same stylesheet through Sprockets is twice as slow. Currently experimenting on optimizing it makes it closer to direct rendering, but not quite there yet.

Something went wrong with that request. Please try again.