What is Mechanical Sympathy?

The term “Mechanical Sympathy” has really come into vogue lately.  It was introduced into the world of low latency/high performance programming by Martin Thompson, who in turn credits the race driver Jackie Stewart with coining the term.  The idea is that in order to design high performance systems, the engineers can’t be ignorant of the underlying implementations.

This, of course, is not news to any experienced performance engineer.  As a matter of fact, as early as 1974, Niklaus Wirth, the inventor of Pascal wrote:

“In fact, I found that a large number of programs perform poorly because of the language’s tendency to hide ‘what’s going on,’ with the misguided intention of ‘not bothering the programmer with details.’”

In today’s world, Mechanical Sympathy implies writing code with the awareness of processor cache architectures, NUMA, TCP bypass, CPU shielding and isolation and other hardware and OS topics.