From bd607b4cbd58e2bff06e36f614ff61b7d1a721c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= <blaz@mxxn.io>
Date: Mon, 22 Mar 2021 14:50:08 +0900
Subject: [PATCH] Provide a capacity on Selection::new's normalize.

---
 helix-core/src/selection.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs
index cc8ec8d0..e16c2b6d 100644
--- a/helix-core/src/selection.rs
+++ b/helix-core/src/selection.rs
@@ -214,7 +214,7 @@ impl Selection {
             ranges.sort_unstable_by_key(Range::from);
             primary_index = ranges.iter().position(|&range| range == primary).unwrap();
 
-            let mut result = SmallVec::new();
+            let mut result = SmallVec::with_capacity(ranges.len()); // approx
 
             // TODO: we could do with one vec by removing elements as we mutate