Port performance improvements from PR #15
- SQLite performance pragmas: synchronous=NORMAL, 64MB cache, memory temp store, 256MB mmap (safe with WAL mode) - Batch insert for unresolved refs: single transaction instead of N individual inserts per file - Symbol caching (warmCaches): pre-load all nodes into memory maps before resolution, eliminating repeated SQLite queries per ref - Async file I/O: fs.stat/readFile in indexFile() are now non-blocking - Denormalize filePath/language onto UnresolvedReference: avoids N node lookups during resolution, with schema migration v2 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
e07250ed60
commit
d80900f653
+11
-5
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as fsp from 'fs/promises';
|
||||
import * as path from 'path';
|
||||
import * as crypto from 'crypto';
|
||||
import {
|
||||
@@ -399,8 +400,8 @@ export class ExtractionOrchestrator {
|
||||
let content: string;
|
||||
let stats: fs.Stats;
|
||||
try {
|
||||
stats = fs.statSync(fullPath);
|
||||
content = fs.readFileSync(fullPath, 'utf-8');
|
||||
stats = await fsp.stat(fullPath);
|
||||
content = await fsp.readFile(fullPath, 'utf-8');
|
||||
} catch (error) {
|
||||
captureException(error, { operation: 'extract-file', filePath: fullPath });
|
||||
return {
|
||||
@@ -489,9 +490,14 @@ export class ExtractionOrchestrator {
|
||||
this.queries.insertEdges(result.edges);
|
||||
}
|
||||
|
||||
// Insert unresolved references
|
||||
for (const ref of result.unresolvedReferences) {
|
||||
this.queries.insertUnresolvedRef(ref);
|
||||
// Insert unresolved references in batch with denormalized filePath/language
|
||||
if (result.unresolvedReferences.length > 0) {
|
||||
const refsWithContext = result.unresolvedReferences.map((ref) => ({
|
||||
...ref,
|
||||
filePath: ref.filePath ?? filePath,
|
||||
language: ref.language ?? language,
|
||||
}));
|
||||
this.queries.insertUnresolvedRefsBatch(refsWithContext);
|
||||
}
|
||||
|
||||
// Insert file record
|
||||
|
||||
Reference in New Issue
Block a user