wt-slice
High-performance extensions for ordered slices.
This is a fork of superslice. It preserves superslice's lower-bound, upper-bound, equal-range, and permutation APIs while adding exact-search experiments for WorkTablesIndex.
Licensed under APACHE-2.
Installation
Until the fork is published, use its Git repository:
[]
= { = "https://github.com/pathscale/wt-slice" }
and augment slices by using its Ext trait:
use *;
Now you can enjoy high performance of common algorithms on slices:
exact_searchexact_search_byexact_search_by_keylower_boundupper_boundequal_range
The exact-search methods return Result<matching_index, insertion_index>. Their search loop exits early on equality while using unpredictable conditional selection for the left/right decision, avoiding the most expensive branch in a conventional binary search.
Why isn't this part of the standard library?
Worry not, work is on the way:
- Make
binary_searchas fast as: https://github.com/rust-lang/rust/pull/45333fast_binary_search - Add
lower_bound,upper_bound,equal_rangeto std: https://github.com/rust-lang/rfcs/issues/2184