Skip to content

EXPERIMENTAL: Hash spans unconditionally during incr. comp. - #46490

Closed
michaelwoerister wants to merge 3 commits into
rust-lang:masterfrom
michaelwoerister:hash-spans-wip
Closed

EXPERIMENTAL: Hash spans unconditionally during incr. comp.#46490
michaelwoerister wants to merge 3 commits into
rust-lang:masterfrom
michaelwoerister:hash-spans-wip

Conversation

@michaelwoerister

Copy link
Copy Markdown
Member

It would be good for reliability if we could do without all this special-casing around change detection for spans. This PR removes most extra logic around span hashing and is meant to gauge how much of a performance regression this would cause. Much of the potential performance loss should be recoverable by better factoring queries -- but that's a medium term undertaking and should not block incr. comp. stabilization.

cc @nikomatsakis @Mark-Simulacrum

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @pnkfelix

(rust_highfive has picked a reviewer for you, use r? to override)

@michaelwoerister

Copy link
Copy Markdown
Member Author

@bors try

@bors

bors commented Dec 4, 2017

Copy link
Copy Markdown
Collaborator

⌛ Trying commit 6bf65f0 with merge fe077fa...

bors added a commit that referenced this pull request Dec 4, 2017
EXPERIMENTAL: Hash spans unconditionally during incr. comp.

It would be good for reliability if we could do without all this special-casing around change detection for spans. This PR removes most extra logic around span hashing and is meant to gauge how much of a performance regression this would cause. Much of the potential performance loss should be recoverable by better factoring queries -- but that's a medium term undertaking and should not block incr. comp. stabilization.

cc @nikomatsakis @Mark-Simulacrum
@michaelwoerister

Copy link
Copy Markdown
Member Author

cc #46303

@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 4, 2017
@bors

bors commented Dec 4, 2017

Copy link
Copy Markdown
Collaborator

☀️ Test successful - status-travis
State: approved= try=True

@Mark-Simulacrum

Copy link
Copy Markdown
Member

@michaelwoerister

Copy link
Copy Markdown
Member Author

@bors try

@bors

bors commented Dec 4, 2017

Copy link
Copy Markdown
Collaborator

⌛ Trying commit 4c448b8 with merge 47015c2...

bors added a commit that referenced this pull request Dec 4, 2017
EXPERIMENTAL: Hash spans unconditionally during incr. comp.

It would be good for reliability if we could do without all this special-casing around change detection for spans. This PR removes most extra logic around span hashing and is meant to gauge how much of a performance regression this would cause. Much of the potential performance loss should be recoverable by better factoring queries -- but that's a medium term undertaking and should not block incr. comp. stabilization.

cc @nikomatsakis @Mark-Simulacrum
@michaelwoerister

Copy link
Copy Markdown
Member Author

OK, so the results from http://perf.rust-lang.org/compare.html?start=fdfbcf85d55da97ed1a00823510b876018047aaf&end=fe077faa64169fdb9a5710789e6875110734f316&stat=instructions%3Au are pretty much as expected:

  • Almost no change in the debug builds as those were hashing spans all along,
  • little change in the release builds for clean rebuilds and sometimes,
  • quite big performance regressions when there are actual changes made to the code.

I interpret these big regressions as some codegen units being invalidated that weren't invalidated before for the same change set. Factoring spans out of the HIR, MIR, and Attributes should bring the lost performance back, but is not a small undertaking.

I've pushed some more commits that enable caching of many high-impact queries and started another try-build. This additional set of queries can only be cached because of the accurate span hashing. Let's see how performance looks for that.

@bors

bors commented Dec 5, 2017

Copy link
Copy Markdown
Collaborator

💥 Test timed out

@michaelwoerister

Copy link
Copy Markdown
Member Author

@bors try

@michaelwoerister

Copy link
Copy Markdown
Member Author

@bors retry

@bors

bors commented Dec 5, 2017

Copy link
Copy Markdown
Collaborator

⌛ Trying commit 4c448b8 with merge d8715c2...

bors added a commit that referenced this pull request Dec 5, 2017
EXPERIMENTAL: Hash spans unconditionally during incr. comp.

It would be good for reliability if we could do without all this special-casing around change detection for spans. This PR removes most extra logic around span hashing and is meant to gauge how much of a performance regression this would cause. Much of the potential performance loss should be recoverable by better factoring queries -- but that's a medium term undertaking and should not block incr. comp. stabilization.

cc @nikomatsakis @Mark-Simulacrum
@bors

bors commented Dec 5, 2017

Copy link
Copy Markdown
Collaborator

☀️ Test successful - status-travis
State: approved= try=True

@michaelwoerister

Copy link
Copy Markdown
Member Author

This is superseded by #46556. Thanks for the performance measurements, @Mark-Simulacrum!

bors added a commit that referenced this pull request Dec 8, 2017
…akis

incr.comp.: Enable query result caching for many more queries

Newly cached queries are:
* const_is_rvalue_promotable_to_static
* trans_fulfill_obligation
* optimized_mir
* unsafety_check_result
* borrowck
* mir_borrowck
* mir_const_qualif
* contains_extern_indicator
* def_symbol_name
* symbol_name

This also includes the stricter `Span` hashing first mentioned in #46490, which will lead to more false positives in release builds but overall is more correct -- and necessary for caching MIR. Hopefully we will soon be able to reduce the rate of false positives again by factoring `Span` out of MIR.

r? @nikomatsakis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants