mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-16 13:55:51 -07:00
perf(stats): calculate vocabulary totals off main thread
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user