sum_tree: Implement recursive Sumtree::find, use it over Cursor::seek if possible (#40700)
Reduces peak stack usage in these functions and should generally be a
bit performant.
Display map benchmark results
```
To tab point/to_tab_point/1024
time: [531.40 ns 532.10 ns 532.97 ns]
change: [-2.1824% -2.0054% -1.8125%] (p = 0.00 < 0.05)
Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high severe
To fold point/to_fold_point/1024
time: [530.81 ns 531.30 ns 531.80 ns]
change: [-2.0295% -1.9054% -1.7716%] (p = 0.00 < 0.05)
Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
2 (2.00%) high mild
1 (1.00%) high severe
```
Release Notes:
- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
@@ -6140,9 +6140,8 @@ impl MultiBufferSnapshot {
|
||||
} else if id == ExcerptId::max() {
|
||||
Locator::max_ref()
|
||||
} else {
|
||||
let mut cursor = self.excerpt_ids.cursor::<ExcerptId>(());
|
||||
cursor.seek(&id, Bias::Left);
|
||||
if let Some(entry) = cursor.item()
|
||||
let (_, _, item) = self.excerpt_ids.find::<ExcerptId, _>((), &id, Bias::Left);
|
||||
if let Some(entry) = item
|
||||
&& entry.id == id
|
||||
{
|
||||
return &entry.locator;
|
||||
|
||||
Reference in New Issue
Block a user