Use Vec
for KeyContext
instead of SmallVec
(#24916)
In Zed the key context almost always has more than 1 entry, so use of `SmallVec` is just adding overhead. In Zed while using the editor this typically has more than 8 entries. Since `ContextEntry` is 48 bytes, if this were made to be a `SmallVec<[ContextEntry; 10]>` then it would use 480 bytes on the stack, which to me seems like a lot to be copying. So, instead opting to just use `Vec` Release Notes: - N/A
This commit is contained in:
parent
f2bc3d3738
commit
aa4c438f83
1 changed files with 1 additions and 2 deletions
|
@ -1,6 +1,5 @@
|
||||||
use crate::SharedString;
|
use crate::SharedString;
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use smallvec::SmallVec;
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
/// A datastructure for resolving whether an action should be dispatched
|
/// A datastructure for resolving whether an action should be dispatched
|
||||||
|
@ -8,7 +7,7 @@ use std::fmt;
|
||||||
/// and/or key value pairs representing the current context for the
|
/// and/or key value pairs representing the current context for the
|
||||||
/// keymap.
|
/// keymap.
|
||||||
#[derive(Clone, Default, Eq, PartialEq, Hash)]
|
#[derive(Clone, Default, Eq, PartialEq, Hash)]
|
||||||
pub struct KeyContext(SmallVec<[ContextEntry; 1]>);
|
pub struct KeyContext(Vec<ContextEntry>);
|
||||||
|
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
|
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
|
||||||
/// An entry in a KeyContext
|
/// An entry in a KeyContext
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue