rust/src
bors c241e14650 Auto merge of #136593 - lukas-code:ty-value-perf, r=oli-obk
valtree performance tuning

Summary: This PR makes type checking of code with many type-level constants faster.

After https://github.com/rust-lang/rust/pull/136180 was merged, we observed a small perf regression (https://github.com/rust-lang/rust/pull/136318#issuecomment-2635562821). This happened because that PR introduced additional copies in the fast reject code path for consts, which is very hot for certain crates: 6c1d960d88/compiler/rustc_type_ir/src/fast_reject.rs (L486-L487)

This PR improves the performance again by properly interning the valtrees so that copying and comparing them becomes faster. This will become especially useful with `feature(adt_const_params)`, so the fast reject code doesn't have to do a deep compare of the valtrees.

Note that we can't just compare the interned consts themselves in the fast reject, because sometimes `'static` lifetimes in the type are be replaced with inference variables (due to canonicalization) on one side but not the other.

A less invasive alternative that I considered is simply avoiding copies introduced by https://github.com/rust-lang/rust/pull/136180 and comparing the valtrees it in-place (see commit: 9e91e50ac5 / perf results: https://github.com/rust-lang/rust/pull/136593#issuecomment-2642303245), however that was still measurably slower than interning.

There are some minor regressions in secondary benchmarks: These happen due to changes in memory allocations and seem acceptable to me. The crates that make heavy use of valtrees show no significant changes in memory usage.
2025-02-13 15:27:30 +00:00
..
bootstrap Rollup merge of #134999 - Berrysoft:dev/new-cygwin-target, r=chenyukang,workingjubilee 2025-02-13 03:53:28 -05:00
build_helper Update username in build helper example 2025-01-28 10:51:30 +01:00
ci ci: remove more unused files and directories in free runners 2025-02-11 17:47:32 +01:00
doc Auto merge of #136593 - lukas-code:ty-value-perf, r=oli-obk 2025-02-13 15:27:30 +00:00
etc Update bootstrap completions 2025-02-05 15:33:40 +01:00
gcc@fd3498bff0
librustdoc Rollup merge of #136927 - GuillaumeGomez:add-missing-hashtag-escape, r=notriddle 2025-02-12 20:10:01 -05:00
llvm-project@7e8c93c87c Update to LLVM 19.1.7 2025-01-14 14:46:09 +01:00
rustc-std-workspace
rustdoc-json-types rustdoc-json-types: Document that crate name isn't package name. 2025-02-01 19:57:59 +00:00
tools Auto merge of #136593 - lukas-code:ty-value-perf, r=oli-obk 2025-02-13 15:27:30 +00:00
README.md
stage0 Update bootstrap compiler and rustfmt 2025-02-08 22:07:11 +00:00
version bump version 2025-01-03 10:36:06 +01:00

This directory contains some source code for the Rust project, including:

  • The bootstrapping build system
  • Various submodules for tools, like cargo, tidy, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.