Reputation: 6421
I have read dozens of posts all over the internet about this but mostly for Rails 3.
For some reason, it takes 35 seconds to load a page with a total of 34 assets in development.
I have done the following:
config.assets.debug = false
in development.rb, but this only cuts it down to 30 seconds,I'm developing on an ubuntu box using vagrant (https://github.com/rails/rails-dev-box). The host machine is the fastest, new MacBook Pro.
I'm almost going to throw out the asset pipeline altogether and compile the assets myself. I cannot wait 35 seconds every time I need to reload the page.
Any help on this is appreciated.
development.rb:
MyProject::Application.configure do
config.cache_classes = false
config.eager_load = false
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_mailer.raise_delivery_errors = false
config.active_support.deprecation = :log
config.active_record.migration_error = :page_load
config.assets.debug = false
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
end
Edit
I think the issue is the VM. I installed ruby on my Mac using homebrew and ran the same project with the exact configuration and it loads in under 1 second. I'm not sure what the problem is.
Upvotes: 3
Views: 1008
Reputation: 147
The issue is probably with your shared_folder on Vagrant box, which can be fixed by using rsync:
brew install rsync
type: "rsync"
to your synced_folder: config.vm.synced_folder "[path to host folder]", "[path to guest folder]", type: "rsync"
I was experiencing 20-25 second page load times, and once I added rsync, my pages were loading in under a second. Since the shared_folder by default is only pointing to your code, it essentially has to load those files to the VM each time the page loads.
Upvotes: 3
Reputation: 3959
adding gem 'rack-mini-profiler'
or less-easy-to-use gem 'ruby-prof'
can help to find what renders slow
i have around fifty heavy js|css files and it renders pretty fast in development environment, so it is very unlikely that problem core in assets pipeline itself
Upvotes: 0