Hobo / hobo

The web app builder for Rails (moved from tablatom/hobo)
http://hobocentral.net
103 stars 39 forks source link

Add speed improvements to development mode #43

Closed iox closed 6 years ago

iox commented 11 years ago

This is a proposal for improving the development load times with Hobo 2.0 and Rails 3.2, focused on what happens after saving a file and reloading a page. This is what I have done:

If you are interested in testing this, please:

### Speed improvements in development mode ###

# Although with Rails 3.2 dev mode is much faster, after saving a file it still reloads a lot of things
# For example, if you save a controller and reload the page, it can take several seconds to respond
# Same thing with Dryml (very annoying when you are editing and instantly trying the app)

# These are a couple of options to improve performance
# NOTE: You will lose automatic generation of routes and pages/cards/forms (you will need to restart the app)
::Rails.application.config.hobo.fast_dev_mode = true
::Rails.application.config.hobo.cached_tags = ["hobo_bootstrap", "hobo_rapid", "forms.dryml", "cards.dryml", "main_nav.dryml", "pages.dryml"]
# # Along with the previous options, uncomment these lines
Rails::Generators.invoke('hobo:routes', %w[-f -q])
Dryml::DrymlGenerator.run

# # Get rid of an annoying bug in the log
RailsDevelopmentBoost.async = false if defined?(RailsDevelopmentBoost)

# Apart from these, please set these in config/environments/development.rb:
# - config.action_controller.perform_caching = true. This will make <hobo_cache> work (I recomment to use it in main_nav, as it's a very slow piece of code)
# - config.assets.debug = false. This will reduce the amount of files sent to the browser.

# And more optimizations!
# - Install rails dev boost (https://github.com/thedarkone/rails-dev-boost)
# - Install turbolinks (http://hobocentral.net/blog/2012/12/07/turbolinks/)

As you can see in the comments, I've also added some extra optimizations you can try.

iox commented 11 years ago

Caution note: I think I found a bug with partials Ajax updates. Most work, but I have one case where they are failing. If you are using this branch, please check it. I'll try to fix the problem and update the branch ASAP.

iox commented 11 years ago

Forget my last caution note: the problem with partials was unrelated to this branch :).