Skip to content

Latest commit

 

History

History
334 lines (208 loc) · 15.7 KB

optimization_and_hardware.md

File metadata and controls

334 lines (208 loc) · 15.7 KB

Optimization

Table of contents


Optimizations

See also Optimizations – Compilers.

🔗

🎥

📖

Branch prediction

🔗

[[likely]] / [[unlikely]] attributes

These attributes allow the compiler to optimize for the case where paths of execution are more or less likely than any alternative path of execution.

likely / unlikely Linux kernel macros

Memory

🔗

Memory copying

🔗

Memory allocation

See also Allocators – The standard library and proposals.

🔗

🎥

Memory relocation

🔗

🎥

Memory access

Nested std::vectors

Aliasing

See also Type-punning – Core language.

🎥

Floating-point arithmetic

🔗

Integral arithmetic

Integral multiplication

Integeral division

🔗

Empty base class optimization (EBO)

Empty base class optimization allows the size of an empty base subobject to be zero. Empty base optimization is required for standard layout types.

struct Empty {};
static_assert(sizeof(Empty) >= 1);

struct Derived : Empty {
    T i;
};
static_assert(sizeof(Derived) == sizeof(T));

🔗

🎥

📖

Return value optimization and copy elision

🔗

🎥

Tail call optimisation

🔗

Devirtualization

🔗

Undefined behavior

🔗

🎥

Infinite loops

See also Infinite loop – Patterns, idioms, and design principles.

🎥

Strict aliasing rule

See Type-punning – Core language.


Benchmarking

🔗


Profiling

🎥