mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
[~] Performance optimizations around Attachment[] and Launchable[] arrays
AIMNAS with its ~50K elements in Attachment[] suffered of performance drop when MOLLE stuff is in the visible inventory. To resolve it the following is done: * Introduce gMAXATTACHMENTS_READ with actual number of elements in Attachment[]; according refactoring. * Introduce gMAXLAUNCHABLES_READ with actual number of elements in Launchable[]; according refactoring. * Introduce std::multimap AttachmentBackmap for quick access to attachments using itemId as a key. * Sort Attachment[] by attachmentIndex right after loading from XML. According order in XML is not needed anymore. * Introduce FindAttachmentRange() for quick access to attachments using attachmentId as a key (binary search in Attachment[]). In a few words, GetHelpTextForItemInLaptop(), ValidAttachment(), SetAttachmentSlotsFlag() were heavily optimized.
This commit is contained in:
@@ -19,6 +19,8 @@ struct
|
||||
}
|
||||
typedef launchableParseData;
|
||||
|
||||
UINT32 gMAXLAUNCHABLES_READ = 0;
|
||||
|
||||
static void XMLCALL
|
||||
launchableStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
@@ -168,9 +170,9 @@ BOOLEAN ReadInLaunchableStats(STR fileName)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gMAXLAUNCHABLES_READ = pData.curIndex + 1;
|
||||
|
||||
MemFree(lpcBuffer);
|
||||
|
||||
|
||||
XML_ParserFree(parser);
|
||||
|
||||
return( TRUE );
|
||||
|
||||
Reference in New Issue
Block a user