michthro wrote:
The problem is that every time a demo is loaded to get info/verify it etc., bDirty is set (ultimately in CDbSavedGame::Update).
...
I think there are a couple of other places where the same bug causes unnecessary delay. This is quite a serious problem, unless you have a very fast computer, I suppose, so please look into this and fix it for the next patch?
Good snooping! Sure, this is important to fix.
It took me a while to find out where the import slowdown was actually coming from (e.g. what is calling Commit so much during import). As you mentioned, I see now that Commit is called every time a new current game is loaded (in CCurrentGame::LoadPrep). I think invoking Commit at this point is improper. Better, I think, to call Commit when an operation completes, not when it starts. If an imporatant transaction completed right before loading a new game, for example, it should have called Commit itself rather than expecting something else to call it. The only proper time for this in DRODLib is when an Import operation successfully completes. So I'm going to yank this Commit call. (I've already tightened up Update calls even more in 3.0.)
This will fix the needless import delay, and it should avoid the delay in other situations where new games are invoked for various reasons.
Another problem I noticed is in CCurrentGame::AddRoomsToPlayerTally(), invoked by all room load calls. This call always calls CDbSavedGame::Update. I'm fixing it as follows:
1) Don't Update here when "
GetAutoSaveOptions() <
= ASO_CHECKPOINT"
(i.e. during a demo load/test or when playtesting).
2) Don't Update if no new rooms are being added to the room tally.
This should fix the first situation you mentioned (needlessly setting the dirty bit). I like this solution better because this tally record shouldn't be updated at all in the above situations and it will fix the Restore and Demo(s) Screen delays.
That's everything I can think of. Any more possible fixes? Send 'em my way!
____________________________
Gandalf? Yes... That's what they used to call me.
Gandalf the Grey. That was my name.
I am Gandalf the White.
And I come back to you now at the turn of the tide.
[Last edited by mrimer at 11-22-2005 02:09 AM]