Repository navigation
DummyRecycler: one pool for every angle, instant facing, configurable capacity - #529
Conversation
The recycler kept eight angle queues of six and served a get only from the queue nearest the requested angle, while recycle refilled the smallest queue. A map whose casts all ask for one angle therefore had six usable dummies: in a Castle Fight late-game board, peaking at 97 dummies out, the pool created 44 to 107 and removed 59 to 95 units per 10 game seconds while 42 dummies stayed parked in the other queues. One pool now serves every angle, and get snaps the facing with BlzSetUnitFacingEx. A set tracks parked dummies, so isRecycled no longer scans every queue. DUMMY_RECYCLER_CAPACITY (128) and DUMMY_RECYCLER_PRELOAD (48) are configurable. angleQueues is replaced by pool and parkedCount().
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 004b0b2f5d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
HashSet keeps insertion order and shifts its tail on removal; ordered like the queue, it paid that shift on every checkout. A Table-backed HashMap gives constant-time put, has and remove.
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
A boolean array read replaces the hash lookup. Deindexing clears a slot, so a dummy removed while parked leaves no flag for the next unit on its index, and createDummy indexes a dummy that entry did not (a map whose shouldIndex refuses dummies, or the test runner).
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Problem
DummyRecyclerkept eight angle queues of six and served agetonly from the queue nearest the requested angle.recyclerefilled the smallest queue and removed the dummy once all were full. A map whose casts all ask for one angle (every caller in Castle Fight passesangle(0), as doesDummyCaster.prepare) therefore had six usable dummies, while the other 42 stayed parked.Measured in Castle Fight's
late-game-bench(3v3, 600 lane units, ten 12 s windows,DummyPoolProbe): peak demand was 47 to 97 dummies out per window. The pool created 44 to 107 and removed 59 to 95 units per 10 game seconds, and the fewest parked dummies was 42 in every window.Change
getsnaps the facing withBlzSetUnitFacingEx, so a checked-out dummy faces the requested angle at once. Before,setFacingstarted an animated turn from the bucket angle.boolean arraykeyed by unit index marks parked dummies, soisRecycledis one array read. Deindexing clears the slot, so a dummy removed while parked leaves no flag for the next unit on its index.createDummyindexes a dummy that entry did not index (a map whoseshouldIndexrefuses dummies, or the test runner); in game, entry has already indexed it.DummyRecyclernow importsUnitIndexer.@configurableDUMMY_RECYCLER_CAPACITY(128) is the most dummies kept parked, andDUMMY_RECYCLER_PRELOAD(48) is how many init creates, the same count as before. The pool grows to the capacity as dummies come back.angleQueuesarray is replaced bypoolandparkedCount(). Code that readangleQueuesmust switch; Castle Fight has two e2e readers and will port them with the lock bump.reset()gives tests a fresh pool.Evidence
grill typecheck.grill test DummyTests.*: 5/5, including the newanyAngleIsServedFromOnePool.stdlib-ingamethrough the harness canary (wc3-e2e-harness7261918,canary-stdlib.shwith this checkout), Warcraft III Reforged on this machine:caught-errors-4-expected-1, the minimal Jass adapter's caught-error count; the 2026-11-15 Jass run on master (7e7bfb7) shows the same.and faces 180 degrees at once (233.2). The count check passes there because the canary's full queues have a 180-degree entry; pool exhaustion shows only under real load, which is the next item.late-game-benchwith this recycler swapped into its dependency for one run (Lua): creations dropped from 44 to 107 to 1 to 18 per 10 game seconds while the pool grew, then 1 (UnitEntryProbe's own dummy). Removals dropped from 59 to 95 to 1. Peak out was 30 to 82, and the fewest parked settled at 19 to 44. Castle Fightdummy-recycler-integrityruns on the lock bump.