Auto merge of #159149 - Kobzol:bootstrap-pgo-cargo, r=jieyouxu

Use PGO for Cargo



I downloaded the built Cargo and compared it with the parent commit locally on `bors` (which is of course not in the PGO training set). The results are quite nice:

```
Benchmark 1 (26 runs): cargo +babf6ea4aab9ed78ea9400b25b0e7e79a6870f29 test --no-run
  measurement          mean ± σ            min … max           outliers         delta
  wall_time           192ms ± 6.95ms     188ms …  226ms          1 ( 4%)        0%
  peak_rss           96.3MB ±  354KB    95.6MB … 96.9MB          0 ( 0%)        0%
  cpu_cycles          454M  ± 5.92M      448M  …  480M           1 ( 4%)        0%
  instructions        797M  ± 5.68M      796M  …  825M           1 ( 4%)        0%
  cache_references   32.7M  ±  352K     32.0M  … 34.0M           1 ( 4%)        0%
  cache_misses       8.82M  ± 86.9K     8.67M  … 9.10M           1 ( 4%)        0%
  branch_misses      3.76M  ± 41.3K     3.72M  … 3.93M           1 ( 4%)        0%

Benchmark 2 (28 runs): cargo +b2aa8c0474895b96828df9c09182952caf6f6450 test --no-run
  measurement          mean ± σ            min … max           outliers         delta
  wall_time           185ms ± 7.07ms     175ms …  208ms          1 ( 4%)        ⚡-  3.9% ±  2.0%
  peak_rss           90.9MB ±  207KB    90.4MB … 91.3MB          1 ( 4%)        ⚡-  5.6% ±  0.2%
  cpu_cycles          420M  ± 9.31M      406M  …  440M           0 ( 0%)        ⚡-  7.7% ±  0.9%
  instructions        736M  ± 5.47M      735M  …  764M           1 ( 4%)        ⚡-  7.6% ±  0.4%
  cache_references   26.2M  ±  406K     25.7M  … 28.0M           2 ( 7%)        ⚡- 19.9% ±  0.6%
  cache_misses       6.01M  ± 92.7K     5.85M  … 6.28M           1 ( 4%)        ⚡- 31.8% ±  0.6%
  branch_misses      3.47M  ± 55.9K     3.40M  … 3.69M           1 ( 4%)        ⚡-  7.6% ±  0.7%
```

~7.5% icount improvement, that's pretty cool.
tree: 4de4d6d357ae7a12826f655ed39b09ce9f9a3c65
  1. .github/
  2. compiler/
  3. library/
  4. LICENSES/
  5. src/
  6. tests/
  7. .clang-format
  8. .editorconfig
  9. .git-blame-ignore-revs
  10. .gitattributes
  11. .gitignore
  12. .gitmodules
  13. .ignore
  14. .mailmap
  15. bootstrap.example.toml
  16. Cargo.lock
  17. Cargo.toml
  18. CODE_OF_CONDUCT.md
  19. configure
  20. CONTRIBUTING.md
  21. COPYRIGHT
  22. INSTALL.md
  23. LICENSE-APACHE
  24. license-metadata.json
  25. LICENSE-MIT
  26. package.json
  27. README.md
  28. RELEASES.md
  29. REUSE.toml
  30. rust-bors.toml
  31. rustfmt.toml
  32. triagebot.toml
  33. typos.toml
  34. x
  35. x.ps1
  36. x.py
  37. yarn.lock
README.md

Website | Getting started | Learn | Documentation | Contributing

This is the main source code repository for Rust. It contains the compiler, standard library, and documentation.

Why Rust?

  • Performance: Fast and memory-efficient, suitable for critical services, embedded devices, and easily integrated with other languages.

  • Reliability: Our rich type system and ownership model ensure memory and thread safety, reducing bugs at compile-time.

  • Productivity: Comprehensive documentation, a compiler committed to providing great diagnostics, and advanced tooling including package manager and build tool (Cargo), auto-formatter (rustfmt), linter (Clippy) and editor support (rust-analyzer).

Quick Start

Read “Installation” from The Book.

Installing from Source

If you really want to install from source (though this is not recommended), see INSTALL.md.

Getting Help

See https://www.rust-lang.org/community for a list of chat platforms and forums.

Contributing

See CONTRIBUTING.md.

For a detailed explanation of the compiler's architecture and how to begin contributing, see the rustc-dev-guide.

License

Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.

See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.

Trademark

The Rust Foundation owns and protects the Rust and Cargo trademarks and logos (the “Rust Trademarks”).

If you want to use these names or brands, please read the Rust language trademark policy.

Third-party logos may be subject to third-party copyrights and trademarks. See Licenses for details.