pub enum Live<'l> {
All,
None,
Mask(&'l Bitmap),
}Expand description
A Validity borrowed as a Copy value, so a row loop can decide the case once.
The three cases are the same three. The difference is that this is a small Copy value rather
than a shared reference to one, and that is what lets the compiler lift the match out of a row
loop. Through a &Validity it cannot: the loops that ask row by row also call into code the
compiler cannot see through, it has to assume one of those calls could write through the
reference, and so it reloads the discriminant and re-decides the case on every row.
The note at the top of this file says the cost of knowing which case you are in is one branch
per vector rather than one per value. Read through Validity::is_valid that is true wherever
the compiler can see the whole loop and false wherever it cannot. Read through this it is true
either way, because there is no reference left for a call inside the loop to have written
through.
How much that is worth is small and worth saying plainly. On q01 it is 0.54 percent of the query, which is the one place it shows up at all, because q01’s decimals arrive as a dictionary over a packed run and the four packed loops are where the reference was surviving. q10 and q18 both come out inside their own control spread, which is to say unchanged.
Variants§
All
Nothing is null.
None
Everything is null.
Mask(&'l Bitmap)
Some of each, one bit per value, set meaning valid.