Skip to content

30% regression in compile time of tuple-stress benchmark #43828

Closed
@alexcrichton

Description

@alexcrichton
Member

According to perf.rust-lang.org graphs the tuple-stress benchmark has regressed 30% in compile time lately, pointing to #43554 as the culprit.

I've downloaded the nightly-2017-08-05 toolchain and the nightly-2017-08-06 toolchain where 08-06 has this PR and 08-05 doesn't. The notable differences in time-passes are:

pass after before
borrow checking 2.556 0.920
const checking 1.728 0.451
translation 0.798 0.682
expansion 0.168 0.097

cc @eddyb

Activity

added
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Aug 12, 2017
jonas-schievink

jonas-schievink commented on Aug 12, 2017

@jonas-schievink
Contributor

The "after" column is faster than "before", did you swap them by accident?

hanna-kruppe

hanna-kruppe commented on Aug 12, 2017

@hanna-kruppe
Contributor

It's probably because the test case is almost entirely composed of float literals, and as of #43554 those literals are parsed twice (once with core::num::dec2flt, once with APFloat) as a sanity check.

alexcrichton

alexcrichton commented on Aug 12, 2017

@alexcrichton
MemberAuthor
eddyb

eddyb commented on Aug 13, 2017

@eddyb
Member

Only constant checking and MIR building should do the parsing though. Expansion, for example, couldn't possibly be affected - I suspect there's more than one factor hiding in here.

eddyb

eddyb commented on Aug 13, 2017

@eddyb
Member

Another thing is that "const checking" is quadratic in the number of expression nodes (which are considered to be constant) that are part of the same subtree, as const-evaluation isn't cached (yet).
I could try doing that (and/or cache the results of parsing float literals).

added
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
on Aug 13, 2017
added
I-compiletimeIssue: Problems and improvements with respect to compile times.
on Aug 13, 2017
nikomatsakis

nikomatsakis commented on Aug 17, 2017

@nikomatsakis
Contributor

triage: P-high

Assigning to @eddyb to decide if there is something to be concerned about here or not. =)

eddyb

eddyb commented on Aug 18, 2017

@eddyb
Member

On the graph "expansion" has a small random jump from 0.25 to 0.28 but then it goes back down to 0.25, so that's probably a false positive elsewhere too.

The culprits (adding up to most of the total change):

  • "const checking": 0.85 -> 3.48
  • "borrow checking" (actually MIR building): 1.75 -> 4.51

Sadly, my idea for caching const-evaluation wouldn't do much for MIR building, have to look further.

modified the milestone: 1.21 on Aug 23, 2017
added a commit that references this issue on Aug 24, 2017

Auto merge of #44051 - eddyb:apfloat-faster-div, r=nagisa

c0771f2
eddyb

eddyb commented on Aug 25, 2017

@eddyb
Member

The graph looks pretty good - still about half a second more, but the regression is much less worse.
@alexcrichton Are you satisfied with this outcome? Or do you want to reopen the issue?

alexcrichton

alexcrichton commented on Aug 25, 2017

@alexcrichton
MemberAuthor

Oh no I was personally satisfied with any outcome, I just figured it'd be good to track regressions as they came up!

Thanks for the fix @eddyb!

shepmaster

shepmaster commented on Aug 25, 2017

@shepmaster
Member

IMO, if reopening the issue makes @eddyb perform another "5x speed increase" then we should trick them into doing such 😇

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

Metadata

Metadata

Assignees

Labels

C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCI-compiletimeIssue: Problems and improvements with respect to compile times.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @alexcrichton@eddyb@nikomatsakis@shepmaster@jonas-schievink

      Issue actions

        30% regression in compile time of tuple-stress benchmark · Issue #43828 · rust-lang/rust