CppCon 2018: Rishi Wani “Datum: A Compact Bitwise Copyable Variant Type”

preview_player
Показать описание


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.

Rishi Wani
Senior Software Engineer, Bloomberg
Rishi is a senior software engineer at Bloomberg. He has been programming in C++ since 2002.


*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

Thank you for this presentation, Rishi. It was very informative. I've been messing with bit-packing types since the start of the summer and you gave me some ideas!

curoamarsalus
Автор

some other points: usecases mention "spreadsheets" and data usage as important, but you do not discuss why not use float(or even clipped float(FP16)). Is precision so important you need double over float, but not decimal?

Voy
Автор

Unless I missed it, video did not show slide with link.

TaiDesHen
Автор

rishinmotion thank you for answering questions... wrt datum I feel it is quite ugly data type to work with, but the performance requirements you have make it mandatory. If it was me implementing it I would make it movable type that requires you to manually make a copy, something how unique_ptr has low overhead over raw ptr but it is not leaky.

Voy
Автор

Around 19:00 Datum "May allocate memory on heap" but it is "Bitwise copyable" and has "Trivial destructor", how can this all be true?

Lecopivo
Автор

And then someone comes around and copy-pastes it into excel

OperationDarkside