Datum is a value-semantic variant type used at Bloomberg. It has trivial construction, destruction, copy-construction and copy-assignment semantics. It encodes values of many frequently used types, such as doubles, integers, Booleans, and pointers inside a double value on a 32 bit platform without requiring any memory allocations. Values of more complex types like strings and arrays are allocated on the heap and a pointer to the memory is stored inside the Datum.
Due to Datum's compact representation, it reduces the memory footprint of applications. Datum's trivial initialization and copy semantics ensure that there is a negligible cost to default-constructing and moving around a large number of such objects, thus reducing the overall CPU usage of applications. In this talk, we will look into the implementation of Datum and benchmarks comparing Datum with a few other variant types.