From f0f0065aa8abcdd71fca5507d2b5eaa42de105d9 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 1 Mar 2026 13:13:36 -0800 Subject: perf(match): fast-path exact normalised title matches --- src/lib/Media/Anime/Airing/Subtitled/match.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/lib/Media/Anime/Airing/Subtitled/match.ts b/src/lib/Media/Anime/Airing/Subtitled/match.ts index 52cf581f..eb9c9b70 100644 --- a/src/lib/Media/Anime/Airing/Subtitled/match.ts +++ b/src/lib/Media/Anime/Airing/Subtitled/match.ts @@ -220,6 +220,17 @@ export const findClosestMatch = (scheduleIndex: ScheduleIndex, anime: Media): Ti if (searchTitle.includes('OVA') || searchTitle.includes('Special')) continue; const normalizedSearchTitle = preprocessTitle(searchTitle); + const exactMatchIndexes = dayIndex.exactTitleIndex.get(normalizedSearchTitle); + + if (exactMatchIndexes && exactMatchIndexes.length > 0) { + const exactMatch = dayIndex.entries[exactMatchIndexes[0]]; + + if (exactMatch) { + closestMatchCache.set(cacheKey, exactMatch.time); + return exactMatch.time; + } + } + const searchTokens = normalizedSearchTitle.split(' ').filter(isMeaningfulToken); const candidateIndexSet = new Set(); -- cgit v1.2.3