Merge pull request #1509 from codeflash-ai/fix/js-capture-perf-for-external-runner

[FIX][JS] capturePerf shouldn't break when we have an external runner (batch size = 1)
This commit is contained in:
Sarthak Agarwal 2026-02-18 02:47:16 +05:30 committed by GitHub
commit cc678babf7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -1,2 +1,2 @@
# These version placeholders will be replaced by uv-dynamic-versioning during build.
__version__ = "0.20.0.post634.dev0+2d73cf88"
__version__ = "0.20.0"

View file

@ -713,12 +713,12 @@ function capturePerf(funcName, lineId, fn, ...args) {
for (let batchIndex = 0; batchIndex < batchSize; batchIndex++) {
// Check shared time limit BEFORE each iteration
if (shouldLoop && checkSharedTimeLimit()) {
if (!hasExternalLoopRunner && shouldLoop && checkSharedTimeLimit()) {
break;
}
// Check if this invocation has already reached stability
if (getPerfStabilityCheck() && sharedPerfState.stableInvocations[invocationKey]) {
if (!hasExternalLoopRunner && getPerfStabilityCheck() && sharedPerfState.stableInvocations[invocationKey]) {
break;
}
@ -727,7 +727,7 @@ function capturePerf(funcName, lineId, fn, ...args) {
// Check if we've exceeded max loops for this invocation
const totalIterations = getTotalIterations(invocationKey);
if (totalIterations > getPerfLoopCount()) {
if (!hasExternalLoopRunner && totalIterations > getPerfLoopCount()) {
break;
}
@ -779,7 +779,7 @@ function capturePerf(funcName, lineId, fn, ...args) {
}
// Check stability after accumulating enough samples
if (getPerfStabilityCheck() && runtimes.length >= getPerfMinLoops()) {
if (!hasExternalLoopRunner && getPerfStabilityCheck() && runtimes.length >= getPerfMinLoops()) {
const window = getStabilityWindow();
if (shouldStopStability(runtimes, window, getPerfMinLoops())) {
sharedPerfState.stableInvocations[invocationKey] = true;
@ -788,7 +788,7 @@ function capturePerf(funcName, lineId, fn, ...args) {
}
// If we had an error, stop looping
if (lastError) {
if (!hasExternalLoopRunner && lastError) {
break;
}
}