()
| 291 | } |
| 292 | |
| 293 | async function main(): Promise<void> { |
| 294 | await client.connect() |
| 295 | try { |
| 296 | await seed() |
| 297 | const samplePubkey = await pickSamplePubkey() |
| 298 | if (!samplePubkey) { |
| 299 | console.error('no pubkey found — seeding failed') |
| 300 | process.exit(1) |
| 301 | } |
| 302 | |
| 303 | await dropHotPathIndexes() |
| 304 | const before: Array<{ name: string } & MeasureResult> = [] |
| 305 | for (const tc of cases(samplePubkey)) { |
| 306 | before.push({ name: tc.name, ...(await measure(tc)) }) |
| 307 | } |
| 308 | |
| 309 | await createHotPathIndexes() |
| 310 | const after: Array<{ name: string } & MeasureResult> = [] |
| 311 | for (const tc of cases(samplePubkey)) { |
| 312 | after.push({ name: tc.name, ...(await measure(tc)) }) |
| 313 | } |
| 314 | |
| 315 | console.log('\n=== RESULTS (median of %d runs, milliseconds) ===\n', RUNS) |
| 316 | for (let i = 0; i < before.length; i++) { |
| 317 | const b = before[i] |
| 318 | const a = after[i] |
| 319 | const speedup = (b.median / a.median).toFixed(2) |
| 320 | console.log(`• ${b.name}`) |
| 321 | console.log( |
| 322 | ` BEFORE: ${b.median.toFixed(2)} ms | nodes=${b.nodeTypes.join(',')} | idx=[${b.indexes.join(', ') || 'none'}]`, |
| 323 | ) |
| 324 | console.log( |
| 325 | ` AFTER: ${a.median.toFixed(2)} ms | nodes=${a.nodeTypes.join(',')} | idx=[${a.indexes.join(', ') || 'none'}]`, |
| 326 | ) |
| 327 | console.log(` SPEEDUP: ${speedup}x\n`) |
| 328 | } |
| 329 | } finally { |
| 330 | await client.end() |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | main().catch((err: unknown) => { |
| 335 | console.error(err) |
no test coverage detected