November 2015
Intermediate to advanced
200 pages
4h 26m
English
Two things in our applications can randomly slow it down: GC and system calls. (I/O is the most common case of a system call.)
I can imaging you sighing, “Oh no, not GC again.” But in this case it’s easy to neutralize its effect on measurements, in one of two ways.
First, it’s sometimes OK to disable GC completely before measurement. If raw performance of our code is what we’re interested in, then it’s absolutely fine to do that.
If we want our measurement to be closer to the real world, we can try to make GC as predictable as possible by forcing it before executing the code, like this:
| | GC.start |
| | measurement = Benchmark.realtime do |
| | ... |
| | end |
This way our code will trigger GC in the same manner ...
Read now
Unlock full access