Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Fast Rails (Beta)

Winston
January 27, 2015

Fast Rails (Beta)

This is a work-in-progress talk, subject to changes.

First given at RubySG's meetup on 27 Jan, 2015.

Winston

January 27, 2015
Tweet

More Decks by Winston

Other Decks in Programming

Transcript

  1. Fast Rails (Beta)

  2. Frontend Backend Database

  3. This slide intentionally left blank.

  4. Front End

  5. PageSpeed! https://developers.google.com/speed ! YSlow! http://yslow.org/

  6. Asset Pipeline! Far Future Expires Minify JavaScript + CSS Minimize

    HTTP Requests Multiple Asset Hosts (http://api.rubyonrails.org/classes/ActionView/Helpers/AssetUrlHelper.html)
  7. Compression! http://nginx.org/en/docs/http/ngx_http_gzip_module.html https://github.com/romanbsd/heroku-deflater

  8. CDN! Static Assets Dynamic Content

  9. Browser Caching! `expires_in`, `expires_now`, `fresh_when`, `stale?` (http://api.rubyonrails.org/classes/ActionController/ConditionalGet.html)

  10. Assets Loading! Stylesheets at the Top JavaScripts at the Bottom

    (async)
  11. Images! `gem install smusher` Lazy Load

  12. FOUT! (Flash of Unstyled Text) https://github.com/typekit/webfontloader

  13. Turbolinks! mmmm…

  14. Backend

  15. Update! Ruby 2.2.0 Rails 4.2

  16. Memory! Server Database

  17. Background Jobs! Email/Image Processing

  18. Data Storage! Save to S3? Delete from S3?

  19. Caching! Russian Doll Caching Low-Level Caching

  20. Views! helpers (inline) > partials > loop `render ‘article’, collection:

    @articles`
  21. Fast Ruby! https://github.com/JuanitoFatas/fast-ruby

  22. Fast Code! `exists` vs. `present?` Loop in Code vs. SQL

  23. Development! `spring`, `guard`

  24. Database

  25. ActiveRecord! Foreign Keys, Composite Keys, SQL Explain `find`/`find_by`/`find_by_` vs. `where(..).take`

  26. Indexes! Foreign Keys, Composite Keys, SQL Explain https://github.com/eladmeidar/rails_indexes

  27. n+1! `gem install bullet`

  28. The End (Beta)