@@ -682,7 +682,7 @@ function capturePerf(funcName, lineId, fn, ...args) {
682682 const runtimes = sharedPerfState . invocationRuntimes [ invocationKey ] ;
683683
684684 // Calculate stability window size based on collected runtimes
685- const getStabilityWindow = ( ) => Math . max ( PERF_MIN_LOOPS , Math . ceil ( runtimes . length * STABILITY_WINDOW_SIZE ) ) ;
685+ const getStabilityWindow = ( ) => Math . max ( getPerfMinLoops ( ) , Math . ceil ( runtimes . length * STABILITY_WINDOW_SIZE ) ) ;
686686
687687 for ( let batchIndex = 0 ; batchIndex < batchSize ; batchIndex ++ ) {
688688 // Check shared time limit BEFORE each iteration
@@ -691,7 +691,7 @@ function capturePerf(funcName, lineId, fn, ...args) {
691691 }
692692
693693 // Check if this invocation has already reached stability
694- if ( PERF_STABILITY_CHECK && sharedPerfState . stableInvocations [ invocationKey ] ) {
694+ if ( getPerfStabilityCheck ( ) && sharedPerfState . stableInvocations [ invocationKey ] ) {
695695 break ;
696696 }
697697
@@ -751,9 +751,9 @@ function capturePerf(funcName, lineId, fn, ...args) {
751751 }
752752
753753 // Check stability after accumulating enough samples
754- if ( PERF_STABILITY_CHECK && runtimes . length >= PERF_MIN_LOOPS ) {
754+ if ( getPerfStabilityCheck ( ) && runtimes . length >= getPerfMinLoops ( ) ) {
755755 const window = getStabilityWindow ( ) ;
756- if ( shouldStopStability ( runtimes , window , PERF_MIN_LOOPS ) ) {
756+ if ( shouldStopStability ( runtimes , window , getPerfMinLoops ( ) ) ) {
757757 sharedPerfState . stableInvocations [ invocationKey ] = true ;
758758 break ;
759759 }
@@ -817,15 +817,15 @@ async function _capturePerfAsync(
817817 }
818818
819819 // Check if this invocation has already reached stability
820- if ( PERF_STABILITY_CHECK && sharedPerfState . stableInvocations [ invocationKey ] ) {
820+ if ( getPerfStabilityCheck ( ) && sharedPerfState . stableInvocations [ invocationKey ] ) {
821821 break ;
822822 }
823823
824824 // Get the global loop index for this invocation
825825 const loopIndex = getInvocationLoopIndex ( invocationKey ) ;
826826
827827 // Check if we've exceeded max loops
828- if ( loopIndex > PERF_LOOP_COUNT ) {
828+ if ( loopIndex > getPerfLoopCount ( ) ) {
829829 break ;
830830 }
831831
@@ -851,9 +851,9 @@ async function _capturePerfAsync(
851851 }
852852
853853 // Check stability
854- if ( PERF_STABILITY_CHECK && runtimes . length >= PERF_MIN_LOOPS ) {
854+ if ( getPerfStabilityCheck ( ) && runtimes . length >= getPerfMinLoops ( ) ) {
855855 const window = getStabilityWindow ( ) ;
856- if ( shouldStopStability ( runtimes , window , PERF_MIN_LOOPS ) ) {
856+ if ( shouldStopStability ( runtimes , window , getPerfMinLoops ( ) ) ) {
857857 sharedPerfState . stableInvocations [ invocationKey ] = true ;
858858 break ;
859859 }
0 commit comments