lagging for Enigma Virtual Box packed project when checking save files

I created a folder www/save to put all the save files, while packing all the other files into the exe.


But I do notice that checking save files is making the game to lag (fps drops below ~10).


I am using 100 save files, reducing the # makes the lag less severe.


Not sure if other people have noticed this. Will there be a solution for this?


This does not happen if I don't pack all files into single exe.


Also there is no description in the manual of how to treat the save files. I guess they have to be outside the exe pack.


PS: if someone uses plugin for better visualization of title (like animated title). The update function in Scene_Title may be calling a piece of code to check if save file exists. This will cause the fps to drop below 10fps if you pack the game. I moved the check save file code to the start function in Scene_Title and it fixed the problem (because save file is not being constantly checked). This again makes me think the loading of save files is causing the game to lag when it is packed as an exe.


after tracking down the code I suspect this function is causing the lag because it checks the existence of all save files, maybe there is a way to cut down the files it looks after (like only the save files in view)?

Code:
DataManager.loadGlobalInfo = function() {
    var json;
    try {
        json = StorageManager.load(0);
    } catch (e) {
        console.error(e);
        return [];
    }
    if (json) {
        var globalInfo = JSON.parse(json);
        for (var i = 1; i <= this.maxSavefiles(); i++) {
            if (!StorageManager.exists(i)) {
                delete globalInfo[i];
            }
        }
        return globalInfo;
    } else {
        return [];
    }
};
worked out one simply solution: only check if save file exists and update global save file at start.


if anyone sees any potential issue please let me know, thanks!

Code:
//optimize loading, reduce file checking
DataManager.loadGlobalInfo = function() {
    var json;
    try {
        json = StorageManager.load(0);
    } catch (e) {
        console.error(e);
        return [];
    }
    if (json) {
        var globalInfo = JSON.parse(json);
     //   for (var i = 1; i <= this.maxSavefiles(); i++) {
    //        if (!StorageManager.exists(i)) {
    //            delete globalInfo[i];
    //        }
   //     }
        return globalInfo;
    } else {
        return [];
    }
};

//new function to remove bad saves only load at creation
DataManager.checkGlobalInfo = function() {
    var json;
    try {
        json = StorageManager.load(0);
    } catch (e) {
        console.error(e);
        return [];
    }
    if (json) {
        var globalInfo = JSON.parse(json);
        for (var i = 1; i <= this.maxSavefiles(); i++) {
            if (!StorageManager.exists(i)) {
                delete globalInfo[i];
            }
        }
        return globalInfo;
    } else {
        return [];
    }
};
//only check global save at start
Scene_File.prototype.start = function() {
    Scene_MenuBase.prototype.start.call(this);
	DataManager.checkGlobalInfo();
    this._listWindow.refresh();
};
This needs more attention, and should be implemented into the actual core engine. Speeds up things a lot.

I'm trying to find out how to speed up the visualization of the actual saves now.

Thanks so much for finding this fix!

Original thread: https://forums.rpgmakerweb.com/threads/lagging-for-enigma-virtual-box-packed-project-when-checking-save-files.72349/