D8250: rust-status: wrap `stat_dmap_entries` to ease profiling

2020-03-11 Thread Raphaël Gomès
Closed by commit rHGb8ba46c97cdd: rust-status: wrap `stat_dmap_entries` to ease 
profiling (authored by Alphare).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8250?vs=20564=20731

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8250/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8250

AFFECTED FILES
  rust/hg-core/src/dirstate/status.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate/status.rs 
b/rust/hg-core/src/dirstate/status.rs
--- a/rust/hg-core/src/dirstate/status.rs
+++ b/rust/hg-core/src/dirstate/status.rs
@@ -508,6 +508,21 @@
 })
 }
 
+/// This takes a mutable reference to the results to account for the `extend`
+/// in timings
+fn extend_from_dmap<'a>(
+dmap: &'a DirstateMap,
+root_dir: impl AsRef + Sync + Send,
+options: StatusOptions,
+results:  Vec<(Cow<'a, HgPath>, Dispatch)>,
+) {
+results.par_extend(
+stat_dmap_entries(dmap, root_dir, options)
+.flatten()
+.map(|(filename, dispatch)| (Cow::Borrowed(filename), dispatch)),
+);
+}
+
 pub struct DirstateStatus<'a> {
 pub modified: Vec>,
 pub added: Vec>,
@@ -766,10 +781,7 @@
 } else {
 // We may not have walked the full directory tree above, so stat
 // and check everything we missed.
-let stat_results = stat_dmap_entries(, root_dir, options);
-results.par_extend(stat_results.flatten().map(
-|(filename, dispatch)| (Cow::Borrowed(filename), dispatch),
-));
+extend_from_dmap(, root_dir, options,  results);
 }
 }
 



To: Alphare, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D8250: rust-status: wrap `stat_dmap_entries` to ease profiling

2020-03-06 Thread Raphaël Gomès
Alphare created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8250

AFFECTED FILES
  rust/hg-core/src/dirstate/status.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate/status.rs 
b/rust/hg-core/src/dirstate/status.rs
--- a/rust/hg-core/src/dirstate/status.rs
+++ b/rust/hg-core/src/dirstate/status.rs
@@ -508,6 +508,21 @@
 })
 }
 
+/// This takes a mutable reference to the results to account for the `extend`
+/// in timings
+fn extend_from_dmap<'a>(
+dmap: &'a DirstateMap,
+root_dir: impl AsRef + Sync + Send,
+options: StatusOptions,
+results:  Vec<(Cow<'a, HgPath>, Dispatch)>,
+) {
+results.par_extend(
+stat_dmap_entries(dmap, root_dir, options)
+.flatten()
+.map(|(filename, dispatch)| (Cow::Borrowed(filename), dispatch)),
+);
+}
+
 pub struct DirstateStatus<'a> {
 pub modified: Vec>,
 pub added: Vec>,
@@ -766,10 +781,7 @@
 } else {
 // We may not have walked the full directory tree above, so stat
 // and check everything we missed.
-let stat_results = stat_dmap_entries(, root_dir, options);
-results.par_extend(stat_results.flatten().map(
-|(filename, dispatch)| (Cow::Borrowed(filename), dispatch),
-));
+extend_from_dmap(, root_dir, options,  results);
 }
 }
 



To: Alphare, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel