Skip to content

Instantly share code, notes, and snippets.

@marianposaceanu
Last active December 19, 2015 17:48
Show Gist options
  • Select an option

  • Save marianposaceanu/5994011 to your computer and use it in GitHub Desktop.

Select an option

Save marianposaceanu/5994011 to your computer and use it in GitHub Desktop.

Tweaking Rails performance

Gems for better speed

Using Rails for an API drop unneeded modules

Use ActionController::Metal

class Api::V1::BaseController < ActionController::Metal
  include ActionController::Rendering        # enables rendering
  include ActionController::MimeResponds     # enables serving different content types like :xml or :json
  include AbstractController::Callbacks      # callbacks for your authentication logic
 
  append_view_path "#{Rails.root}/app/views" # you have to specify your views location as well
end

DB

Use less branching (micro-optimization)

Profiling

Note : when using Peek with Unicorn or something similar change the adapter from memory to redis or dalli

Credits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment