perf(stats): calculate vocabulary totals off main thread

This commit is contained in:
2026-08-15 22:01:56 -07:00
parent 9ae303af7d
commit 48fdac62a6
10 changed files with 271 additions and 23 deletions
@@ -0,0 +1,17 @@
import { getVocabularySummary } from './query-lexical';
import { Database } from './sqlite';
import { applyPragmas } from './storage';
import type { VocabularyStatsSummary } from './types';
export function executeVocabularySummaryTask(
dbPath: string,
knownWords: string[] | null,
): VocabularyStatsSummary {
const db = new Database(dbPath);
try {
applyPragmas(db);
return getVocabularySummary(db, knownWords ? new Set(knownWords) : null);
} finally {
db.close();
}
}