perf: optimize torrent store with HashMap for O(1) updates
All checks were successful
Build MIPS Binary / build (push) Successful in 4m57s

This commit is contained in:
spinline
2026-02-08 23:52:23 +03:00
parent cffc88443a
commit 1bb3475d61
3 changed files with 47 additions and 46 deletions

View File

@@ -82,9 +82,10 @@ pub fn TorrentTable() -> impl IntoView {
let sort_dir = create_rw_signal(SortDirection::Descending);
let filtered_torrents = move || {
let mut torrents = store
.torrents
.get()
// Convert HashMap values to Vec for filtering and sorting
let torrents: Vec<shared::Torrent> = store.torrents.with(|map| map.values().cloned().collect());
let mut torrents = torrents
.into_iter()
.filter(|t| {
let filter = store.filter.get();