]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #96020 - martingms:optimize-relate_substs, r=nnethercote
authorbors <bors@rust-lang.org>
Tue, 19 Apr 2022 10:53:53 +0000 (10:53 +0000)
committerbors <bors@rust-lang.org>
Tue, 19 Apr 2022 10:53:53 +0000 (10:53 +0000)
Micro-optimize `ty::relate::relate_substs` by avoiding `match`

Was a top-20 hot function in a callgrind profile of compiling `bitmaps-3.1.0`.

Yields some small speedups on that crate and some others according to local benching:

Benchmark | Profile | Scenario | % Change | Significance Factor?
-- | -- | -- | -- | --
bitmaps-3.1.0 | check | full | -1.88% | 9.42x
bitmaps-3.1.0 | debug | full | -1.80% | 8.99x
bitmaps-3.1.0 | opt | full | -1.70% | 8.49x
bitmaps-3.1.0 | check | incr-full | -1.54% | 7.68x
deep-vector | debug | full | 1.52% | 7.61x
bitmaps-3.1.0 | debug | incr-full | -1.45% | 7.26x
bitmaps-3.1.0 | opt | incr-full | -1.39% | 6.95x
nalgebra-0.30.1 | check | full | -0.68% | 3.42x
nalgebra-0.30.1 | debug | full | -0.64% | 3.22x
nalgebra-0.30.1 | opt | full | -0.64% | 3.20x
projection-caching | check | full | -0.61% | 3.05x
nalgebra-0.30.1 | check | incr-full | -0.56% | 2.78x
nalgebra-0.30.1 | opt | incr-full | -0.54% | 2.72x
nalgebra-0.30.1 | debug | incr-full | -0.54% | 2.69x
projection-caching | check | incr-full | -0.50% | 2.51x
tt-muncher | opt | full | -0.48% | 2.42x
projection-caching | opt | full | -0.47% | 2.37x
projection-caching | debug | full | -0.47% | 2.35x
projection-caching | opt | incr-full | -0.44% | 2.21x
projection-caching | debug | incr-full | -0.42% | 2.08x
deeply-nested-multi | check | incr-full | 0.37% | 1.87x
wf-projection-stress-65510 | opt | full | -0.37% | 1.84x
deep-vector | debug | incr-patched: add vec item | -0.32% | 1.61x
projection-caching | debug | incr-unchanged | -0.32% | 1.60x
wf-projection-stress-65510 | check | full | -0.31% | 1.55x
projection-caching | opt | incr-unchanged | -0.31% | 1.53x
wf-projection-stress-65510 | debug | incr-full | -0.30% | 1.51x
wf-projection-stress-65510 | opt | incr-full | -0.30% | 1.51x

r? `@nnethercote`


Trivial merge