Archive for February 11, 2018
-
Ruby performance: Using benchmarks and memory_profiler to chase performance degradations
February 11, 2018
While working on some of the performance improvements for version 1.0.0 of Rambling Trie late in 2016 and early in 2017, I upgraded from Ruby 2.3.3 to Ruby 2.4.0 imagining that the newer version would help me on my mission to make all operations execute a bit faster. To my surprise, I ran into a significant performance degradation after upgrading - specifically, there was a ~25% increase in the time it took to execute a script using a trie with a big-ish word dictionary. This intrigued me enough that I decided to take a closer look.
Benchmarking with Ruby
After some investigation with the help of Ruby’s own
Benchmark
, I realized that while most operations were a bit slower, the main problem was a lot more visible during intensive operations…