Skip to content

Towards faster binary search  #74547

Closed
Closed
@LifeIsStrange

Description

@LifeIsStrange

rust/src/libcore/slice/mod.rs

Lines 1565 to 1570 in 05630b0

pub fn binary_search(&self, x: &T) -> Result<usize, usize>
where
T: Ord,
{
self.binary_search_by(|p| p.cmp(x))
}

Could be improved in the same way as rust has switched it's old hashmap to the state of the art hashbrown.

It seems that there is a new state of the art Binary search in town leading up to 25% performance improvement and binary search is a foundational task.
Therefore it would be promising to investigate whether Rust could have a faster binary search implementation, the candidate being
https://news.ycombinator.com/item?id=23893366
(but maybe there are other new state of the art)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions