Apply remaining #418 performance optimizations on top of #417#419
Conversation
The bug fixes originally bundled in #418 (falsy value caching in InMemoryCache/InMemoryGroupCache getMany, and reads no longer inserting empty groups into the LRU) already landed via #417, so only the performance and code-quality changes remain: - AbstractFlatCache/AbstractGroupCache: resolve the cache key once and reuse it across getInMemoryOnly/getAsyncOnly/get instead of resolving it multiple times per call - getMany merge appends async results into the in-memory result array in place (it is always freshly allocated) rather than spreading into a new array - Loader/GroupLoader: build cache entries with an explicit loop, merge cached and loaded values with concat (cachedValues may be owned by a user-implemented async cache), and hoist the dataSource local - AbstractRedisCache: precompute keyPrefix; RedisGroupCache: precompute the group index prefix and the per-group entry prefix - unique(): early return for arrays of 0-1 elements Regression tests for the falsy-caching path at the loader level and for the unique() early return are included.
|
Warning Review limit reached
Next review available in: 26 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (12)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Rebases the still-relevant parts of #418 onto current
main, which now includes #417.The two bug fixes #418 originally carried already landed via #417:
InMemoryCache.getMany/InMemoryGroupCache.getManyFromGroup(undefinedcheck instead of a truthy check)InMemoryGroupCachereads no longer inserting empty groups into the LRUSo this keeps only the performance and code-quality changes from #418:
AbstractFlatCache/AbstractGroupCache: resolve the cache key once and reuse it acrossgetInMemoryOnly/getAsyncOnly/get(new private*Resolvedmethods) instead of re-resolving per call. Layered on top of Fix race conditions and correctness issues in caching layers #417's write-back fencing.getManymerge appends async results into the in-memory result array in place (always freshly allocated) instead of spreading into a new array.Loader/GroupLoader: build cache entries with an explicit loop, merge cached and loaded values withconcat(cachedValues may be owned by a user-implemented async cache), hoist thedataSourcelocal.AbstractRedisCache: precomputekeyPrefix.RedisGroupCache: precompute the group index prefix and per-group entry prefix.unique(): early return for arrays of 0-1 elements.Regression tests added: falsy-caching path at the
Loader/GroupLoaderlevel, and theunique()early return.tsc --noEmitis clean and the full suite (330 tests, Redis included) passes. Biome reports only the 8 formatting diagnostics already present onmain; this change adds none.Supersedes #418.