-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize ResultTile::compute_results_sparse<char>
This makes three optimizations to `ResultTile::compute_results_sparse<char>`: 1. When executing on a dim_idx > 0, values in `r_bitmap` may be zero. In this scenario, we can skip checking the associated coordinate for an intersection. This saves us one string comparison for each coordinate. 2. When executing on a dim_idx > 0, we may have many contiguous zeroes in `r_bitmap`. In this scenario, we can do a `memcmp` in place of a loop that checks each individual coordinate. This size of this `memcmp` is fixed to 256. 3. When executing on dim_idx == 0, we know that coordinates are sorted. For any arbitrary subrange in the list of coordinate values, we know that all values in the subrange are identical if the first and last values are equal. In this patch, the list of coordinate values are partitioned into 6 ranges. If the first and last values match in one of these ranges, we perform a single computation for `r_bitmap` and apply it to all values in the range. * This patch has two fixed values, 256 (see #2) and 6 (see #3). I intentionally did not put these into our misc/constants.h because these are only applicable in this path. ** For #3, I tried an approach where I start with a single range and split it for each time there is not a match. This could be done either recursively or iteratively. I did not try doing it recursively because recursive routines can not be inlined and would be too expensive. I tried an iterative implementation and it was significantly slower than 6 fixed ranges because of the state it had to track.
- Loading branch information
Showing
3 changed files
with
226 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters