From eef648bda50f30b4bb37389fb592cb7368b72975 Mon Sep 17 00:00:00 2001 From: toofar Date: Fri, 14 Oct 2022 22:41:48 +1300 Subject: [PATCH] Use set for paths-to-update comparison With about 140k tracks the update operation takes a long time. A flamegraph shows update_library_convert_extra_info as taking almost all of that time and slice_contains in particular. With the previous release 0.2.9 updates where very fast and got to the actual analyzing part right away. With 0.3.2 it spends a lot of time before it even gets to analyzing. And it seems to be slower to start up the more songs you have analyzed. Blissify 0.2.9 seemed to use a HashSet too :) --- src/library.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/library.rs b/src/library.rs index 97c3dc2..8b4f34a 100644 --- a/src/library.rs +++ b/src/library.rs @@ -129,7 +129,7 @@ use rusqlite::Params; use rusqlite::Row; use serde::de::DeserializeOwned; use serde::Serialize; -use std::collections::HashMap; +use std::collections::{HashMap, HashSet}; use std::env; use std::fs; use std::fs::create_dir_all; @@ -661,7 +661,7 @@ impl Library { Ok(row.get_unwrap::(0)) })? .map(|x| PathBuf::from(x.unwrap())) - .collect::>(); + .collect::>(); return_value };