Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upOptimize ObligationForest's NodeState handling. #36993
Conversation
rust-highfive
assigned
arielb1
Oct 6, 2016
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
For example, you should be able to get a better perf improvement by skipping over the entire middle "GC" steps if all obligations hit the |
This comment has been minimized.
This comment has been minimized.
I found this comment to be curt and unhelpful. It made me feel angry and bad. It probably wasn't your intent, but that is the effect it had. Please think about how you express yourself when criticizing other people's code. |
This comment has been minimized.
This comment has been minimized.
Can you elaborate more? Are you talking about |
This comment has been minimized.
This comment has been minimized.
I'm sorry. I just think that the best way to deal with an O(n^2) case is to well, make it stop being O(n^2), rather than adding low-level optimizations to the specific O(n^2) part. The main entry point of the obligation forest is If nothing changes in the |
This comment has been minimized.
This comment has been minimized.
To be clear: this is a reasonable opinion. The problem was not that you criticized my code, the problem was the way you criticized it. I suggest you avoid using the phrase "Totally The Wrong Way" in future reviews. Also, when suggesting alternative approaches, please describe them in reasonable detail. (Your follow-up comment about GCing was much better in this regard.) |
This comment has been minimized.
This comment has been minimized.
|
Mod note: As Nick said, please be constructive and nice in your criticism. It seems like you've already acknowledged that, but just in case, leaving this comment |
This comment has been minimized.
This comment has been minimized.
zatherz
commented
Oct 16, 2016
•
|
Why have my constructive and nice comments been removed? I'm very well acquainted with Rust's code of conduct and I think @nnethercote's reply could very well be considered harassment. He tried to make @arielb1 feel bad for his reply. We shouldn't reply to harassment with harassment. I am so angry that I'm considering writing a Medium blog post about it and posting it to HackerNews. |
This comment has been minimized.
This comment has been minimized.
|
Mod note: @zatherz Your comment was deleted for containing profanity and blatantly violating the code of conduct. If you have further questions about moderation or the code of conduct, please ask rust-mods@rust-lang.org or on one of the forums. This is not the place for such discussion [further offtopic comments will be deleted] |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Moderator note: As @Manishearth said, if you have a specific question or objection with our moderation, then please ask rust-mods@rust-lang.org. This isn't the place for it. |
nikomatsakis
self-assigned this
Oct 21, 2016
This comment has been minimized.
This comment has been minimized.
|
Adding myself as another assigneee. Sorry I haven't taken a look yet. My initial reaction was somewhat similar to @arielb1 (i.e., I'd rather solve this from the top), but on the other hand the speed improvements that @nnethercote showed are promising! I'd like to give this a closer read. Will try to do ASAP! Apologies for the delay @nnethercote! |
This comment has been minimized.
This comment has been minimized.
Oh, please wait a bit! #37231 landed recently and that changed the profiles significantly, so I've started reworking this PR but it's not ready yet. |
This comment has been minimized.
This comment has been minimized.
|
@nnethercote ok ping me |
nnethercote
force-pushed the
nnethercote:obligation
branch
from
7c64806
to
40f5122
Oct 24, 2016
This comment has been minimized.
This comment has been minimized.
|
I've updated. The commit no longer converts It feels like there is still plenty of room for improvement in this benchmark, though I'm struggling to find those improvements myself. Here's Cachegrind's summary of the hottest functions (measurements are instruction counts).
You have to squint a bit when interpreting them due to inlining but they give you a good idea. In particular, this call chain is very hot:
Any changes that can speed up any of those functions or reduce the number of calls in this chain are likely to help. |
rust-highfive
unassigned
arielb1
Oct 24, 2016
nikomatsakis
requested changes
Oct 31, 2016
|
r=me with the helper extracted (maybe tagged |
|
|
||
| for dependent in &node.dependents { | ||
| self.mark_as_waiting_from(&self.nodes[dependent.get()]); | ||
| } |
This comment has been minimized.
This comment has been minimized.
nikomatsakis
Oct 31, 2016
Contributor
rather than making two copies of this code, maybe pull out a helper like mark_neighbors_as_waiting_from(node)?
This comment has been minimized.
This comment has been minimized.
nnethercote
force-pushed the
nnethercote:obligation
branch
from
40f5122
to
1011042
Nov 2, 2016
nnethercote
force-pushed the
nnethercote:obligation
branch
from
1011042
to
7b33f7e
Nov 2, 2016
This comment has been minimized.
This comment has been minimized.
|
Comments addressed. |
This comment has been minimized.
This comment has been minimized.
|
@bors r=nikomatsakis |
nikomatsakis
approved these changes
Nov 2, 2016
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
This comment has been minimized.
This comment has been minimized.
|
|
nnethercote commentedOct 6, 2016
This commit does the following.
NodeStatefrom an enum to abitflags. This makes itpossible to check against multiple possible values in a single bitwise
operation.
matches involvingNodeStatewithif/elsechains that ensure that cases are handled in the order of frequency.
find_cycles_from_nodeandmark_as_waiting_from, at two call sites in order to avoid functionunnecessary function calls on hot paths.
is_popped.These changes speeds up rustc-benchmarks/inflate-0.1.0 by about 7% when
doing debug builds with a stage1 compiler.
r? @arielb1