Home » MODDING HQ 1.13 » v1.13 Coding Talk » [FIX] improve loading speed of stash
[FIX] improve loading speed of stash[message #325332] Wed, 18 September 2013 09:59 Go to next message
Moa is currently offline Moa

 
Messages:58
Registered:September 2013
Loading time to show sector stash especially in debugversion whith active debuging is high. In release version you might as well notice a delay whenever you access a stash with several items.
This is caused by multiple file loads to get again and again some countings of active (visible and existing) items and total number of items. In addition the stash is loaded and saved (again with several reads/writes) to update the decay.
Closing stash, saving and loading temporary files when loading a saved had the same problems.

As of today only the loading of the stash has been improved, closing the stash is different kettle of fish.
fixed that.

Toggle Spoiler


EDIT: opening & closing for stash and savegame loading speed improved. >>> LoadingSpeed-saveGameCompatible4.patch <<<

Known issues:
1. Inventory of mercs are repeatedly recalculated under time compression but almost no items decay. This is due to the calling of the recalculation: once in a while the function HandleStrategicTurn() calls indirectly SOLDIER::SoldierInventoryCoolDown(void). It gets called on real time seconds passed and not on game seconds passed.
Therefore I dont think this issue is related to the changes in this patch.
2. Moving items feature assumes that when removing items from one sector to another both sectors have updated items - this is not the case using this patch. But it was also not the case before the changes.
The reason is you could not even check if the sector had been updated correctly.
Toggle Spoiler

There is an issue with the timestamps, this is however not related to the patch (tested 6394 with 6401+patch above).

[Updated on: Sat, 21 September 2013 00:02] by Moderator

Report message to a moderator

Corporal
Re: [WIP] improve loading speed of stash[message #325366] Wed, 18 September 2013 20:39 Go to previous messageGo to next message
pheloncab is currently offline pheloncab

 
Messages:278
Registered:August 2004
Location: So. Cal. or texas
as a non programmer type, I am wondering how much decay is probable in say 6 hours or even 8 hours and if it would be minimal if... maybe setting the the check to only happen at 6 or 8 am, and every 6 or 8 hours after or some such would cut down on the problem by limiting the number of checks per day.

or if thats too little even once an hour or with whatever the assignment time is done.

Report message to a moderator

Master Sergeant
Re: [WIP] improve loading speed of stash[message #325369] Wed, 18 September 2013 20:53 Go to previous messageGo to next message
Flugente

 
Messages:3509
Registered:April 2009
Location: Germany
Decay in unloaded sectors only occurs when loading its inventory. There is no fixed hourly check, as that would be very, very bad (suddenly decaying each of the 1024 sectors is.. not advised). It needs to be done before the player accesses items, otherwise there will be issues (like food never rotting, or guns never cooling down).

Decay in the current sector occurs every turn, which is necessary, as the player can always access it manually by picking up stuff. But this isn't the issue Moa described.

Report message to a moderator

Captain

Re: [WIP] improve loading speed of stash[message #325452] Fri, 20 September 2013 02:28 Go to previous messageGo to next message
Moa is currently offline Moa

 
Messages:58
Registered:September 2013
Update (download in 1st post):
-Improved savegame loading speed slightly: Removed 1 loop and 2 file Reads per existing sector temp file. No messures taken, but its a minor change in relation of the sheer amount of data which needs to be proccessed.
-Closing of stash should now complete in double of the time as before (for 200 items)
-Opening of stash again slightly improved. In relation to before patch it is around 200%-700% faster (depends on your harddisc, OS, ec... and on items in sector. As more items there are the more you will notice an absolute difference)
-added a flag to reduce calls to rendering of bottom panel, which surprisingly constantly accessed the harddrive.



Well turnbased does not matter much, as there is plenty of time to calculate things. But realtime calculation can be also improved:
Update an item when it is picked up and (undo) update once again if it hits the ground. Those actions do not happen that frequently.

I just dont see (yet) any reason here for such a change, tactical runs fine for me. Might be different when using large maps with many structures, objects ec.

Anyways, feel free to test it and report any issues.

Report message to a moderator

Corporal
Re: [WIP] improve loading speed of stash[message #325482] Fri, 20 September 2013 23:46 Go to previous messageGo to next message
Moa is currently offline Moa

 
Messages:58
Registered:September 2013
Another problem which happens regularly after autoresolve is that all items from soldiers/militia get dropped. No problem with this, but the function to add items to unloaded sectors did read from temp file the complete list of existing items, even so the number to add is 0!

So a simple check for 0 items to add in this function speeds up the end of autoresolve by a huge amount (and other things that want to add 0 items to a sector).

Changed the link in the starting post and I consider this to be ready for public testing.

Report message to a moderator

Corporal
Re: [WIP] improve loading speed of stash[message #325484] Sat, 21 September 2013 00:41 Go to previous messageGo to next message
wanne (aka RoWa21) is currently offline wanne (aka RoWa21)

 
Messages:1961
Registered:October 2005
Location: Austria
Do I need to apply both patch files that are listed or only the one after the EDIT statement?
Cause I want to add this to the source trunk.

Report message to a moderator

Sergeant Major

Re: [WIP] improve loading speed of stash[message #325487] Sat, 21 September 2013 03:50 Go to previous messageGo to next message
Moa is currently offline Moa

 
Messages:58
Registered:September 2013
LoadingSpeed-saveGameCompatible4.patch contains all changes.
--
ChangeLog:

improved processing of sector stash (opening/closing)
improved loading speed of save games
improved processing of items droped by militia (most noteable after autoresolve)
and some other code related changes
--


Notes:
removed some functions, still in code so but renamed to *_OLD() because they are from Sirtech and should be kept as I have read in "

Report message to a moderator

Corporal
Re: [WIP] improve loading speed of stash[message #325581] Tue, 24 September 2013 00:38 Go to previous messageGo to next message
wanne (aka RoWa21) is currently offline wanne (aka RoWa21)

 
Messages:1961
Registered:October 2005
Location: Austria
committed

Report message to a moderator

Sergeant Major

Re: [WIP] improve loading speed of stash[message #325676] Wed, 25 September 2013 13:28 Go to previous messageGo to next message
Uriens is currently offline Uriens

 
Messages:346
Registered:July 2006
Wow. This is amazing. I have over 6500 items in my main base and it loaded the sector almost instantly. Just wow.
Thanks for doing this man.

Report message to a moderator

Master Sergeant
Re: [WIP] improve loading speed of stash[message #325932] Sun, 29 September 2013 19:10 Go to previous messageGo to next message
Moa is currently offline Moa

 
Messages:58
Registered:September 2013
Glad to hear it works with more then one page of items.
Sorry for the CTD when loading an empty stash in the original commit. Somehow I just tested sectors with lots of items - stuppid me.

Another issue exists when mouse is over an item the game frequently (100us) renders all items again in order to show compatible items highlighted. Those recalculations dont need to be done since the state does not change: mouse is still over an item, no need to recalc and rerender everything over and over again. Also maybe one noticed that highlighting does not work allways correctly when moving the mouse fast enough or just in a 'bad' time over a different item.

For sector stash it was strait forward, as there is only one function and one mousecallback. Soldier inventory is more complicated as it is called in various routines (at least 5) and mouseCB's (3). So I had to cheat here to reduce the calls without messing in all those functions.

/brief: reduces render calls when mouse over compatible item in stash and soldier inventory (highlighting).
http://www.file-upload.net/download-8126058/MouseOver_Item_in_inventory_performance.patch.html

Toggle Spoiler

Report message to a moderator

Corporal
Re: [WIP] improve loading speed of stash[message #325940] Sun, 29 September 2013 23:05 Go to previous message
wanne (aka RoWa21) is currently offline wanne (aka RoWa21)

 
Messages:1961
Registered:October 2005
Location: Austria
Thanks Moa, I just committed your work

Report message to a moderator

Sergeant Major

Previous Topic: Anyone make a Flash/external version of the New Inventory System?
Next Topic: Create Cyborg IMP(half robot,half human)
Goto Forum:
  


Current Time: Fri Apr 19 22:30:21 GMT+3 2024

Total time taken to generate the page: 0.01093 seconds