adds tracing for instrumenting non-async functions (#44147)

Tracing code is not included in normal release builds
Documents how to use them in our performance docs
Only the maps and cursors are instrumented atm

# Compile times:
current main: fresh release build (cargo clean then build --release)
377.34 secs
current main: fresh debug build (cargo clean then build )
89.31 secs

tracing tracy: fresh release build (cargo clean then build --release)
374.84 secs
tracing tracy: fresh debug build (cargo clean then build )
88.95 secs

tracing tracy: fresh release build with timings (cargo clean then build
--release --features tracing)
375.77 secs
tracing tracy: fresh debug build with timings (cargo clean then build
--features tracing)
90.03 secs


Release Notes:

- N/A

---------

Co-authored-by: localcc <work@localcc.cc>
This commit is contained in:
David Kleingeld
2025-12-05 17:23:06 +00:00
committed by GitHub
co-authored by localcc
parent 07fe8e9bb1
commit b558be7ec6
38 changed files with 898 additions and 451 deletions
+5
View File
@@ -57,6 +57,7 @@ use text::{
};
use theme::SyntaxTheme;
use util::post_inc;
use ztracing::instrument;
pub use self::path_key::PathKey;
@@ -1671,6 +1672,7 @@ impl MultiBuffer {
self.insert_excerpts_after(ExcerptId::max(), buffer, ranges, cx)
}
#[instrument(skip_all)]
fn merge_excerpt_ranges<'a>(
expanded_ranges: impl IntoIterator<Item = &'a ExcerptRange<Point>> + 'a,
) -> (Vec<ExcerptRange<Point>>, Vec<usize>) {
@@ -4483,6 +4485,7 @@ impl MultiBufferSnapshot {
self.convert_dimension(point, text::BufferSnapshot::point_utf16_to_point)
}
#[instrument(skip_all)]
pub fn point_to_offset(&self, point: Point) -> MultiBufferOffset {
self.convert_dimension(point, text::BufferSnapshot::point_to_offset)
}
@@ -4536,6 +4539,7 @@ impl MultiBufferSnapshot {
}
}
#[instrument(skip_all)]
fn convert_dimension<MBR1, MBR2, BR1, BR2>(
&self,
key: MBR1,
@@ -6684,6 +6688,7 @@ where
MBD: MultiBufferDimension + Ord + Sub + ops::AddAssign<<MBD as Sub>::Output>,
BD: TextDimension + AddAssign<<MBD as Sub>::Output>,
{
#[instrument(skip_all)]
fn seek(&mut self, position: &MBD) {
let position = OutputDimension(*position);
self.cached_region.take();