UNPKG

@stackmemoryai/stackmemory

Version:

Project-scoped memory for AI coding tools. Durable context across sessions with MCP integration, frames, smart retrieval, Claude Code skills, and automatic hooks.

58 lines (45 loc) • 1.49 kB
#!/usr/bin/env node /** * Run performance benchmarks */ import Database from 'better-sqlite3'; import { join } from 'path'; import { existsSync } from 'fs'; import { PerformanceBenchmark } from '../src/core/performance/performance-benchmark.js'; import { logger } from '../src/core/monitoring/logger.js'; async function runBenchmarks() { const projectRoot = process.cwd(); const dbPath = join(projectRoot, '.stackmemory', 'context.db'); if (!existsSync(dbPath)) { console.error( 'āŒ StackMemory not initialized. Run "stackmemory init" first.' ); process.exit(1); } const db = new Database(dbPath, { readonly: false }); const projectId = 'benchmark-test'; console.log('šŸš€ Starting Performance Benchmarks...\n'); const benchmark = new PerformanceBenchmark(); try { const suite = await benchmark.runFullSuite(projectRoot, db, projectId); console.log('\nāœ… Benchmarks completed successfully!'); // Summary if (suite.averageImprovement > 0) { console.log( `\nšŸŽ‰ Overall performance improved by ${suite.averageImprovement.toFixed(1)}%` ); } process.exit(0); } catch (error: unknown) { console.error('\nāŒ Benchmark failed:', error); logger.error('Benchmark error', error as Error); process.exit(1); } finally { db.close(); } } // Run if called directly if (import.meta.url === `file://${process.argv[1]}`) { runBenchmarks().catch(console.error); } export { runBenchmarks };