söndag 7 januari 2018

Performance degradation after meltdown mitigation

If you haven't been living under a rock the last week, you already heard of the meltdown attack. I was worried about how slow my computer would be after applying the mitigations. So I measured the most important and common task for me - compiling c++ code.
My test system is an aging laptop, with an Intel Core i5-2410M CPU. It runs Debian Stretch with a fast SATA ssd with an ext4 filesystem on it.
I timed compilation of a c++14 source tree with roughly 60000 lines of code. This project is very relevant to me and is a mix of c with classes with more modern code.

Compilation from scratch

The exact commandline is
rm -rf * && ccache --clear --clean && cmake .. -GNinja && time ninja
When I run it three times in a row I get
real    4m14,130s
sys    0m49,784s
real    3m14,822s
sys    0m49,948s
real    3m21,067s
sys    0m49,760s
with the original system (without the mitigation, kernel 4.9.65-3+deb9u1).
The patched system (kernel 4.9.65-3+deb9u2) gives:
real    3m12,479s
sys    0m54,496s
real    3m17,868s
sys    0m54,756s

The total time (real) is smaller than the repeatability. The system time (time spent in the kernel) increased with approx. 5%.

Compilation with hot cache

This time I did not clear the ccache. The command line is
rm -rf * && cmake -GNinja .. && time ninja
With the original system, I get for three consecutive runs
real    0m13,342s
real    0m12,867s
real    0m12,700s

With the patched system, I get:

real    0m13,645s
real    0m13,637s
real    0m13,512s

Now when most of the work consists of getting cached results instead of compiling, a slowdown on the total time is noticed. It seems to be approximately 0.8 seconds which is 6% slower. I imagine this is the worst case.

Verdict

This was far better than I feared. Thank you all hard working developers.