Back To Schedule

Designing a Slimmer Vector of Variants

09:00 - 10:30 Friday 3rd May 2024 MT Bethe Hall
Intermediate
Advanced

Heterogeneous containers ("vectors of variants") are an extremely flexible and useful abstraction across many data domains, but std::vector<std::variant<...>> can exhibit extremely bad memory characteristics for mixed types of disparate size, especially if the largest types are relatively uncommon in practice. Variants always have to be at least as large as their largest contained type, and vector implicitly requires all of its members to be the same size, leading to significant bloat in such cases. This talk explores the design of a bit-packed replacement data structure that can achieve massive improvements in memory usage while exporting essentially the same API.

View Slides

Christopher Fretz

Senior C++ EngineerBloomberg LP

Chris is a senior C++ engineer working at Bloomberg LP on a developer experience team for a large organization within the company's market data pipeline. Chris has 8 years of experience working professionally with C++ and has worked on a wide breadth of projects, from low-latency stream processing, to lock free data structure design, to DevX and build system orchestration.