From 95120164b0c14f0d78c167224074e870740ee17a Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 21 May 2018 18:35:47 +1000 Subject: [PATCH] Inline `try_get`. This speeds up lots of rustc-perf benchmark runs. The maximum improvement is 1%, but there are a lot in the 0.5--1.0% range. --- src/librustc/ty/maps/plumbing.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librustc/ty/maps/plumbing.rs b/src/librustc/ty/maps/plumbing.rs index 065b7939ac362..c43b7e95b35e3 100644 --- a/src/librustc/ty/maps/plumbing.rs +++ b/src/librustc/ty/maps/plumbing.rs @@ -105,6 +105,10 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> { /// start executing the query, or it returns with the result of the query. /// If the query is executing elsewhere, this will wait for it. /// If the query panicked, this will silently panic. + /// + /// This function is inlined because that results in a noticeable speedup + /// for some compile-time benchmarks. + #[inline(always)] pub(super) fn try_get( tcx: TyCtxt<'a, 'tcx, '_>, span: Span,