Repository navigation
perf(fastlanes): push FoR ordering comparisons to the encoded values - #10147
Conversation
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
|
This PR has been marked as stale because it has been open for 14 days with no activity. Please comment or remove the stale label if you wish to keep it active, otherwise it will be closed in 7 days |
|
Yes hello, |
1f2a36a to
41003b0
Compare
41003b0 to
2cfa43a
Compare
9615f8b to
11cd5c3
Compare
FoR only compared for equality, so ordering comparisons decoded the array, which also bypassed the bit-packed child's own kernels. The reference must be at most every valid value, which the encoders guarantee by using the minimum. Each encoded value then holds the exact distance from the reference, read as unsigned. For unsigned types the kernel compares the encoded values against the constant's distance. For signed types, distances above the type's maximum read as negative, so each operator becomes one between on the encoded values, or its negation. This needs no statistics and keeps a bit-packed child packed. A constant below the reference answers with a constant result. Tests build FoR over bit-packed children with signed, unsigned, and nullable values, and over an i8 child that spans the full range, and compare every operator against the primitive baseline. Signed-off-by: Robert Kruszewski <github@robertk.io>
A constant below the reference answers every row without the encoded values. The answer took only the nullability of the constant, so a nullable array compared to a non-nullable constant gave a non-nullable result, and an all-null array panicked when it made a null scalar. Join the nullability of the array with the nullability of the constant, and test the all-valid, all-invalid and array validities. Signed-off-by: Robert Kruszewski <github@robertk.io>
f27a0c4 to
067cdf7
Compare
Replace the `NativePType + PrimInt` bounds with `IntegerPType` and make the `FoRData` reference invariant easier to read. Signed-off-by: Robert Kruszewski <github@robertk.io>
Answer Eq and NotEq with a constant when the constant is below the reference. Rename compare_encoded to compare_unsigned_encoded, bound it on IntegerPType and document it. Move strictness into compare_signed_encoded. Signed-off-by: Robert Kruszewski <github@robertk.io>
6039243 to
6ebdf4e
Compare
Signed-off-by: Robert Kruszewski <github@robertk.io>
FoR only compared for equality, so ordering comparisons decoded the array, which also bypassed the bit-packed child's own compare kernel. Encoding subtracts the minimum, so the encoded values are non-negative distances. For unsigned types the kernel compares them against the constant's distance directly; for signed types it does so when the child is bit-packed, which keeps the distances non-negative in the signed reading, and otherwise falls back to decoding. A distance that does not fit the type answers by which side of the reference the constant lies on.