Skip to content
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

Optimize runtime of `#[cargo_test_macro]` #7146

Merged
merged 1 commit into from Jul 19, 2019

Conversation

@alexcrichton
Copy link
Member

commented Jul 18, 2019

I've noticed recently that the incremental compile time for our test
suite has felt like it's increased quite a bit. I think one reason is
that everything has to go through #[cargo_test_macro] unconditionally
on all incremental builds, and wow do we have a lot of tests being
pumped through that macro.

Instrumenting the macro a little bit shows that we spend nearly 2.5
seconds on each compilation simply executing this macro (note that it's
in debug mode as well, not release since we typically don't execute
tests in release mode.

This commit instead drops the usage of syn and quote in favor of a
"raw procedural macro" which is much more optimized for just our use
case, even in debug mode. This drops the collective time spent in the
macro to 0.2 seconds, even in debug mode!

@rust-highfive

This comment has been minimized.

Copy link

commented Jul 18, 2019

r? @Eh2406

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

@Eh2406

This comment has been minimized.

Copy link
Contributor

commented Jul 18, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 18, 2019

📌 Commit 31ada89 has been approved by Eh2406

@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 18, 2019

⌛️ Testing commit 31ada89 with merge d0cec63...

bors added a commit that referenced this pull request Jul 18, 2019

Auto merge of #7146 - alexcrichton:faster-proc-macro, r=Eh2406
Optimize runtime of `#[cargo_test_macro]`

I've noticed recently that the incremental compile time for our test
suite has felt like it's increased quite a bit. I think one reason is
that everything has to go through `#[cargo_test_macro]` unconditionally
on all incremental builds, and wow do we have a lot of tests being
pumped through that macro.

Instrumenting the macro a little bit shows that we spend nearly 2.5
seconds on each compilation simply executing this macro (note that it's
in debug mode as well, not release since we typically don't execute
tests in release mode.

This commit instead drops the usage of `syn` and `quote` in favor of a
"raw procedural macro" which is much more optimized for just our use
case, even in debug mode. This drops the collective time spent in the
macro to 0.2 seconds, even in debug mode!
@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 18, 2019

💔 Test failed - checks-travis

@Eh2406

This comment has been minimized.

Copy link
Contributor

commented Jul 18, 2019

fmt needed :-(

@alexcrichton alexcrichton force-pushed the alexcrichton:faster-proc-macro branch from 31ada89 to b5b92e0 Jul 18, 2019

@alexcrichton

This comment has been minimized.

Copy link
Member Author

commented Jul 18, 2019

@bors: r=Eh2406

@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 18, 2019

📌 Commit b5b92e0 has been approved by Eh2406

@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 18, 2019

⌛️ Testing commit b5b92e0 with merge bcaba3b...

bors added a commit that referenced this pull request Jul 18, 2019

Auto merge of #7146 - alexcrichton:faster-proc-macro, r=Eh2406
Optimize runtime of `#[cargo_test_macro]`

I've noticed recently that the incremental compile time for our test
suite has felt like it's increased quite a bit. I think one reason is
that everything has to go through `#[cargo_test_macro]` unconditionally
on all incremental builds, and wow do we have a lot of tests being
pumped through that macro.

Instrumenting the macro a little bit shows that we spend nearly 2.5
seconds on each compilation simply executing this macro (note that it's
in debug mode as well, not release since we typically don't execute
tests in release mode.

This commit instead drops the usage of `syn` and `quote` in favor of a
"raw procedural macro" which is much more optimized for just our use
case, even in debug mode. This drops the collective time spent in the
macro to 0.2 seconds, even in debug mode!

@alexcrichton alexcrichton force-pushed the alexcrichton:faster-proc-macro branch 2 times, most recently from 0c1face to 4deaad1 Jul 18, 2019

Show resolved Hide resolved tests/testsuite/config.rs Outdated
@alexcrichton

This comment has been minimized.

Copy link
Member Author

commented Jul 19, 2019

@bors: r-

Optimize runtime of `#[cargo_test_macro]`
I've noticed recently that the incremental compile time for our test
suite has felt like it's increased quite a bit. I think one reason is
that everything has to go through `#[cargo_test_macro]` unconditionally
on all incremental builds, and wow do we have a lot of tests being
pumped through that macro.

Instrumenting the macro a little bit shows that we spend nearly 2.5
seconds on each compilation simply executing this macro (note that it's
in debug mode as well, not release since we typically don't execute
tests in release mode.

This commit instead drops the usage of `syn` and `quote` in favor of a
"raw procedural macro" which is much more optimized for just our use
case, even in debug mode. This drops the collective time spent in the
macro to 0.2 seconds, even in debug mode!

@alexcrichton alexcrichton force-pushed the alexcrichton:faster-proc-macro branch from 4deaad1 to 8887b67 Jul 19, 2019

@alexcrichton

This comment has been minimized.

Copy link
Member Author

commented Jul 19, 2019

@bors: r=Eh2406

@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 19, 2019

📌 Commit 8887b67 has been approved by Eh2406

@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 19, 2019

⌛️ Testing commit 8887b67 with merge 56fca89...

bors added a commit that referenced this pull request Jul 19, 2019

Auto merge of #7146 - alexcrichton:faster-proc-macro, r=Eh2406
Optimize runtime of `#[cargo_test_macro]`

I've noticed recently that the incremental compile time for our test
suite has felt like it's increased quite a bit. I think one reason is
that everything has to go through `#[cargo_test_macro]` unconditionally
on all incremental builds, and wow do we have a lot of tests being
pumped through that macro.

Instrumenting the macro a little bit shows that we spend nearly 2.5
seconds on each compilation simply executing this macro (note that it's
in debug mode as well, not release since we typically don't execute
tests in release mode.

This commit instead drops the usage of `syn` and `quote` in favor of a
"raw procedural macro" which is much more optimized for just our use
case, even in debug mode. This drops the collective time spent in the
macro to 0.2 seconds, even in debug mode!
@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 19, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: Eh2406
Pushing 56fca89 to master...

@bors bors merged commit 8887b67 into rust-lang:master Jul 19, 2019

3 checks passed

Travis CI - Pull Request Build Passed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
homu Test successful
Details

@alexcrichton alexcrichton deleted the alexcrichton:faster-proc-macro branch Jul 19, 2019

@ehuss ehuss referenced this pull request Jul 23, 2019

Merged

Update cargo #62914

bors added a commit to rust-lang/rust that referenced this pull request Jul 25, 2019

Auto merge of #62914 - ehuss:update-cargo, r=alexcrichton
Update cargo

11 commits in e3563dbdcd2e370bc4f11d080f739d82d25773fd..d0f828419d6ce6be21a90866964f58eb2c07cd56
2019-07-16 19:22:44 +0000 to 2019-07-23 21:58:59 +0000
- Remove include/exclude glob warning. (rust-lang/cargo#7170)
- Optimize lock file format for git merge conflicts (rust-lang/cargo#7070)
- Set up CI with Azure Pipelines (rust-lang/cargo#7139)
- Force clippy to run. (rust-lang/cargo#7157)
- Work around #61440 (rust-lang/cargo#7158)
- initial working version of cargo fix --clippy (rust-lang/cargo#7069)
- Optimize runtime of `#[cargo_test_macro]` (rust-lang/cargo#7146)
- Don't fail if we can't acquire readonly lock (rust-lang/cargo#7149)
- Add support for multiple --features options (rust-lang/cargo#7084)
- Fix a typo in an env var name (rust-lang/cargo#7145)
- Add a way to disable all nightly tests (rust-lang/cargo#7142)

bors added a commit to rust-lang/rust that referenced this pull request Jul 26, 2019

Auto merge of #62914 - ehuss:update-cargo, r=alexcrichton
Update cargo

11 commits in e3563dbdcd2e370bc4f11d080f739d82d25773fd..d0f828419d6ce6be21a90866964f58eb2c07cd56
2019-07-16 19:22:44 +0000 to 2019-07-23 21:58:59 +0000
- Remove include/exclude glob warning. (rust-lang/cargo#7170)
- Optimize lock file format for git merge conflicts (rust-lang/cargo#7070)
- Set up CI with Azure Pipelines (rust-lang/cargo#7139)
- Force clippy to run. (rust-lang/cargo#7157)
- Work around #61440 (rust-lang/cargo#7158)
- initial working version of cargo fix --clippy (rust-lang/cargo#7069)
- Optimize runtime of `#[cargo_test_macro]` (rust-lang/cargo#7146)
- Don't fail if we can't acquire readonly lock (rust-lang/cargo#7149)
- Add support for multiple --features options (rust-lang/cargo#7084)
- Fix a typo in an env var name (rust-lang/cargo#7145)
- Add a way to disable all nightly tests (rust-lang/cargo#7142)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.