Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very bad performance with duplicate value #9

Open
Stargateur opened this issue Dec 3, 2018 · 0 comments
Open

Very bad performance with duplicate value #9

Stargateur opened this issue Dec 3, 2018 · 0 comments

Comments

@Stargateur
Copy link

I did some benchmark and find out the the sort have terrible performance with duplicate value

#[bench]
fn lazysort(b: &mut Bencher) {
    b.iter(|| {
        use lazysort::Sorted;
        let mut rng = thread_rng();
        let v: Vec<i32> = std::iter::repeat_with(|| rng.gen_range(0, 2))
            .take(10000)
            .collect();
        let _: Vec<_> = v.iter().sorted().take(1).collect();
    })
}

You should implement the quick sort using the 3-ways method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant