You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: route query analysis through native Rust engine (#745)
* perf: route query analysis functions through native Rust engine
Query analysis functions (fnDepsData, fnImpactData, fileDepsData,
impactAnalysisData, briefData, implementationsData, interfacesData)
were hardcoded to use openReadonlyOrFail() (better-sqlite3), completely
bypassing the native Rust engine for queries even when --engine native
was set.
Add withRepo() helper that mirrors withReadonlyDb() but routes through
openRepo(), which tries NativeRepository (rusqlite) first and falls
back to SqliteRepository (better-sqlite3). Migrate 7 analysis functions
to use it.
Infrastructure changes:
- Add getFileHash, hasImplementsEdges, hasCoChangesTable to Repository
- Update normalizeSymbol to accept Repository in addition to DbHandle
- Refactor buildTransitiveCallers to use repo.findCallers() instead of
raw SQL prepared statements
bfsTransitiveCallers accepts both BetterSqlite3Database and Repository
for backward compatibility with check.ts and audit.ts callers.
* perf(native): add Rust NAPI methods for getFileHash, hasImplementsEdges, hasCoChangesTable
Removes conservative placeholder implementations in NativeRepository
by adding proper Rust #[napi] query methods that mirror SqliteRepository
behavior. Falls back gracefully when running against a prebuilt native
addon that predates these methods.
* style: fix quote style in native-repository typeof guards
* fix: resolve native engine parity gaps for fileHash and method hierarchy (#745)
- Port resolveMethodViaHierarchy to accept Repository (not just raw DB),
so hierarchy-based caller discovery works on both native and WASM paths
- Add lazy better-sqlite3 fallback in NativeRepository for getFileHash,
hasImplementsEdges, and hasCoChangesTable until Rust implements them
- Pass dbPath to NativeRepository constructor; close fallback on dispose
- Remove SqliteRepository instanceof check from fnDepsData
* fix: memoize hasImplementsEdges in SqliteRepository (#745)
Cache the result of the implements-edge check to avoid re-querying
on every call, restoring the per-connection caching behavior that
existed before the refactor.
* fix: memoize hasCoChangesTable in both repository implementations (#745)
* fix: cache toRepo wrapper to preserve per-instance memoization (#745)
Legacy raw-db callers of bfsTransitiveCallers create a SqliteRepository
via toRepo on each call. Without caching, hasImplementsEdges memoization
is lost between calls. A WeakMap keyed on the db handle now ensures the
same Repository instance is reused across calls with the same connection.
0 commit comments