aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-03-01 13:13:36 -0800
committerFuwn <[email protected]>2026-03-01 14:42:57 -0800
commitf0f0065aa8abcdd71fca5507d2b5eaa42de105d9 (patch)
tree7ee203a8ad0936a67ab6cf5f7dcb1a0eb13db88c
parentperf(match): cache indexed schedules and per-airing match results (diff)
downloaddue.moe-f0f0065aa8abcdd71fca5507d2b5eaa42de105d9.tar.xz
due.moe-f0f0065aa8abcdd71fca5507d2b5eaa42de105d9.zip
perf(match): fast-path exact normalised title matches
-rw-r--r--src/lib/Media/Anime/Airing/Subtitled/match.ts11
1 files changed, 11 insertions, 0 deletions
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<number>();