feat: expose reusable card pools - #5
Merged
nichinichisou0609 merged 1 commit intoAug 29, 2026
Merged
nichinichisou0609 merged 1 commit into
nichinichisou0609 merged 1 commit into
Conversation
A `recommend` call spends most of its time building the candidate pool and only a small fraction searching it, so repeating the same query rebuilds work that has not changed. `build_pool` returns a `PreparedCardPool` holding the candidate set, search context, resolved card details and cultivated cards. Searching it skips construction entirely; `limit` and `timeout_ms` are search-stage only and stay overridable per call. Both entry points share one search-and-materialize path, so results are identical. Measured on a 672-card account (multi/score, 194 candidates): 4549 us for `recommend()` versus 448 us for `pool.recommend()` at the median, about 10x. Pools cost 0.2-0.5 MB each and do not observe later changes to the user data, masterdata or options they were built from, so no cache is built in: the README documents the binding, the memory cost and a caller-owned LRU. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
allium-review-bot
force-pushed
the
feat/reusable-card-pool
branch
from
August 29, 2026 05:56
5df7610 to
c72bb83
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
recommendcall spends most of its time building the candidate pool andonly a small fraction searching it, so repeating the same query rebuilds work
that has not changed. Measured on a 672-card account (multi/score, 194
candidates), the search itself is 130 us while the whole call is 3.7 ms.
build_poolreturns aPreparedCardPoolholding the candidate set, searchcontext, resolved card details and cultivated cards:
limitandtimeout_msare the only options that affect the search stagealone, so they stay overridable per call; everything else is fixed at build
time. Both entry points share one search-and-materialize path, so results are
identical — a test asserts the decks, score, power and bonus all match
recommend().Median 4549 us for
recommend()versus 448 us forpool.recommend(), about10x.
No cache is built in. A pool does not observe later changes to the user data,
masterdata or options it was built from, and costs 0.2-0.5 MB depending on the
account and candidate count, so the bound and the invalidation belong to the
caller. The README documents what a pool is bound to, the measured memory, and
a caller-owned LRU example.
The
testcheck fails on lint rules that a newer ruff enabled across theexisting codebase;
mainreports the same 184 findings, and this branch addsnone.