Tous les livres

Professionnel

Applis À propos Coach Connexion Commencer la lecture

Quantitative Finance · Glossaire

Qu'est-ce que « Static polymorphism, curiously recurring template pattern » ?

Aussi appelé : static polymorphism · curiously recurring template pattern

Definition 7.2 Low-Latency Software · Chapitre 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.
Lire dans le chapitre →