@@ -505,6 +505,11 @@ class RampController extends Controller {
505505 var nextTierComplexity = Math . max ( Math . round ( Math . pow ( 10 , this . _tier ) ) , currentComplexity + 1 ) ;
506506 stage . tune ( nextTierComplexity - currentComplexity ) ;
507507
508+ // If the next tier complexity couldn't be set, we've reached the maximum capacity for the test
509+ if ( stage . complexity ( ) != nextTierComplexity ) {
510+ this . _maximumStageComplexity = stage . complexity ( ) ;
511+ }
512+
508513 // Some tests may be unable to go beyond a certain capacity. If so, don't keep moving up tiers
509514 if ( stage . complexity ( ) - currentComplexity > 0 || nextTierComplexity == 1 ) {
510515 this . _tierStartTimestamp = timestamp ;
@@ -536,6 +541,12 @@ class RampController extends Controller {
536541 // If the browser is capable of handling the most complex version of the test, use that
537542 this . _maximumComplexity = currentComplexity ;
538543 }
544+
545+ if ( this . _maximumStageComplexity ) {
546+ // If we reached the maximum stage complexity, set the maximum such
547+ // that the stage complexity is in the middle of the ramp.
548+ this . _maximumComplexity = Math . round ( this . _maximumStageComplexity * 1.25 ) ;
549+ }
539550
540551 this . _possibleMaximumComplexity = this . _maximumComplexity ;
541552
@@ -632,6 +643,12 @@ class RampController extends Controller {
632643 this . _maximumComplexity = Math . max ( Math . round ( .8 * this . _maximumComplexity ) , this . _minimumComplexity + 5 ) ;
633644 }
634645
646+ if ( this . _maximumStageComplexity ) {
647+ // If we reached the maximum stage complexity, set the maximum such
648+ // that the stage complexity is in the middle of the ramp.
649+ this . _maximumComplexity = Math . min ( Math . round ( this . _maximumStageComplexity * 1.25 ) , this . _maximumComplexity ) ;
650+ }
651+
635652 // Next ramp
636653 stage . tune ( this . _maximumComplexity - stage . complexity ( ) ) ;
637654 this . _rampDidWarmup = false ;
0 commit comments