aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authorBlaž Hrastnik2022-01-12 13:27:48 +0000
committerBlaž Hrastnik2022-01-23 07:04:26 +0000
commitadd3be85289a701bf075307d2dfef9fd8a50f69f (patch)
treedd2bb208754dcc30ef34100f4bc9f56c264c849d /helix-term/src/ui
parentdf0d58e9f74befebf902fff887a14ae59746b24b (diff)
Slicing micro-optimization
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/editor.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 956db72e..f90fbf74 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -270,6 +270,10 @@ impl EditorView {
let text_style = theme.get("ui.text");
+ // It's slightly more efficient to produce a full RopeSlice from the Rope, then slice that a bunch
+ // of times than it is to always call Rope::slice/get_slice (it will internally always hit RSEnum::Light).
+ let text = text.slice(..);
+
'outer: for event in highlights {
match event {
HighlightEvent::HighlightStart(span) => {