Jump to content

Potential performance improvements


Recommended Posts

I am looking through the decompiled source, as such I will not see the real code.  But, I notice there are several places that are using List<T> instead of more appropriate data structures, and these would absolutely begin to feel pressure under large colonies.  I would need guidance on how to invoke an actual profiler (unlikely with the release version of the code) to investigate further, but based on my experience optimizing .NET programs, I have some initial feedback that nobody asked for.

Examples:

ChoreTypes::GetByHash -> ChoreTypes are stored in List<T>, and GetByHash is using FindIndex (with a lambda even) to inspect each ChoreType.  This is an O(n^2) operation, and could be improved with a Dictionary<Hash, ChoreType> instead.  This seems to be called frequently as duplicants are choosing their next task.

GlobalCoreProvider::UpdateFetches is using List<T> for all the fetch chores and the candidate chores.  As these are treated as a bag before sorting, the data structure could be HashSet<T> for much faster Add/Remove behavior.  The UpdateFetches -> pathing could be done in parallel, and use bucketed priorities to reduce sort space.

 

As I'm poking through the decompiled sources, I'll update this topic with other suggestions.

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...