I got increasingly frustrated with the fact that SugarCube passage navigation got increasingly slower as the size of the state history got larger.
Much of if is due to the compression of session data, which is necessary because of the size limits of localStorage and sessionStorage. (5 MB each)
So I decided to implement IndexedDB which has a size limit of 10GiB (Firefox) / 60% of total disk size (Chromium)
I also removed a few unnecessary clone() calls when
Before my changes, with 10k test objects, passage navigation took over 2sec, over 1.5sec of which was from compressing session state.
With my changes passage navigation is now under 100ms.
Any feedback is welcome.
NOTE: you will have to export your saves before using my SugarCube mod.
Much of if is due to the compression of session data, which is necessary because of the size limits of localStorage and sessionStorage. (5 MB each)
So I decided to implement IndexedDB which has a size limit of 10GiB (Firefox) / 60% of total disk size (Chromium)
I also removed a few unnecessary clone() calls when
Config.history.maxStates == 1 to further speed things up.Before my changes, with 10k test objects, passage navigation took over 2sec, over 1.5sec of which was from compressing session state.
With my changes passage navigation is now under 100ms.
Any feedback is welcome.
NOTE: you will have to export your saves before using my SugarCube mod.