• SQL is complex • pluck instead of map • order instead of sort_by • any? instead of present? • size instead of count or length • find_each instead of all • select to limit fields • Avoid collection.to_a • N+1 queries are not always bad
things! • Use recent Ruby versions • Try optimised gems (fast_blank, fast_jsonapi, concurrent-ruby-ext etc.) • Know your language (GC, Heap, Constant cache etc.) • Concurrency / background jobs • Ruby fine tuning (ENV vars tweaking, alternative malloc) • Also DevOp
• All those things that Rails is already doing ◦ Single file, minify, compress, hash etc. • HTTP headers • Limit connections • Split critical CSS • Limit or async web fonts • Use a CDN • Try new technologies: HTTP/2, WebP...