Ruby Performance Secrets and How to Uncover Them
summary
Specifics matter: inject and especially all? allocate hidden objects when nested in loops and trigger GC, bigdecimal and string comparison is unbelievably slow in Ruby 2.0, and parsed CSV is 13x larger in memory than on disk. Measure with RubyProf (CPU and memory modes), install patched Ruby via rvm and the Rails/patch set, visualize with kcachegrind, and drop into GDB to inspect C-level allocations; test gsub versus gsub! — run the profiler, read the source, and verify any rule of thumb.
AI-written summary · about
chapters (8)
- 0:00Start
- 2:39What do we talk about today?
- 3:30What can go wrong with this code?
- 4:54Let's check what happens
- 6:16Let's profile memory allocations
- 15:52Lessons learned
- 17:05What's the difference?
- 18:13Let's profile memory usage
related talks
38mFinding a needle in the haystack - Debugging performance issues
53mRuby.inspect
42mDebugging Ruby
34mHow to optimize Ruby internal.
42mThe Mechanics of Ruby
41mSpeed up Rails, Speed up Your Code
33mFixing Performance & Memory problems
29mImprove Performance Quick and Cheap: Optimize Memory and Upgrade to Ruby 2.1
