mirror of
https://github.com/zed-industries/zed.git
synced 2026-12-04 04:13:21 +01:00
multi_buffer: Don't eagerly clone BufferSnapshot in range_to_buffer_ranges (#59190)
Both cloning and dropping of these has quite a bit of overhead (despite them being snapshots), so avoid where possible, especially in display map syncing Release Notes: - N/A or Added/Fixed/Improved ...
This commit is contained in:
1 parent
992f395c3d
commit
b6c7496aea
30 files changed
+78
-85
No files matched your search
@@ -3610,7 +3610,7 @@ impl MultiBufferSnapshot {
|
||||
&self,
|
||||
range: Range<T>,
|
||||
) -> Vec<(
|
||||
BufferSnapshot,
|
||||
&BufferSnapshot,
|
||||
Range<BufferOffset>,
|
||||
ExcerptRange<text::Anchor>,
|
||||
)> {
|
||||
@@ -3621,7 +3621,7 @@ impl MultiBufferSnapshot {
|
||||
cursor.seek(&start);
|
||||
|
||||
let mut result: Vec<(
|
||||
BufferSnapshot,
|
||||
&BufferSnapshot,
|
||||
Range<BufferOffset>,
|
||||
ExcerptRange<text::Anchor>,
|
||||
)> = Vec::new();
|
||||
@@ -3653,7 +3653,7 @@ impl MultiBufferSnapshot {
|
||||
{
|
||||
prev.1.end = end;
|
||||
} else {
|
||||
result.push((region.buffer.clone(), start..end, excerpt_range));
|
||||
result.push((region.buffer, start..end, excerpt_range));
|
||||
}
|
||||
}
|
||||
cursor.next();
|
||||
@@ -3676,11 +3676,7 @@ impl MultiBufferSnapshot {
|
||||
|| prev_excerpt.context.start != excerpt_range.context.start
|
||||
})
|
||||
{
|
||||
result.push((
|
||||
buffer_snapshot.clone(),
|
||||
buffer_offset..buffer_offset,
|
||||
excerpt_range,
|
||||
));
|
||||
result.push((buffer_snapshot, buffer_offset..buffer_offset, excerpt_range));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user