Skip to content

Reduce Cortex placement work - #191

Open
genixpro wants to merge 3 commits into
masterfrom
codex/optimize-cortex-save-writes
Open

Reduce Cortex placement work#191
genixpro wants to merge 3 commits into
masterfrom
codex/optimize-cortex-save-writes

Conversation

@genixpro

@genixpro genixpro commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Cortex placement scans repeatedly traverse the building array and recompute inn clearance for every candidate tile. This change snapshots live building positions, upgrade reservations, and inn occupancy once per placement search, then reuses them for candidate checks.

Scan order, scoring, RNG calls, observation cadence, and corner/wrap behavior are preserved. The snapshot is local to one search and needs no cross-tick invalidation.

Performance and validation

  • Eight-team Playground on integration revision c71373bb: 119.77 s → 84.19 s with Cortex alone, about 30% less elapsed time; instructions 2.098T → 1.526T. Replay, initial save, and final autosave are byte-identical.
  • Single-run observations, with some concurrent build activity; see docs/cortex-placement-performance.md for scope and caveats.
  • Standalone Cortex patch on master: complete SmallForTwo replay matches the original byte for byte.
  • Optimized client rebuild and 57,600 geometry comparisons pass; the harness is added to Linux CI.

This PR contains only Cortex placement optimization and its tests/documentation. Save buffering is a separate, independent PR. Both target master; unpublished Maxima integration commits are excluded.

@genixpro genixpro changed the title Reduce Cortex placement work and batch save writes Reduce Cortex placement work Sep 7, 2026
@genixpro
genixpro requested a review from kylelutze September 8, 2026 01:33
@genixpro
genixpro marked this pull request as ready for review September 8, 2026 13:53
…ex-save-writes-rebase

# Conflicts:
#	.github/workflows/build.yml
#	src/SConscript
#	test/README.md
@genixpro
genixpro requested a review from Giszmo September 10, 2026 23:10
@genixpro

Copy link
Copy Markdown
Contributor Author

Rebased onto current master (e3a01b051) via e2268715c to clear the conflict. Three files conflicted, all append/append (an independent new CI step and SConscript test target, and two independent doc sections in test/README.md); kept both additions in each case. The actual production changes (CortexPlacementGeo.{h,cpp}, CortexPlacementCandidates.cpp) and the new geometry harness applied cleanly with no changes needed.

Verified locally before pushing:

  • scons -j8 release=1 server=0 cortex-geometry-test builds clean on this head.
  • ./build/src/CortexGeometryHarness passes: 57,600 candidate comparisons against the tile-scan helpers.

CI is running on e2268715c. This has had zero reviews so far; requesting a look from @Giszmo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant