Semi-static conditions in low-latency C++ for high frequency trading: Better than branch prediction hints
Conditional branches pose a challenge for code optimisation, particularly in low latency settings. We present a novel language construct, referred to as a semi-static condition, which enables programmers to dynamically modify the direction of a branch at run-time by modifying the assembly code within the underlying executable. Subsequently, we explore scenarios where the use of semi-static conditions outperforms traditional conditional branching, highlighting their potential applications in real-time machine learning and high-frequency trading (HFT). Throughout the development process, key considerations of performance, portability, syntax, and security were taken into account. • Decoupling of condition evaluation logic and branch taking controlled directly by the programmer. • Semi-static checks demonstrate their real-world applicability, particularly within real-time systems. • The research contribution is encapsulated within a open-source library: https://github.com/maxlucuta/semi-static-conditions . • Focus on syntax, security, efficiency, and portability. • Semi-static conditions can be seamlessly integrated into high-performance real-time systems.
Authors
- Paul Bilokon (ORCID: https://orcid.org/0000-0001-6846-6649)
- Maximilian Lucuta
- Erez Shermer
Institutions
- Imperial College London (GB)
Publication Details
- Journal
- Journal of Parallel and Distributed Computing
- Published
- 2024-10-24
- DOI
- https://doi.org/10.1016/j.jpdc.2024.105000
- Primary Topic
- Advanced Data Storage Technologies
- Type
- article
- Field-Weighted Citation Impact
- 0.00