Skip to content

In HFT, please use static linking.

When you're optimizing for nanoseconds, runtime behavior matters more than startup time or convenience.

Static linking - especially when combined with native compilation (-march=native, -O3, -mavx, etc.) - offers real runtime performance benefits.

Here is the list of static linking benefits:

1. No PLT/GOT indirection

Fewer branch mispredictions, faster execution

2. Tighter instruction layout

Improved instruction cache hit rates

3. Fewer TLB misses

More compact memory mapping reduces access latency

4. More predictable branches

Helps the CPU's branch predictor perform better

5. Stronger compiler optimizations

Cross-module inlining and vectorization

Conclusion

These improvements aren't theoretical - they show up in lower tail latencies and more consistent performance under load, especially on pinned, isolated CPU cores.

In HFT, static linking isn't a nice-to-have. It's essential.