Skip to content

Commit a77ba86

Browse files
authored
Rollup merge of rust-lang#50564 - nnethercote:inline-Span-methods, r=petrochenkov
Inline `Span` methods. Because they are simple and hot. This change speeds up some incremental runs of a few rustc-perf benchmarks, the best by 3%. Here are the ones with a speedup of at least 1%: ``` coercions avg: -1.1% min: -3.4% max: -0.2% html5ever-opt avg: -0.8% min: -1.7% max: -0.2% clap-rs-check avg: -0.3% min: -1.4% max: 0.7% html5ever avg: -0.7% min: -1.2% max: -0.4% html5ever-check avg: -0.9% min: -1.1% max: -0.8% clap-rs avg: -0.4% min: -1.1% max: -0.1% crates.io-check avg: -0.8% min: -1.0% max: -0.6% serde-opt avg: -0.6% min: -1.0% max: -0.3% ```
2 parents 4199a6c + 77c40f8 commit a77ba86

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/libsyntax_pos/span_encoding.rs

+3
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ pub struct Span(u32);
3131

3232
impl Copy for Span {}
3333
impl Clone for Span {
34+
#[inline]
3435
fn clone(&self) -> Span {
3536
*self
3637
}
3738
}
3839
impl PartialEq for Span {
40+
#[inline]
3941
fn eq(&self, other: &Span) -> bool {
4042
let a = self.0;
4143
let b = other.0;
@@ -44,6 +46,7 @@ impl PartialEq for Span {
4446
}
4547
impl Eq for Span {}
4648
impl Hash for Span {
49+
#[inline]
4750
fn hash<H: Hasher>(&self, state: &mut H) {
4851
let a = self.0;
4952
a.hash(state)

0 commit comments

Comments
 (0)