Update rayon to dedupe crossbeam-epoch

As a bonus this also removes one version of crossbeam-utils
This commit is contained in:
Bastien Orivel 2019-06-24 23:04:13 +02:00
parent df73c71fb1
commit 28fa0f8009
7 changed files with 39 additions and 63 deletions

View file

@ -116,7 +116,7 @@ fn bottom_up_flow(mut unsafe_flow: UnsafeFlow, assign_bsize_traversal: &AssignBS
fn top_down_flow<'scope>(
unsafe_flows: &[UnsafeFlow],
pool: &'scope rayon::ThreadPool,
scope: &rayon::Scope<'scope>,
scope: &rayon::ScopeFifo<'scope>,
assign_isize_traversal: &'scope AssignISizes,
assign_bsize_traversal: &'scope AssignBSizes,
) {
@ -166,7 +166,7 @@ fn top_down_flow<'scope>(
let first_chunk = chunks.next();
for chunk in chunks {
let nodes = chunk.iter().cloned().collect::<FlowList>();
scope.spawn(move |scope| {
scope.spawn_fifo(move |scope| {
top_down_flow(
&nodes,
pool,
@ -212,7 +212,7 @@ pub fn reflow(
let nodes = [UnsafeFlow(root)];
queue.install(move || {
rayon::scope(move |scope| {
rayon::scope_fifo(move |scope| {
profile(
time::ProfilerCategory::LayoutParallelWarmup,
profiler_metadata,

View file

@ -133,7 +133,12 @@ pub fn traverse_dom<E, D>(
let root_opaque = root.as_node().opaque();
let drain = discovered.drain(..);
pool.install(|| {
rayon::scope(|scope| {
// Enable a breadth-first rayon traversal. This causes the work
// queue to be always FIFO, rather than FIFO for stealers and
// FILO for the owner (which is what rayon does by default). This
// ensures that we process all the elements at a given depth before
// proceeding to the next depth, which is important for style sharing.
rayon::scope_fifo(|scope| {
profiler_label!(Style);
parallel::traverse_nodes(
drain,

View file

@ -104,12 +104,6 @@ lazy_static! {
} else {
let workers = rayon::ThreadPoolBuilder::new()
.num_threads(num_threads)
// Enable a breadth-first rayon traversal. This causes the work
// queue to be always FIFO, rather than FIFO for stealers and
// FILO for the owner (which is what rayon does by default). This
// ensures that we process all the elements at a given depth before
// proceeding to the next depth, which is important for style sharing.
.breadth_first()
.thread_name(thread_name)
.start_handler(thread_startup)
.exit_handler(thread_shutdown)

View file

@ -104,7 +104,7 @@ fn top_down_dom<'a, 'scope, E, D>(
nodes: &'a [SendNode<E::ConcreteNode>],
root: OpaqueNode,
mut traversal_data: PerLevelTraversalData,
scope: &'a rayon::Scope<'scope>,
scope: &'a rayon::ScopeFifo<'scope>,
pool: &'scope rayon::ThreadPool,
traversal: &'scope D,
tls: &'scope ScopedTLS<'scope, ThreadLocalStyleContext<E>>,
@ -248,7 +248,7 @@ pub fn traverse_nodes<'a, 'scope, E, D, I>(
recursion_ok: bool,
root: OpaqueNode,
traversal_data: PerLevelTraversalData,
scope: &'a rayon::Scope<'scope>,
scope: &'a rayon::ScopeFifo<'scope>,
pool: &'scope rayon::ThreadPool,
traversal: &'scope D,
tls: &'scope ScopedTLS<'scope, ThreadLocalStyleContext<E>>,
@ -276,7 +276,7 @@ pub fn traverse_nodes<'a, 'scope, E, D, I>(
if may_dispatch_tail {
top_down_dom(&work, root, traversal_data, scope, pool, traversal, tls);
} else {
scope.spawn(move |scope| {
scope.spawn_fifo(move |scope| {
profiler_label!(Style);
let work = work;
top_down_dom(&work, root, traversal_data, scope, pool, traversal, tls);
@ -286,7 +286,7 @@ pub fn traverse_nodes<'a, 'scope, E, D, I>(
for chunk in nodes.chunks(WORK_UNIT_MAX).into_iter() {
let nodes: WorkUnit<E::ConcreteNode> = chunk.collect();
let traversal_data_copy = traversal_data.clone();
scope.spawn(move |scope| {
scope.spawn_fifo(move |scope| {
profiler_label!(Style);
let n = nodes;
top_down_dom(&*n, root, traversal_data_copy, scope, pool, traversal, tls)