Skip to content

Commit e60ccfc

Browse files
committed
Don't inline query_cache_hit to reduce code size of the query hot path.
1 parent e7813fe commit e60ccfc

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

compiler/rustc_data_structures/src/profiling.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ impl SelfProfilerRef {
393393
}
394394

395395
/// Record a query in-memory cache hit.
396-
#[inline(always)]
396+
#[inline(never)]
397397
pub fn query_cache_hit(&self, query_invocation_id: QueryInvocationId) {
398398
self.instant_query_event(
399399
|profiler| profiler.query_cache_hit_event_kind,

compiler/rustc_query_system/src/query/plumbing.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,9 @@ where
722722
}
723723
Some((_, dep_node_index)) => {
724724
dep_graph.read_index(dep_node_index);
725-
qcx.dep_context().profiler().query_cache_hit(dep_node_index.into());
725+
if std::intrinsics::unlikely(qcx.dep_context().profiler().enabled()) {
726+
qcx.dep_context().profiler().query_cache_hit(dep_node_index.into());
727+
}
726728
(false, None)
727729
}
728730
}

0 commit comments

Comments
 (0)