@@ -710,12 +710,12 @@ function capturePerf(funcName, lineId, fn, ...args) {
710710
711711 for ( let batchIndex = 0 ; batchIndex < batchSize ; batchIndex ++ ) {
712712 // Check shared time limit BEFORE each iteration
713- if ( shouldLoop && checkSharedTimeLimit ( ) ) {
713+ if ( ! hasExternalLoopRunner && shouldLoop && checkSharedTimeLimit ( ) ) {
714714 break ;
715715 }
716716
717717 // Check if this invocation has already reached stability
718- if ( getPerfStabilityCheck ( ) && sharedPerfState . stableInvocations [ invocationKey ] ) {
718+ if ( ! hasExternalLoopRunner && getPerfStabilityCheck ( ) && sharedPerfState . stableInvocations [ invocationKey ] ) {
719719 break ;
720720 }
721721
@@ -724,7 +724,7 @@ function capturePerf(funcName, lineId, fn, ...args) {
724724
725725 // Check if we've exceeded max loops for this invocation
726726 const totalIterations = getTotalIterations ( invocationKey ) ;
727- if ( totalIterations > getPerfLoopCount ( ) ) {
727+ if ( ! hasExternalLoopRunner && totalIterations > getPerfLoopCount ( ) ) {
728728 break ;
729729 }
730730
@@ -776,7 +776,7 @@ function capturePerf(funcName, lineId, fn, ...args) {
776776 }
777777
778778 // Check stability after accumulating enough samples
779- if ( getPerfStabilityCheck ( ) && runtimes . length >= getPerfMinLoops ( ) ) {
779+ if ( ! hasExternalLoopRunner && getPerfStabilityCheck ( ) && runtimes . length >= getPerfMinLoops ( ) ) {
780780 const window = getStabilityWindow ( ) ;
781781 if ( shouldStopStability ( runtimes , window , getPerfMinLoops ( ) ) ) {
782782 sharedPerfState . stableInvocations [ invocationKey ] = true ;
@@ -785,7 +785,7 @@ function capturePerf(funcName, lineId, fn, ...args) {
785785 }
786786
787787 // If we had an error, stop looping
788- if ( lastError ) {
788+ if ( ! hasExternalLoopRunner && lastError ) {
789789 break ;
790790 }
791791 }
0 commit comments