perf: use Vec instead of BTreeMap in Phrase

This commit is contained in:
🪞👃🪞 2024-07-11 16:53:15 +03:00
parent db25099268
commit 4a8f5b267f
7 changed files with 150 additions and 221 deletions

View file

@ -106,11 +106,9 @@ const KEYMAP: &'static [KeyBinding<App>] = keymap!(App {
[Char('x'), NONE, "extend", "double the current clip", |app: &mut App| {
if let Some(phrase) = app.phrase_mut() {
let mut notes = BTreeMap::new();
for (time, events) in phrase.notes.iter() {
notes.insert(time + phrase.length, events.clone());
}
phrase.notes.append(&mut notes);
let mut notes = phrase.notes.clone();
notes.extend_from_slice(&mut phrase.notes);
phrase.notes = notes;
phrase.length = phrase.length * 2;
}
Ok(true)