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
-12
@@ -9,7 +9,7 @@ import Database from 'better-sqlite3';
|
||||
/**
|
||||
* Current schema version
|
||||
*/
|
||||
export const CURRENT_SCHEMA_VERSION = 1;
|
||||
export const CURRENT_SCHEMA_VERSION = 2;
|
||||
|
||||
/**
|
||||
* Migration definition
|
||||
@@ -27,17 +27,16 @@ interface Migration {
|
||||
* Future migrations go here.
|
||||
*/
|
||||
const migrations: Migration[] = [
|
||||
// Example migration for version 2 (when needed):
|
||||
// {
|
||||
// version: 2,
|
||||
// description: 'Add support for module resolution',
|
||||
// up: (db) => {
|
||||
// db.exec(`
|
||||
// ALTER TABLE nodes ADD COLUMN module_path TEXT;
|
||||
// CREATE INDEX idx_nodes_module_path ON nodes(module_path);
|
||||
// `);
|
||||
// },
|
||||
// },
|
||||
{
|
||||
version: 2,
|
||||
description: 'Add filePath and language to unresolved_refs for performance',
|
||||
up: (db) => {
|
||||
db.exec(`
|
||||
ALTER TABLE unresolved_refs ADD COLUMN file_path TEXT;
|
||||
ALTER TABLE unresolved_refs ADD COLUMN language TEXT;
|
||||
`);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user