New benchmark case for cold cache

This commit is contained in:
Daniel Imms
2026-05-26 07:56:36 -07:00
parent c6d72b7db6
commit fe9ebddd6f
@@ -15,6 +15,7 @@ const enum Constants {
ROWS = 40,
SCROLLBACK = 8000,
NAVIGATION_ITERATIONS = 250,
COLD_CACHE_ITERATIONS = 75,
INCREMENTAL_ITERATIONS = 75,
DECORATION_REFRESH_ITERATIONS = 25
}
@@ -186,6 +187,31 @@ perfContext('SearchAddon API on real-world terminal content', () => {
}, { fork: false }).showAverageRuntime();
});
perfContext('findNext/cold cache', () => {
let terminal: TestTerminal;
let search: SearchAddon;
before(() => {
terminal = new TestTerminal({ cols: Constants.COLS, rows: Constants.ROWS, scrollback: Constants.SCROLLBACK });
search = new SearchAddon();
search.activate(terminal);
terminal.writeSync(bufferContent);
});
new RuntimeCase('', () => {
let foundCount = 0;
for (let i = 0; i < Constants.COLD_CACHE_ITERATIONS; i++) {
// Force a fresh logical-line reconstruction and match scan each search.
(search as any)._clearMatchCache();
if (search.findNext('opencv')) {
foundCount++;
}
}
if (foundCount !== Constants.COLD_CACHE_ITERATIONS) {
throw new Error(`Expected ${Constants.COLD_CACHE_ITERATIONS} matches, got ${foundCount}`);
}
return { payloadSize: Constants.COLD_CACHE_ITERATIONS, foundCount };
}, { fork: false }).showAverageRuntime();
});
perfContext('findNext/wholeWord dense-punctuation', () => {
let terminal: TestTerminal;
let search: SearchAddon;