TimelyDataflow / timely-dataflow

A modular implementation of timely dataflow in Rust
MIT License
3.29k stars 272 forks source link

store one element antichains inline #468

Open petrosagg opened 2 years ago

petrosagg commented 2 years ago

Antichains are made to work with partially ordered times but that forces them to allocate a heap vector even in simple cases of totally ordered timestamp types which will never have more than one element in it.

Short of defining a Frontier trait and abstracting generically over multiple independent frontier implementation this simple PR handles it at runtime by backing Antichains with SmallVec.

guswynn commented 2 years ago

most timestamp times are gonna be <= the size of a usize, a vec is 3 usizes, and a smallvec appears to be the size of the array + 1 usize, so making the array's length smaller than 2 is probably just a waste!