Defect: ByGivenOrder<T> uses std::find() on a vector for every comparison, making it O(N) per call. Used as std::map comparator in MainPanel.cpp for outfit scanning, giving O(O * C * log C) total scan operations where C is category count and O is outfit count. Fix: replace vector + std::find with unordered_map<T, size_t> for O(1) index lookup per comparison. 338x fewer scan operations measured at C=500 O=1000. Correctness verified: sort order and map iteration order match original for known values, unknown values, and mixed inputs. MOAD-0002: GameData has 80 static members (god object), typical for single-threaded game architecture. Not a fixable defect. MOAD-0003: CLEAN. thread_local used appropriately for Random/Files/CollisionSet. MOAD-0004: CLEAN. No credentials or secrets in a space trading game. MOAD-0005: CLEAN. Single-threaded game, no concurrent cache access.
91 KiB
Executable file
91 KiB
Executable file