-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Rework DepthFirstSearch API #88711
Rework DepthFirstSearch API #88711
Conversation
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
d60eaec
to
4717cfd
Compare
DepthFirstSearch
where start node may be visited twice
Switched the commit in this PR to also include a later patch set reworking the API further and coincidentally fixing the bug previously noted. Should avoid wasting time on reviewing a soon to be unnecessary patch set, while still achieving the same goals as before. |
r? @jackh726 r=me with/without nit |
This expands the API to be more flexible, allowing for more visitation patterns on graphs. This will be useful to avoid extra datasets (and allocations) in cases where the expanded DFS API is sufficient. This also fixes a bug with the previous DFS constructor, which left the start node not marked as visited (even though it was immediately returned).
4717cfd
to
c9d46eb
Compare
@bors r=jackh726 |
📌 Commit c9d46eb has been approved by |
…h726 Rework DepthFirstSearch API This expands the API to be more flexible, allowing for more visitation patterns on graphs. This will be useful to avoid extra datasets (and allocations) in cases where the expanded DFS API is sufficient. This also fixes a bug with the previous DFS constructor, which left the start node not marked as visited (even though it was immediately returned). Commit written by `@nikomatsakis` originally, cherry picked from several commits in work on never type stabilization, but stands alone.
…h726 Rework DepthFirstSearch API This expands the API to be more flexible, allowing for more visitation patterns on graphs. This will be useful to avoid extra datasets (and allocations) in cases where the expanded DFS API is sufficient. This also fixes a bug with the previous DFS constructor, which left the start node not marked as visited (even though it was immediately returned). Commit written by ``@nikomatsakis`` originally, cherry picked from several commits in work on never type stabilization, but stands alone.
…arth Rollup of 7 pull requests Successful merges: - rust-lang#88336 ( Detect stricter constraints on gats where clauses in impls vs trait) - rust-lang#88677 (rustc: Remove local variable IDs from `Export`s) - rust-lang#88699 (Remove extra unshallow from cherry-pick checker) - rust-lang#88709 (generic_const_exprs: use thir for abstract consts instead of mir) - rust-lang#88711 (Rework DepthFirstSearch API) - rust-lang#88810 (rustdoc: Cleanup `clean` part 1) - rust-lang#88813 (explicitly link to external `ena` docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
The rollup caused an instruction count increase on perf, do you think that's due to this PR? |
It seems pretty unlikely, though not impossible. The only (that I can find) user of DFS today is the reverse scc computation here. As far as I can tell, that code certainly runs a lot, but I wouldn't expect a fundamental difference -- if anything, the new behavior should be a little faster since we're only returning the start node once (and not maybe twice). But it's hard to say. |
This expands the API to be more flexible, allowing for more visitation patterns
on graphs. This will be useful to avoid extra datasets (and allocations) in
cases where the expanded DFS API is sufficient.
This also fixes a bug with the previous DFS constructor, which left the start
node not marked as visited (even though it was immediately returned).
Commit written by @nikomatsakis originally, cherry picked from several commits in work on never type stabilization, but stands alone.