perf(suggestions): limit to top 5 artists and reduce rate limiting
Major optimizations: - Extract only top 5 artists by track frequency instead of all artists - Use faster rate limiter (200ms) when using MusicBrainz proxy - Remove skip_vector_build since we now have manageable artist count Expected load time: ~5-8 seconds for first load with 5 artists vs previous: 50+ seconds with 50 artists
This commit is contained in:
1 parent
7506d69e53
commit
b551df71c0
4 files changed
+66
-22
No files matched your search
@@ -97,7 +97,7 @@
|
||||
artists,
|
||||
excludeTrackIds,
|
||||
showReasons,
|
||||
{ max_pool_size: poolSize, skip_vector_build: true }
|
||||
{ max_pool_size: poolSize }
|
||||
);
|
||||
const elapsed = ((performance.now() - startTime) / 1000).toFixed(2);
|
||||
log(`Backend returned in ${elapsed}s:`, {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { open } from '@tauri-apps/plugin-dialog';
|
||||
import TrackRow from '../TrackRow.svelte';
|
||||
import PlaylistSuggestions from '../PlaylistSuggestions.svelte';
|
||||
import { extractUniqueArtists } from '$lib/services/playlistSuggestionsService';
|
||||
import { extractTopArtists } from '$lib/services/playlistSuggestionsService';
|
||||
import { type OfflineCacheStatus } from '$lib/stores/offlineCacheState';
|
||||
import {
|
||||
subscribe as subscribeOffline,
|
||||
@@ -194,9 +194,9 @@
|
||||
let localTracksDuration = $derived(localTracks.reduce((sum, t) => sum + t.duration_secs, 0));
|
||||
let totalDuration = $derived((playlist?.duration ?? 0) + localTracksDuration);
|
||||
|
||||
// Playlist suggestions: extract unique artists from Qobuz tracks (not local)
|
||||
// Playlist suggestions: extract top 5 artists by track count (not local tracks)
|
||||
const playlistArtists = $derived(
|
||||
extractUniqueArtists(tracks.filter(t => !t.isLocal))
|
||||
extractTopArtists(tracks.filter(t => !t.isLocal), 5)
|
||||
);
|
||||
// Track IDs to exclude from suggestions (already in playlist)
|
||||
const excludeTrackIds = $derived(
|
||||
|
||||
Reference in new issue
Block a user