small medium large xlarge

Ruby Performance Optimization AND Your Code as a Crime Scene

March 25, 2015

Did you know that Saturn's largest moon, Titan, was discovered on this day in 1655 by Huygens? It's amazing the things you can discover if you just know where to look.

The art of performance optimization is all about knowing where to look. Learn the secrets in Ruby Performance Optimization: Why Ruby Is Slow, and How to Fix It (

And speaking of learning secrets, what happens when you apply forensic psychology techniques to your project and code base? Find out how in Your Code as a Crime Scene: Use Forensic Techniques to Arrest Defects, Bottlenecks, and Bad Design in Your Programs, now in print and shipping from

Read on for details…

Ruby Performance Optimization: Why Ruby Is Slow, and How to Fix It

This is the first book ever that consolidates all the Ruby performance optimization advice in one place. It's your comprehensive guide to memory optimization, CPU optimization, garbage collector tuning, profiling, measurements, performance testing, and more.

You'll go from performance rookie to expert. First, you'll learn the best practices for writing Ruby code that's easy not only on the CPU, but also on memory, and that doesn't trigger the dreaded garbage collector. You'll find out that garbage collection accounts for 80% of slowdowns, and often takes more than 50% of your program's execution time. And you'll discover the bottlenecks in Rails code and learn how selective attribute loading and preloading can mitigate the performance costs of ActiveRecord.

As you advance to Ruby performance expert, you'll learn how to profile your code, how to make sense out of profiler reports, and how to make optimization decisions based on them. You'll make sure slow code doesn't creep back into your Rails application by writing performance tests, and you'll learn the right way to benchmark Rails.

And finally, you'll dive into the Ruby interpreter internals to really understand why garbage collection makes Ruby so slow, and how you can tune it up.

Now available in beta from

Your Code as a Crime Scene: Use Forensic Techniques to Arrest Defects, Bottlenecks, and Bad Design in Your Programs

Software is a living entity that's constantly changing. To understand software systems, we need to know where they came from and how they evolved. By mining commit data and analyzing the history of your code, you can start fixes ahead of time to eliminate broken designs, maintenance issues, and team productivity bottlenecks.

In this book, you'll learn forensic psychology techniques to successfully maintain your software. You'll create a geographic profile from your commit data to find hotspots, and apply temporal coupling concepts to uncover hidden relationships between unrelated areas in your code. You'll also measure the effectiveness of your code improvements. You'll learn how to apply these techniques on projects both large and small. For small projects, you'll get new insights into your design and how well the code fits your ideas. For large projects, you'll identify the good and the fragile parts.

Large-scale development is also a social activity, and the team's dynamics influence code quality. That's why this book shows you how to uncover social biases when analyzing the evolution of your system. You’ll use commit messages as eyewitness accounts to what is really happening in your code. Finally, you'll put it all together by tracking organizational problems in the code and finding out how to fix them. Come join the hunt for better code!

Now in print and shipping from

Upcoming Author Appearances

  • 2015-03-25 Adam Tornhill,
    DevWeek, London, UK
  • 2015-03-26 Rachel Davies,
    CukeUp, London
  • 2015-03-26 Chris Adamson,
    CocoaConf Chicago
  • 2015-03-26 Seb Rose,
    CukeUp, London
  • 2015-03-27 Chris Adamson,
    CocoaConf Chicago
  • 2015-03-27 Janie Clayton,
    CocoaConf Chicago
  • 2015-03-28 Chris Adamson,
    CocoaConf Chicago
  • 2015-03-31 Johanna Rothman,
    Influential Agile Leader, San Francisco
  • Track Your Shipment

    Did you know you can now track your own paper book shipments? Just log in to your account on and under "Your Orders" you'll see tracking number links for your paper books. Click on that, and you'll see your tracking status directly from UPS, USPS, or DHL.

    Don't Get Left Out

    Are your friends jealous that you get these spiffy email newsletters and they don't? Clue them in that all they need to do is create an account on (email address and password is all it takes) and select the checkbox to receive newsletters.

    Are you following us on Twitter and/or Facebook? Here's where you can find us and keep up with the latest news and commentary, and occasional discounts:

    Tell your friends! Tweet this

    Follow us on Twitter: pragprog</a>, <a href="">pragpub, Andy PragmaticAndy</a> and Dave <a href="">pragdave.

    Coming Soon:

    • iOS 8 SDK Development: Creating iPhone and iPad Apps with Swift, in print
    • Clojure Applied: From Practice to Practitioner, in beta

    Recently Released:

    Thanks for your continued support,

    Dave & Andy
    The Pragmatic Programmers

    Books • eBooks • PragPub Magazine • Audiobooks and Screencasts