Commit graph

2 commits

Author SHA1 Message Date
2a0a635c74 undf: assign 1013-1039; stamp patches (samba/juicefs/ipfs-cluster/nfs/rclone/lotus/speed-dreams/seaweedfs wave) 2026-03-31 13:27:38 -04:00
c4154e0590 freeciv-0001: assign_continent_flood() tile_list_search O(T^2), 53x
BFS flood fill in server/generator/mapgen_utils.c uses tile_list_search()
(O(N) linked-list scan) as visited check per adjacent tile. On a continent
of T tiles, each tile's 4-8 neighbors each trigger a linear scan of our
growing worklist, making total complexity O(T * adj * T) = O(T^2).

Fix: set tile_continent() at enqueue time instead of dequeue time. Our
continent field itself becomes our visited set, replacing O(N) membership
checks with O(1) integer comparisons. Worklist is now a pure FIFO queue.

Measured: 53x overhead at T=25,600 tiles (160x160 map).
Standard large Freeciv maps have continents of 5,000-20,000+ tiles.

MOAD 0002 (Intertangle): Freeciv uses struct civ_game as global god object,
  expected for a single-threaded C game from 1996. Not a practical defect.
MOAD 0003 (Leaked Context): CLEAN. Thread-local only in bundled tinycthread
  dependency. Tex AI uses proper mutexes.
MOAD 0004 (Logged Secret): CLEAN. auth.c logs rejection messages with
  usernames only, never passwords or credentials.
MOAD 0005 (Thundering Herd): CLEAN. AI settler cache uses hash lookup,
  single-threaded game loop has no concurrent cache races.
2026-03-31 12:27:02 -04:00