Spoiler
BattleManager.increaseAtbGauges will be run per frame as long as the ATB can be updated:
//Increases the ATB gauges when idle:
BattleManager.increaseAtbGauges = function() {
var loopForInstantATB = instant_atb;
var oneATBFilledAlready = false;
//================================================
//ATB LOOP
//We need to be in a loop here if we're using instant ATB option, but run only once in other cases.
//================================================
do
{
//==========================================
//Turn Timer
//==========================================
turn_atb += CalculateATBRate(turn_timer);
//Turn timer finished:
if (turn_atb >= full_atb)
{
turn_atb -= full_atb;
//We advance the troops page (for events and AI) depending on parameter:
if (battle_event_turn_mode === 0)
{
$gameTroop.increaseTurn();
}
//We apply onTurnEnd if paramaters are set so
if (battler_end_turn_effects !== 1)
{
this.allBattleMembers().forEach(function(battler)
{
battler.onTurnEnd();
this.refreshStatus();
this._logWindow.displayAutoAffectedStatus(battler);
this._logWindow.displayRegeneration(battler);
}, this);
}
}
//========================================
//End of turn timer related stuff
//========================================
this.allBattleMembers().forEach(function(battler)
{
//States with ATB duration:
battler._states_atb_duration.forEach(function(duration, stateID)
{
battler._states_atb_current[stateID] += CalculateATBRate(battler._states_atb_rate[stateID], 100);
if (battler._states_atb_current[stateID] >= duration)
{
battler.removeState(stateID);
}
}, this);
//Dead battler has no ATB nor cast:
if (battler.isDead())
{
battler.atb = 0;
battler.resetCast();
}
//====================
//Casting time logic:
//====================
//Cast finished:
else if (battler.finished_casting === true)
{
battler.resetCast();
}
//Currently casting:
else if (battler.target_cast_atb > 0)
{
//Got stunned or similar while casting, auto-interrupt for now:
if (!battler.canMove())
{
battler.BreakCurrentCast(true);
}
else
{
battler.current_cast_atb += battler._cast_rate * (battler.CastHaste() / 100);
if (battler.current_cast_atb >= battler.target_cast_atb && oneATBFilledAlready === false)
{
battler.finished_casting = true;
this.battlerHasFullAtb(battler, true);
oneATBFilledAlready = true;
loopForInstantATB = 0;
}
}
}
//===================
//Not casting, ATB INCREASE:
//===================
else
{
battler.atb += battler.calculateATBRate();
}
if (battler.atb >= full_atb && oneATBFilledAlready === false && battler.target_cast_atb <= 0)
{
this.battlerHasFullAtb(battler);
oneATBFilledAlready = true;
loopForInstantATB = 0;
}
}, this);
} while (loopForInstantATB === 1);
//==============================
//END OF THE ATB LOOP
//=============================
this.refreshStatus();
};
It's crystal clear and obvious that the whole status window's redrawn per BattleManager.increaseAtbGauges, which can be run per frame.
Except for extremely powerful machines, redrawing the whole status window per frame is extremely likely to lead to at least significant, if not just outright severe, constant lag and FPS drop.
In my machine(i7-3820 + 2 * 2GB DDR3-1333 + Asus GTX550Ti), redrawing the whole status window per frame led to about 12ms added load per frame even after I've updated the display card driver to the latest version leading to about 100% RMMV performance boost. For machines barely meeting the RMMV requirements, the added load can only be more.
I've benchmarked the time performance of this plugin in my machine and the final load per frame is 15ms with status window being redrawn per frame, which is just 2ms away from the final load per frame leading to detectable FPS drop. It's because the targeted FPS in RMMV is 60, which is under 17ms load per frame. For machines barely meeting the RMMV requirements, the final load of this plugin without redrawing the status window per frame will likely reach or even far exceed 17ms, leading to at least noticeable FPS drop.
Actually, just redrawing all actors' ATB bars will suffice. Even though it'll lead to the ATB bar description text being slightly ugly, it's still trivial compared to be much more serious performance issues.
The other parts of the status window will only need to be redrawn when at least 1 actor's refreshed. If the existing entry points for redrawing the whole status window, including BattleManager.refreshStatus and Scene_Battle.prototype.refreshStatus might be not enough, Game_Battler.prototype.refresh can be used as well to ensure all reasons of redrawing the whole status window are completed covered.
2 exceptions of this are that, when the maximum ATB bar length decreases and/or the ATB bar description text changes, the whole status window will have to be redrawn, otherwise the newly drawn ATB bars wouldn't completely cover the old one, and/or thenew text would just be drawn over the old ones, which would still remain drawn on the status window.
While more can be done when optimizing time performance here(like only redrawing an actor ATB bar when its maximum length increases, its colors change and/or its fill percent changes, which can lead to only 1ms added load per frame per actor ATB bar to be redrawn in my machine), the above performance optimization alone should make this plugin much more performant.