Kodera_optimization: it still work?

Hello!
I was looking at the code for this plugin that was made in 2016.

https://forums.rpgmakerweb.com/inde...ne-optimizations-for-mobile-deployment.70783/

It is a small code that has mostly:
Code:
Something.prototype.update

See below:
Spoiler: Code
Code:
//=============================================================================
// KODERA_optimization.js
//=============================================================================

/*:
 * @plugindesc 1.0.3 Speed up core RPG Maker engine
 * @author Mariusz 'koder' Chwalba
 *
 * @help This plugin exchanges various elements of core RPG Maker engine with
 * quicker counterparts. No functionality is lost or gained.
 *
 * It improves FPS (most visible on mobile platforms and netbooks) and reduces
 * battery life.
 *
 * Plugin is FREE to use in both FREE and COMMERCIAL products. No guarantee,
 * implied or otherwise, is given. Attribution required in reasonable place
 * (credits).
 */
(function () {

    Sprite.prototype.update = function () {
        var l = this.children.length;
        for (var i = 0; i < l; i++) {
            var child = this.children[i];
            if (child && child.update) {
                child.update();
            }
        };
    };
    Tilemap.prototype.update = function () {
        this.animationCount++;
        this.animationFrame = Math.floor(this.animationCount / 30);
        var l = this.children.length;
        for (var i = 0; i < l; i++) {
            var child = this.children[i];
            if (child && child.update) {
                child.update();
            }
        }
        for (var i = 0; i < this.bitmaps.length; i++) {
            if (this.bitmaps[i]) {
                this.bitmaps[i].touch();
            }
        }
    };
    TilingSprite.prototype.update = function () {
        var l = this.children.length;
        for (var i = 0; i < l; i++) {
            var child = this.children[i];
            if (child && child.update) {
                child.update();
            }
        }
    };
    Window.prototype.update = function () {
        if (this.active) {
            this._animationCount++;
        }
        var l = this.children.length;
        for (var i = 0; i < l; i++) {
            var child = this.children[i];
            if (child && child.update) {
                child.update();
            }
        }
    };
    WindowLayer.prototype.update = function () {
        var l = this.children.length;
        for (var i = 0; i < l; i++) {
            var child = this.children[i];
            if (child && child.update) {
                child.update();
            }
        }
    };
    Weather.prototype._updateAllSprites = function () {
        var maxSprites = Math.floor(this.power * 10);
        while (this._sprites.length < maxSprites) {
            this._addSprite();
        }
        while (this._sprites.length > maxSprites) {
            this._removeSprite();
        }
        var l = this._sprites.length;
        for (var i = 0; i < l; i++) {
            var sprite = this._sprites[i];
            this._updateSprite(sprite);
            sprite.x = sprite.ax - this.origin.x;
            sprite.y = sprite.ay - this.origin.y;
        }
    };
    Scene_Base.prototype.updateChildren = function () {
        var i;
        var l = this.children.length;
        for (i = 0; i < l; i++) {
            var child = this.children[i];
            if (child.update) {
                child.update();
            }
        }
    };

    Scene_ItemBase.prototype.applyItem = function () {
        var action = new Game_Action(this.user());
        action.setItemObject(this.item());
        var repeats = action.numRepeats();
        var ita = this.itemTargetActors();
        for (var i = 0; i < ita.length; i++) {
            var target = ita[i];
            for (var ix = 0; ix < repeats; ix++) {
                action.apply(target);
            }
        };
        action.applyGlobal();
    };
    Sprite_Animation.prototype.updateFrame = function () {
        if (this._duration > 0) {
            var frameIndex = this.currentFrameIndex();
            this.updateAllCellSprites(this._animation.frames[frameIndex]);
            for (var i = 0; i < this._animation.timings.length; i++) {
                var timing = this._animation.timings[i];
                if (timing.frame === frameIndex) {
                    this.processTimingData(timing);
                }
            };
        }
    };
    Spriteset_Map.prototype.createCharacters = function () {
        this._characterSprites = [];
        var events = $gameMap.events()
        for (var i = 0; i < events.length; i++) {
            var event = events[i];
            this._characterSprites.push(new Sprite_Character(event));
        }
        var vehicles = $gameMap.vehicles();
        for (var i = 0; i < vehicles.length; i++) {
            var vehicle = vehicles[i];
            this._characterSprites.push(new Sprite_Character(vehicle));
        };
        var followers = $gamePlayer.followers()._data;
        for (var i = followers.length - 1; i >= 0; i--) {
            var follower = followers[i];
            this._characterSprites.push(new Sprite_Character(follower));
        }
        this._characterSprites.push(new Sprite_Character($gamePlayer));
        for (var i = 0; i < this._characterSprites.length; i++) {
            this._tilemap.addChild(this._characterSprites[i]);
        }
    };

})();

I would like to know through more experienced people if with the new updates that the RM MV had during that time made this plugin obsolete to the point of making no difference.

I use many plugins and until then it had no compatibility issues.

But looking at the code, what do you guys think? Does it still have any relevance or not?
Ehhhh performance is always tough to measure. There's really no "one size fits all" fix for performance, because if there were, the MV devs would've done it already. The only real way to track where performance is suffering is to run a proper profile to see where things are slow. There's a famous quote, "Premature optimization is the root of all evil".

The author reports a 500% improvement in combat animations, but then you read the improvement is from 1fps to 5fps. That's really not a reliable measure.

Looking at the code itself, some of the "optimizations" are dubious. Take for example the line:
Code:
var l = this.children.length;
Many people think that "caching" the length of an array before looping through it is an improvement to avoid "calculating" the length of the array. That's simply not true, the length isn't calculated, it's just a property of the array object and has a constant time complexity to access.

The rest of the code seems to be changing the "forEach" loops to simple "for" loops. It's certainly true that regular "for" loops are faster, but this is generally only noticeable for large arrays (thousands of elements).

The last thing to consider is the device used by the author to test, Samsung Galaxy S3 which is 7 years old now and was 4 years old at the time of that post. That, combined with the fact that newer versions of browsers have improved JIT compilers for JS that will automatically optimize much of this anyway makes me doubt the performance improvements that were reported.

However, the only way to know for sure is to test for yourself. It's possible that doing something like updating to a newer version of PIXI would have more of an impact that using a script like this.

Original thread: https://forums.rpgmakerweb.com/threads/kodera_optimization-it-still-work.106622/