@@ -713,12 +713,12 @@ function capturePerf(funcName, lineId, fn, ...args) {
713713
714714 for ( let batchIndex = 0 ; batchIndex < batchSize ; batchIndex ++ ) {
715715 // Check shared time limit BEFORE each iteration
716- if ( shouldLoop && checkSharedTimeLimit ( ) ) {
716+ if ( ! hasExternalLoopRunner && shouldLoop && checkSharedTimeLimit ( ) ) {
717717 break ;
718718 }
719719
720720 // Check if this invocation has already reached stability
721- if ( getPerfStabilityCheck ( ) && sharedPerfState . stableInvocations [ invocationKey ] ) {
721+ if ( ! hasExternalLoopRunner && getPerfStabilityCheck ( ) && sharedPerfState . stableInvocations [ invocationKey ] ) {
722722 break ;
723723 }
724724
@@ -727,7 +727,7 @@ function capturePerf(funcName, lineId, fn, ...args) {
727727
728728 // Check if we've exceeded max loops for this invocation
729729 const totalIterations = getTotalIterations ( invocationKey ) ;
730- if ( totalIterations > getPerfLoopCount ( ) ) {
730+ if ( ! hasExternalLoopRunner && totalIterations > getPerfLoopCount ( ) ) {
731731 break ;
732732 }
733733
@@ -779,7 +779,7 @@ function capturePerf(funcName, lineId, fn, ...args) {
779779 }
780780
781781 // Check stability after accumulating enough samples
782- if ( getPerfStabilityCheck ( ) && runtimes . length >= getPerfMinLoops ( ) ) {
782+ if ( ! hasExternalLoopRunner && getPerfStabilityCheck ( ) && runtimes . length >= getPerfMinLoops ( ) ) {
783783 const window = getStabilityWindow ( ) ;
784784 if ( shouldStopStability ( runtimes , window , getPerfMinLoops ( ) ) ) {
785785 sharedPerfState . stableInvocations [ invocationKey ] = true ;
@@ -788,7 +788,7 @@ function capturePerf(funcName, lineId, fn, ...args) {
788788 }
789789
790790 // If we had an error, stop looping
791- if ( lastError ) {
791+ if ( ! hasExternalLoopRunner && lastError ) {
792792 break ;
793793 }
794794 }
0 commit comments