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

Rebase on rayon-1.2.0 and rayon-core-1.6.0 #3

Merged
merged 0 commits into from Oct 7, 2019

Conversation

@cuviper
Copy link
Member

commented Jun 26, 2019

This can't be directly merged, since I rebased, but I hope it's useful anyway.

r? @Zoxc

@cuviper

This comment has been minimized.

Copy link
Member Author

commented Jun 26, 2019

I think you could drop your main handler and scoped pools in favor of build_scoped, but for now I just carried that patch as-is.

https://docs.rs/rayon/1.1.0/rayon/struct.ThreadPoolBuilder.html#method.build_scoped

Cargo.toml Outdated Show resolved Hide resolved
@cuviper cuviper force-pushed the cuviper:rustc branch from 787d86c to 5531e31 Sep 10, 2019
@cuviper cuviper changed the title Rebase on rayon-1.1.0 and rayon-core-1.5.0 Rebase on rayon-1.2.0 and rayon-core-1.6.0 Sep 10, 2019
@cuviper cuviper force-pushed the cuviper:rustc branch from 5531e31 to 7ffde12 Sep 10, 2019
cuviper added a commit to cuviper/rust that referenced this pull request Sep 10, 2019
@cuviper

This comment has been minimized.

Copy link
Member Author

commented Sep 10, 2019

I've now rebased this on rayon 1.2.

I also dropped the main_handler and scoped_pool patches in favor of build_scoped. See the draft PR rust-lang/rust#64358 -- the code doesn't actually change much for that.

cuviper added a commit to cuviper/rust that referenced this pull request Sep 10, 2019
@cuviper

This comment has been minimized.

Copy link
Member Author

commented Sep 10, 2019

The comparison to rayon-rs master may be more useful:
rayon-rs/rayon@master...cuviper:rustc

@cuviper

This comment has been minimized.

Copy link
Member Author

commented Sep 27, 2019

@Zoxc, can you review this? It would be nice to land in rustc, if only for the dependency updates.

@nikomatsakis nikomatsakis merged commit 7ffde12 into rust-lang:rustc Oct 7, 2019
nikomatsakis pushed a commit that referenced this pull request Oct 7, 2019
These adaptors consume may many elements before deferring to a base
folder's fullness checks, and so they need to be performed
manually. For the `filter`s, there's no way to do it manually (rayon-rs#632),
so the specialisations just have to be removed. For `fold` and
`find_any` this can be done with a `take_while`.

This extends the octillion tests to confirm this behaviour.

This makes a program like the following slightly slower compared to
the direct `consume_iter` without a check, but it's still faster than
the non-specialized form.

```
extern crate test;
extern crate rayon;
use rayon::prelude::*;

fn main() {
    let count = (0..std::u32::MAX)
        .into_par_iter()
        .map(test::black_box)
        .find_any(|_| test::black_box(false));
    println!("{:?}", count);
}
```

```
$ hyperfine ./find-original ./find-no-check ./find-check
Benchmark #1: ./find-original
  Time (mean ± σ):     627.6 ms ±  25.7 ms    [User: 7.130 s, System: 0.014 s]
  Range (min … max):   588.4 ms … 656.4 ms    10 runs

Benchmark #2: ./find-no-check
  Time (mean ± σ):     481.5 ms ±  10.8 ms    [User: 5.415 s, System: 0.013 s]
  Range (min … max):   468.9 ms … 498.2 ms    10 runs

Benchmark #3: ./find-check
  Time (mean ± σ):     562.3 ms ±  11.8 ms    [User: 6.363 s, System: 0.013 s]
  Range (min … max):   542.5 ms … 578.2 ms    10 runs
```

(find-original = without specialization, find-no-check = custom
`consume_iter` without `take_while`, find-check = this commit)
@nikomatsakis nikomatsakis force-pushed the rust-lang:rustc branch from 4b574ba to 7ffde12 Oct 7, 2019
cuviper added a commit to cuviper/rust that referenced this pull request Oct 7, 2019
bors added a commit to rust-lang/rust that referenced this pull request Oct 7, 2019
Rebase rustc-rayon on rayon-1.2

See also rust-lang/rustc-rayon#3
XiangQingW added a commit to XiangQingW/rust that referenced this pull request Oct 13, 2019
choller added a commit to choller/rust that referenced this pull request Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.