Inlining on btree commitment map comparators for a 10% win

This commit is contained in:
Chris Fallin
2021-05-07 01:51:40 -07:00
parent 3713d6131e
commit 0f3454b4d7

View File

@@ -391,17 +391,20 @@ impl LiveRangeKey {
} }
impl std::cmp::PartialEq for LiveRangeKey { impl std::cmp::PartialEq for LiveRangeKey {
#[inline(always)]
fn eq(&self, other: &Self) -> bool { fn eq(&self, other: &Self) -> bool {
self.to > other.from && self.from < other.to self.to > other.from && self.from < other.to
} }
} }
impl std::cmp::Eq for LiveRangeKey {} impl std::cmp::Eq for LiveRangeKey {}
impl std::cmp::PartialOrd for LiveRangeKey { impl std::cmp::PartialOrd for LiveRangeKey {
#[inline(always)]
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other)) Some(self.cmp(other))
} }
} }
impl std::cmp::Ord for LiveRangeKey { impl std::cmp::Ord for LiveRangeKey {
#[inline(always)]
fn cmp(&self, other: &Self) -> std::cmp::Ordering { fn cmp(&self, other: &Self) -> std::cmp::Ordering {
if self.to <= other.from { if self.to <= other.from {
std::cmp::Ordering::Less std::cmp::Ordering::Less