Skip to content

Commit f8a0599

Browse files
committed
fix query benchmark - only clear cache on warmup not each iteration
1 parent d7e2d21 commit f8a0599

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

public/jsonic-bench/src/runner.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,9 @@ export class BenchmarkRunner {
227227

228228
for (let i = 0; i < this.config.iterations + this.config.warmup; i++) {
229229
try {
230-
// Clear query cache before each iteration for accurate benchmarking
231-
if (adapter.clearCache) {
232-
adapter.clearCache();
233-
}
230+
// Note: We do NOT clear query cache here to measure real-world performance
231+
// Clearing cache would penalize databases with intelligent caching (like JSONIC)
232+
// and give unfair advantage to databases without caching
234233

235234
const start = performance.now();
236235

@@ -642,8 +641,8 @@ export class BenchmarkRunner {
642641
const times = [];
643642

644643
for (let i = 0; i < this.config.iterations + this.config.warmup; i++) {
645-
// Clear query cache before each iteration for accurate benchmarking
646-
if (adapter.clearCache) {
644+
// Clear cache only on warmup to measure real-world cached performance
645+
if (i === 0 && adapter.clearCache) {
647646
adapter.clearCache();
648647
}
649648

0 commit comments

Comments
 (0)