Repository navigation
fix(benchmark.js): collect garbage before synchronous measurements - #112
not-matthias wants to merge 1 commit into
Conversation
Match the asynchronous path by collecting warmup garbage before the start marker. Keep forced collection outside the measured window. Refs COD-4028
[Medium impact] The change is limited to synchronous runs in the Benchmark.js plugin. The PR appears safe to merge, with a non-blocking request for regression tests.
|
| } else { | ||
| optimizeFunctionSync(benchPayload); | ||
| await mongoMeasurement.start(uri); | ||
| global.gc?.(); |
There was a problem hiding this comment.
The new collection has no regression test. Existing tests check that startBenchmark runs, but not whether global.gc runs before it. Removing this fix or moving collection into the measured window would still pass those tests.
Add a temporary global.gc mock and check that collection runs after warmup and before startBenchmark. Also cover missing GC and fallback execution, and restore the original global afterward.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/benchmark.js-plugin/src/index.ts
Line: 210
Comment:
**GC ordering has no test**
The new collection has no regression test. Existing tests check that `startBenchmark` runs, but not whether `global.gc` runs before it. Removing this fix or moving collection into the measured window would still pass those tests.
Add a temporary `global.gc` mock and check that collection runs after warmup and before `startBenchmark`. Also cover missing GC and fallback execution, and restore the original global afterward.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Merging this PR will degrade performance by 3.68%3 warnings, 1 note
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
We do the same already in the other frameworks
Refs COD-4028