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

Don't instantiate so many copies of drop_in_place #67332

Merged
merged 2 commits into from
Feb 27, 2020

Conversation

matthewjasper
Copy link
Contributor

Split out from #66703.

r? @ghost

@matthewjasper matthewjasper changed the title [PERF] Don't instantiate so many copied of real_drop_in_place [PERF] Don't instantiate so many copies of real_drop_in_place Dec 15, 2019
@matthewjasper matthewjasper changed the title [PERF] Don't instantiate so many copies of real_drop_in_place [PERF] Don't instantiate so many copies of real_drop_in_place Dec 15, 2019
@matthewjasper
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Dec 15, 2019

⌛ Trying commit 60f7930 with merge 9890db7...

bors added a commit that referenced this pull request Dec 15, 2019
[PERF] Don't instantiate so many copies of real_drop_in_place

Split out from #66703.

r? @ghost
@bors
Copy link
Contributor

bors commented Dec 16, 2019

☀️ Try build successful - checks-azure
Build commit: 9890db7 (9890db7e0f814f43c84898c7c756fd14d63aeff6)

@rust-timer
Copy link
Collaborator

Queued 9890db7 with parent a605441, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 9890db7, comparison URL.

src/librustc/ty/instance.rs Outdated Show resolved Hide resolved
@matthewjasper
Copy link
Contributor Author

I've removed the normalize change - it appears to be a perf regression
@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Dec 16, 2019

⌛ Trying commit e95280d with merge 293615e...

bors added a commit that referenced this pull request Dec 16, 2019
[PERF] Don't instantiate so many copies of real_drop_in_place

Split out from #66703.

r? @ghost
@bors
Copy link
Contributor

bors commented Dec 16, 2019

☀️ Try build successful - checks-azure
Build commit: 293615e (293615e39bf757241e69cf382fb5ace10d043c6f)

@rust-timer
Copy link
Collaborator

Queued 293615e with parent f0d4b57, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 293615e, comparison URL.

@rust-highfive

This comment has been minimized.

@matthewjasper
Copy link
Contributor Author

...and I've brought it back when Reveal::All is set...
@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Dec 21, 2019

⌛ Trying commit b231749 with merge 877fa2e...

bors added a commit that referenced this pull request Dec 21, 2019
[PERF] Don't instantiate so many copies of real_drop_in_place

Split out from #66703.

r? @ghost
@bors
Copy link
Contributor

bors commented Dec 21, 2019

☀️ Try build successful - checks-azure
Build commit: 877fa2e (877fa2ef606af569c8f8d64f5722130f884790a3)

@rust-timer
Copy link
Collaborator

Queued 877fa2e with parent c64eecf, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 877fa2e, comparison URL.

@matthewjasper
Copy link
Contributor Author

I guess the first version of this was fine...

This is fairly hacky, but it gives some significant wins, albeit in a case (release incremental) that maybe isn't considered as important as others. (#67332 (comment))

cc @rust-lang/wg-compiler-performance - does anyone want to review this.

@michaelwoerister
Copy link
Member

Oh that's right. I forgot about that. Good catch!

@matthewjasper
Copy link
Contributor Author

I tried putting drop glue into the type's module and found it to have worse (compiler) performance in the tests that I did.
@bors r=michaelwoerister

@bors
Copy link
Contributor

bors commented Feb 24, 2020

📌 Commit d49ec090453d901ed94c60d5fb02cd5fe6c3254d has been approved by michaelwoerister

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 24, 2020
@matthewjasper
Copy link
Contributor Author

@bors rollup=never

@michaelwoerister
Copy link
Member

OK, sounds good then 👍

@Dylan-DPC-zz
Copy link

@bors p=1

@bors
Copy link
Contributor

bors commented Feb 26, 2020

⌛ Testing commit d49ec090453d901ed94c60d5fb02cd5fe6c3254d with merge 036d8885f031750c7d4f4e60da8635a0456acb28...

@rust-highfive
Copy link
Collaborator

The job i686-gnu-nopt of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-02-26T06:38:28.2830352Z ---- [codegen-units] codegen-units/partitioning/extern-drop-glue.rs stdout ----
2020-02-26T06:38:28.2830677Z 
2020-02-26T06:38:28.2830921Z The following items were assigned to wrong codegen units:
2020-02-26T06:38:28.2831135Z 
2020-02-26T06:38:28.2831437Z fn core::ptr[0]::drop_in_place[0]<cgu_extern_drop_glue::Struct[0]>
2020-02-26T06:38:28.2832065Z   expected: extern_drop_glue-fallback.cgu[Internal] 
2020-02-26T06:38:28.2832602Z   actual:   extern_drop_glue-fallback.cgu[External] 
2020-02-26T06:38:28.2833847Z thread '[codegen-units] codegen-units/partitioning/extern-drop-glue.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:2463:13
2020-02-26T06:38:28.2834382Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2020-02-26T06:38:28.2834607Z 
2020-02-26T06:38:28.2835097Z ---- [codegen-units] codegen-units/partitioning/local-drop-glue.rs stdout ----
2020-02-26T06:38:28.2835097Z ---- [codegen-units] codegen-units/partitioning/local-drop-glue.rs stdout ----
2020-02-26T06:38:28.2835323Z 
2020-02-26T06:38:28.2835533Z The following items were assigned to wrong codegen units:
2020-02-26T06:38:28.2835740Z 
2020-02-26T06:38:28.2835977Z fn core::ptr[0]::drop_in_place[0]<local_drop_glue::Struct[0]>
2020-02-26T06:38:28.2836636Z   expected: local_drop_glue-fallback.cgu[Internal] 
2020-02-26T06:38:28.2837156Z   actual:   local_drop_glue-fallback.cgu[External] 
2020-02-26T06:38:28.2837968Z thread '[codegen-units] codegen-units/partitioning/local-drop-glue.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:2463:13
2020-02-26T06:38:28.2838328Z 
2020-02-26T06:38:28.2838421Z 
2020-02-26T06:38:28.2838559Z failures:
---
2020-02-26T06:38:28.2840475Z 
2020-02-26T06:38:28.2840934Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:348:22
2020-02-26T06:38:28.2849272Z 
2020-02-26T06:38:28.2849548Z 
2020-02-26T06:38:28.2858410Z command did not execute successfully: "/checkout/obj/build/i686-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/i686-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/i686-unknown-linux-gnu/stage2/lib/rustlib/i686-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/i686-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/codegen-units" "--build-base" "/checkout/obj/build/i686-unknown-linux-gnu/test/codegen-units" "--stage-id" "stage2-i686-unknown-linux-gnu" "--mode" "codegen-units" "--target" "i686-unknown-linux-gnu" "--host" "i686-unknown-linux-gnu" "--llvm-filecheck" "/checkout/obj/build/i686-unknown-linux-gnu/llvm/build/bin/FileCheck" "--host-rustcflags" "-Crpath -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/i686-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/i686-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--llvm-version" "9.0.1-rust-1.43.0-nightly\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2020-02-26T06:38:28.2864300Z 
2020-02-26T06:38:28.2864620Z 
2020-02-26T06:38:28.2864968Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2020-02-26T06:38:28.2865319Z Build completed unsuccessfully in 1:36:13
2020-02-26T06:38:28.2865319Z Build completed unsuccessfully in 1:36:13
2020-02-26T06:38:28.2915193Z == clock drift check ==
2020-02-26T06:38:28.2930088Z   local time: Wed Feb 26 06:38:28 UTC 2020
2020-02-26T06:38:28.5789410Z   network time: Wed, 26 Feb 2020 06:38:28 GMT
2020-02-26T06:38:28.5789840Z == end clock drift check ==
2020-02-26T06:38:30.8039080Z 
2020-02-26T06:38:30.8145238Z ##[error]Bash exited with code '1'.
2020-02-26T06:38:30.8228082Z ##[section]Starting: Checkout rust-lang/rust@auto to s
2020-02-26T06:38:30.8234089Z ==============================================================================
2020-02-26T06:38:30.8234513Z Task         : Get sources
2020-02-26T06:38:30.8234965Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Feb 26, 2020

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 26, 2020
@matthewjasper
Copy link
Contributor Author

@bors r=michaelwoerister

@bors
Copy link
Contributor

bors commented Feb 26, 2020

📌 Commit b944531 has been approved by michaelwoerister

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 26, 2020
@bors
Copy link
Contributor

bors commented Feb 27, 2020

⌛ Testing commit b944531 with merge d28560e...

@bors
Copy link
Contributor

bors commented Feb 27, 2020

☀️ Test successful - checks-azure
Approved by: michaelwoerister
Pushing d28560e to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 27, 2020
@bors bors merged commit d28560e into rust-lang:master Feb 27, 2020
@matthewjasper matthewjasper deleted the drop-in-place-cgus branch February 27, 2020 08:44
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request May 16, 2020
Pkgsrc changes:
 * Bump rust bootstrap version to 1.42.0, except for Darwin/i686 where the
   bootstrap is not (yet?) available.

Upstream changes:

Version 1.43.0 (2020-04-23)
==========================

Language
--------
- [Fixed using binary operations with `&{number}` (e.g. `&1.0`) not having
  the type inferred correctly.][68129]
- [Attributes such as `#[cfg()]` can now be used on `if` expressions.][69201]

**Syntax only changes**
- [Allow `type Foo: Ord` syntactically.][69361]
- [Fuse associated and extern items up to defaultness.][69194]
- [Syntactically allow `self` in all `fn` contexts.][68764]
- [Merge `fn` syntax + cleanup item parsing.][68728]
- [`item` macro fragments can be interpolated into `trait`s, `impl`s,
  and `extern` blocks.][69366]
  For example, you may now write:
  ```rust
  macro_rules! mac_trait {
      ($i:item) => {
          trait T { $i }
      }
  }
  mac_trait! {
      fn foo() {}
  }
  ```
These are still rejected *semantically*, so you will likely receive an error but
these changes can be seen and parsed by macros and
conditional compilation.


Compiler
--------
- [You can now pass multiple lint flags to rustc to override the previous
  flags.][67885] For example; `rustc -D unused -A unused-variables` denies
  everything in the `unused` lint group except `unused-variables` which
  is explicitly allowed. However, passing `rustc -A unused-variables -D unused` denies
  everything in the `unused` lint group **including** `unused-variables` since
  the allow flag is specified before the deny flag (and therefore overridden).
- [rustc will now prefer your system MinGW libraries over its bundled libraries
  if they are available on `windows-gnu`.][67429]
- [rustc now buffers errors/warnings printed in JSON.][69227]

Libraries
---------
- [`Arc<[T; N]>`, `Box<[T; N]>`, and `Rc<[T; N]>`, now implement
  `TryFrom<Arc<[T]>>`,`TryFrom<Box<[T]>>`, and `TryFrom<Rc<[T]>>`
  respectively.][69538] **Note** These conversions are only available when `N`
  is `0..=32`.
- [You can now use associated constants on floats and integers directly, rather
  than having to import the module.][68952] e.g. You can now write `u32::MAX` or
  `f32::NAN` with no imports.
- [`u8::is_ascii` is now `const`.][68984]
- [`String` now implements `AsMut<str>`.][68742]
- [Added the `primitive` module to `std` and `core`.][67637] This module
  reexports Rust's primitive types. This is mainly useful in macros
  where you want avoid these types being shadowed.
- [Relaxed some of the trait bounds on `HashMap` and `HashSet`.][67642]
- [`string::FromUtf8Error` now implements `Clone + Eq`.][68738]

Stabilized APIs
---------------
- [`Once::is_completed`]
- [`f32::LOG10_2`]
- [`f32::LOG2_10`]
- [`f64::LOG10_2`]
- [`f64::LOG2_10`]
- [`iter::once_with`]

Cargo
-----
- [You can now set config `[profile]`s in your `.cargo/config`, or through
  your environment.][cargo/7823]
- [Cargo will now set `CARGO_BIN_EXE_<name>` pointing to a binary's
  executable path when running integration tests or benchmarks.][cargo/7697]
  `<name>` is the name of your binary as-is e.g. If you wanted the executable
  path for a binary named `my-program`you would use
  `env!("CARGO_BIN_EXE_my-program")`.

Misc
----
- [Certain checks in the `const_err` lint were deemed unrelated to const
  evaluation][69185], and have been moved to the `unconditional_panic` and
  `arithmetic_overflow` lints.

Compatibility Notes
-------------------

- [Having trailing syntax in the `assert!` macro is now a hard error.][69548]
  This has been a warning since 1.36.0.
- [Fixed `Self` not having the correctly inferred type.][69340] This incorrectly
  led to some instances being accepted, and now correctly emits a hard error.

[69340]: rust-lang/rust#69340

Internal Only
-------------
These changes provide no direct user facing benefits, but represent significant
improvements to the internals and overall performance of `rustc` and
related tools.

- [All components are now built with `opt-level=3` instead of `2`.][67878]
- [Improved how rustc generates drop code.][67332]
- [Improved performance from `#[inline]`-ing certain hot functions.][69256]
- [traits: preallocate 2 Vecs of known initial size][69022]
- [Avoid exponential behaviour when relating types][68772]
- [Skip `Drop` terminators for enum variants without drop glue][68943]
- [Improve performance of coherence checks][68966]
- [Deduplicate types in the generator witness][68672]
- [Invert control in struct_lint_level.][68725]

[67332]: rust-lang/rust#67332
[67429]: rust-lang/rust#67429
[67637]: rust-lang/rust#67637
[67642]: rust-lang/rust#67642
[67878]: rust-lang/rust#67878
[67885]: rust-lang/rust#67885
[68129]: rust-lang/rust#68129
[68672]: rust-lang/rust#68672
[68725]: rust-lang/rust#68725
[68728]: rust-lang/rust#68728
[68738]: rust-lang/rust#68738
[68742]: rust-lang/rust#68742
[68764]: rust-lang/rust#68764
[68772]: rust-lang/rust#68772
[68943]: rust-lang/rust#68943
[68952]: rust-lang/rust#68952
[68966]: rust-lang/rust#68966
[68984]: rust-lang/rust#68984
[69022]: rust-lang/rust#69022
[69185]: rust-lang/rust#69185
[69194]: rust-lang/rust#69194
[69201]: rust-lang/rust#69201
[69227]: rust-lang/rust#69227
[69548]: rust-lang/rust#69548
[69256]: rust-lang/rust#69256
[69361]: rust-lang/rust#69361
[69366]: rust-lang/rust#69366
[69538]: rust-lang/rust#69538
[cargo/7823]: rust-lang/cargo#7823
[cargo/7697]: rust-lang/cargo#7697
[`Once::is_completed`]: https://doc.rust-lang.org/std/sync/struct.Once.html#method.is_completed
[`f32::LOG10_2`]: https://doc.rust-lang.org/std/f32/consts/constant.LOG10_2.html
[`f32::LOG2_10`]: https://doc.rust-lang.org/std/f32/consts/constant.LOG2_10.html
[`f64::LOG10_2`]: https://doc.rust-lang.org/std/f64/consts/constant.LOG10_2.html
[`f64::LOG2_10`]: https://doc.rust-lang.org/std/f64/consts/constant.LOG2_10.html
[`iter::once_with`]: https://doc.rust-lang.org/std/iter/fn.once_with.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.