mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- Bugfix: Encountered save somewhere that took a long time to load a sector. The problem was something like over 1400 items in a cell in the sector. I just changed the reallocation strategy to grow by 3/2 of current size rather than fixed 10 because the number of memcopy decrease significantly at risk of allocating a larger than needed array (13 resizes vs 140 resizes). That code had other problems but this helped quite a bit (by tazpn)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4671 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -378,7 +378,8 @@ INT32 GetFreeWorldItemIndex( void )
|
||||
}
|
||||
|
||||
uiOldNumWorldItems = guiNumWorldItems;
|
||||
guiNumWorldItems += 10;
|
||||
// grow by 3/2 as a better strategy, minimum 10
|
||||
guiNumWorldItems = max(10, guiNumWorldItems * 3 / 2);
|
||||
//Allocate new table with max+10 items.
|
||||
newWorldItems = new WORLDITEM [ guiNumWorldItems ];
|
||||
if (newWorldItems == NULL)
|
||||
|
||||
Reference in New Issue
Block a user