Open BlueAmulet opened 2 years ago
Where can I get the source code, so I can try some optimization myself? (New to GIT)
Hey, could you please make a fork or share? PLEASE I BEG YOU I NEED IT SO BAD, i'm malding here.
Related: #90, #94
Performance Issues
FormMain.LoadPackFiles invokes the getter for PackFile.Files multiple times in a loop, consider storing the result of PackFile.Files in a variable first before iterating over it.
LoadPackFiles uses PackFile.Files to build a list for Pack.FileList, but only the "Show Contents" feature, conflict detection, and some unnecessary code uses this FileList, so consider making Pack.FileList lazy loaded and moving the entire routine to the Pack.FileList getter, caching the result there, This dramatically reduces the loading times.
And the unnecessary code, LoadPackFiles uses Pack.FileList to calculate a count of all files in all packs, but then does nothing with it? This should be removed so Pack.FileList can actually be lazy loaded as necessary.
Making these changes locally, I was able reduce the mod manager starting time from several minutes to just 2 seconds.
Cannot change mod priorities after sorting mods
The move mod up/down code needs to make sure lvwColumnSorter.Order is set to None, or any Insert's will effectively be ignored as the ListView will constantly resort the list
Additionally, the move down code should always refocus the ListView regardless of if it moved an item or not.
Cannot read pack files while game is running
The default file sharing mode is to lock the file and prevent other applications from accessing it. This doesn't work if the game already has the files open, so the FileStream in PackFileCodec.Open should be set to FileShare.ReadWrite
Anyway you could share your improved KMM? I still use it for the older TW games but the load times are insane! Thanks!
This sounds like just what the modmanager needs
Related: #90, #94
Performance Issues
FormMain.LoadPackFiles invokes the getter for PackFile.Files multiple times in a loop, consider storing the result of PackFile.Files in a variable first before iterating over it.
LoadPackFiles uses PackFile.Files to build a list for Pack.FileList, but only the "Show Contents" feature, conflict detection, and some unnecessary code uses this FileList, so consider making Pack.FileList lazy loaded and moving the entire routine to the Pack.FileList getter, caching the result there, This dramatically reduces the loading times.
And the unnecessary code, LoadPackFiles uses Pack.FileList to calculate a count of all files in all packs, but then does nothing with it? This should be removed so Pack.FileList can actually be lazy loaded as necessary.
Making these changes locally, I was able reduce the mod manager starting time from several minutes to just 2 seconds.
Cannot change mod priorities after sorting mods
The move mod up/down code needs to make sure lvwColumnSorter.Order is set to None, or any Insert's will effectively be ignored as the ListView will constantly resort the list
Additionally, the move down code should always refocus the ListView regardless of if it moved an item or not.
Cannot read pack files while game is running
The default file sharing mode is to lock the file and prevent other applications from accessing it. This doesn't work if the game already has the files open, so the FileStream in PackFileCodec.Open should be set to FileShare.ReadWrite