Propshaft Performance Issues on Rails 8
Upgraded to Rails 8 and swapped out Sprockets for the shiny new Propshaft gem? Great choice. Got a lot of assets? You might be in for a nasty surprise.
I recently migrated a Rails app with what I thought was a relatively small number of JS and CSS assets to use Propshaft. Page loads that had previously taken 150 - 200 ms suddenly slowed to a multi-second crawl, with 90%+ of the time completely unaccounted for—no slow Ruby code, no database bottlenecks, just mysterious delays.
The culprit? Propshaft’s default behavior manually checks every single asset for changes on each page load. With “a lot of assets,” this becomes a performance disaster.
The fix is delightfully simple once you know it exists. Add the listen
gem to your development group:
group :development do
gem 'listen'
# ... other gems
end
Then add this single line to config/environments/development.rb
:
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
That’s it. Page loads went from glacial back to snappy.
The Propshaft documentation mentions this optimization, but it’s buried at the bottom. Given how dramatic the performance impact is with asset-heavy apps, this really should be the default configuration.
If your Rails 8 app suddenly feels sluggish after switching to Propshaft, this is probably why. The asset pipeline shouldn’t be the bottleneck in your development workflow.