1
Fork 0

Miscellaneous inlining improvements

Add `#[inline]` to a few trivial non-generic methods from a perf report
that otherwise wouldn't be candidates for inlining.
This commit is contained in:
Tomasz Miąsko 2022-07-07 00:00:00 +00:00
parent 3e51277fe6
commit 87374de3ad
8 changed files with 13 additions and 0 deletions

View file

@ -59,6 +59,7 @@ pub enum DepNodeColor {
}
impl DepNodeColor {
#[inline]
pub fn is_green(self) -> bool {
match self {
DepNodeColor::Red => false,

View file

@ -84,6 +84,7 @@ pub struct QueryJob {
impl QueryJob {
/// Creates a new query job.
#[inline]
pub fn new(id: QueryJobId, span: Span, parent: Option<QueryJobId>) -> Self {
QueryJob {
id,
@ -106,6 +107,7 @@ impl QueryJob {
///
/// This does nothing for single threaded rustc,
/// as there are no concurrent jobs which could be waiting on us
#[inline]
pub fn signal_complete(self) {
#[cfg(parallel_compiler)]
{

View file

@ -81,6 +81,7 @@ pub struct QuerySideEffects {
}
impl QuerySideEffects {
#[inline]
pub fn is_empty(&self) -> bool {
let QuerySideEffects { diagnostics } = self;
diagnostics.is_empty()