Alle boeken

Professioneel

Apps Over Coach Inloggen Begin met lezen

Quantitative Finance · Begrippenlijst

Wat is Static polymorphism, curiously recurring template pattern?

Ook bekend als: static polymorphism · curiously recurring template pattern

Definition 7.2 Low-Latency Software · Hoofdstuk 7 — C++ for Latency II: Compile Time

Static polymorphism selects the function to call at compile time, by templates or overloading, so that every call is direct. In the curiously recurring template pattern (CRTP) a class template takes its own derived class as a parameter, struct Book : Base<Book>, and the base calls the derived class’s functions through a static_cast of this.

Cost per message of three ways to dispatch it to its handler, on a stream of one type and on a random mix, and of a four-stage pipeline composed statically (firm.pipeline) and through virtual calls (the pipeline’s cost does not depend on the message mix). Measured on a laptop (Intel Core Ultra 7 155H) under WSL2, no isolated cores, pinned to one CPU, best of 15 runs of 65 536 messages. Data: bench_dispatch.py.
Figure 7.1. Cost per message of three ways to dispatch it to its handler, on a stream of one type and on a random mix, and of a four-stage pipeline composed statically (firm.pipeline) and through virtual calls (the pipeline’s cost does not depend on the message mix). Measured on a laptop (Intel Core Ultra 7 155H) under WSL2, no isolated cores, pinned to one CPU, best of 15 runs of 65 536 messages. Data: bench_dispatch.py.
Lees in het hoofdstuk →