Tiny:optional – a C++ optional that does not waste memory
Tiny:optional – a C++ optional that does not waste memory
tiny::optional is a header-only C++ library for x86/x64 intended to be a drop-in replacement for std::optional with the twist that it does not require additional memory for bools, floats, doubles and raw pointers. For example, a standard optional double has twice the size of a raw double because of 7 padding bytes after the internal bool. These wasted bytes can have a notable impact on performance in memory bound applications. On the other hand, a tiny::optional double has the size of a double by exploiting unused bit patterns. For other types such as integers, it allows to specify a "sentinel" value that represents the empty state, again causing the optional to have the same size as the underlying type. Quick example: https://godbolt.org/z/83xo9hdxT
Share cardActual performance
Launch Intel predictions
Analyze your own launch →Incorrect prediction on native model
Similar products
Revring, a circular buffer with zero memory waste
How does JAX allocate memory on a TPU? An interactive C++ walkthrough
Spamnesty: Waste spammers' time
KnotFlow – Waste time putting knots in wood
Timewaster – They waste your time. Return the favor
A tiny x86 compiler with ELF and PE target
A tiny WebAssembly compiler
Haskell Tiny Tetris
Tiny VPSs without exhausting IPv4 addresses
A tiny Go wrapper around Restcountries