mirror of
https://github.com/wez/wezterm.git
synced 2024-11-23 15:04:36 +03:00
micro optimize setting up the storage length
SmallVec::resize showed up as a hot spot in the profiler
This commit is contained in:
parent
983eca1209
commit
a022d3856a
@ -225,7 +225,9 @@ impl Cell {
|
||||
pub fn new(text: char, attrs: CellAttributes) -> Self {
|
||||
let len = text.len_utf8();
|
||||
let mut storage = SmallVec::with_capacity(len);
|
||||
storage.resize(len, 0);
|
||||
unsafe {
|
||||
storage.set_len(len);
|
||||
}
|
||||
text.encode_utf8(&mut storage);
|
||||
Self::nerf_control_char(&mut storage);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user