“Datum: A Compact Bitwise Copyable Variant Type”
summary
Datum is an eight byte compact variant on 32-bit that uses NaN-boxing of IEEE-754 doubles to represent regular doubles natively and repurpose NaN payload space for 15 discriminated types, remaining bitwise copyable and trivially destructible. Small strings up to six characters live inline with a length byte, larger strings allocate on the heap. Benchmarks compile with gcc 8 -O2, run 10k iterations creating 100k objects, and show substantially lower memory use and generally faster creation/access than std::variant except for some string/view cases.
AI-written summary · about
chapters (19)
- 0:00Introduction
- 0:22Motivation for Datum
- 1:08Bloomberg data representation
- 4:02What is Datum
- 4:44IEEE-754 double precision format
- 7:42Datum value representation
- 12:44Extended type discrimination
- 14:10Heap allocation and destruction
- 15:14String views in Datum
- 16:1864-bit integer optimizations
- 17:04Aggregate and recursive types
- 17:2664-bit platform implementation
- 18:10Datum vs std::variant comparison
- 20:26Benchmark methodology
- 21:31Performance results
- 23:40Memory and allocation analysis
- 24:22Conclusion and use cases
- 24:44Datum availability and licensing
- 25:30Q&A session
