Skip to content
Measuring Sprockets Sass rendering
CoffeeScript Ruby JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
app/assets
vendor/assets/javascripts
.gitignore
Gemfile
Gemfile.lock
README.md
render.rb

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.