# Low Latency C++ for Fun and Profit - [https://github.com/pacificplusplus/conference/blob/master/slides-2017/Low Latency C%2B%2B for Fun and Profit/slides.pdf](https://github.com/pacificplusplus/conference/blob/master/slides-2017/Low%20Latency%20C%2B%2B%20for%20Fun%20and%20Profit/slides.pdf) 重點 - remove branch - template-based configuration - memory alloc (pooling) - exception - almost zero-cost if not throw - avoid multi threading - shared data - synchronization - contention (last level cache lock) - SPSC lockfree queue - cache line friendly - dense_hash_map / flat_hash_map / ska::flat_hash_set - gcc - branch prediction hints - force inline / noinline - attribute hot & cold - [GNU中attribute中的cold和hot](https://blog.csdn.net/u010383937/article/details/78593491) - prefetching - hotpath pre warm (run through the entire system) - performance counter - cache miss event etc - compare instruction - RDTSC for high resolution timestamp