Add get_erased helper to reduce get/touch monomorphization#50
Merged
fasterthanlime merged 1 commit intomainfrom Jan 26, 2026
Merged
Add get_erased helper to reduce get/touch monomorphization#50fasterthanlime merged 1 commit intomainfrom
fasterthanlime merged 1 commit intomainfrom
Conversation
- Add get_erased() to DerivedCore that returns BoxFuture<ArcAny>, moving
the async block out of the generic DerivedIngredient::get method
- Update DerivedIngredient::get to use get_erased, reducing the async
state machine size in the generic wrapper
- Update DerivedIngredient::touch to use touch_erased (already existed)
Expected savings:
- get::{{closure}}: 21k × 50 copies → much smaller wrapper + one copy per DB
- touch: now delegates to existing touch_erased helper
Part of #49
There was a problem hiding this comment.
Pull request overview
Reduces code bloat from monomorphization in the derived ingredient query path by moving more async state-machine logic into type-erased helpers on DerivedCore.
Changes:
- Added
DerivedCore::get_erased()returningBoxFuture<PicanteResult<ArcAny>>to avoid a larger generic async block inDerivedIngredient::get. - Updated
DerivedIngredient::getto delegate toget_erasedand downcast at the boundary. - Updated
DerivedIngredient::touchto delegate to the existingtouch_erasedhelper.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Follow-up to PRs #47 and #48, addressing more monomorphization opportunities identified in #49.
get_erased()toDerivedCorethat returnsBoxFuture<ArcAny>, moving the async block out of the genericDerivedIngredient::getmethodDerivedIngredient::getto useget_erased, reducing the async state machine size in the generic wrapperDerivedIngredient::touchto use the existingtouch_erasedhelperExpected savings
Based on the analysis in #49:
get::{{closure}}: 21k × 50 copies → much smaller wrapper + one copy per DB typeThe remaining high-impact items are:
TypedCompute::compute::{{closure}}(14k × 60) - This is unavoidable as it calls the user's compute function with concrete typesfacet_postcard- Would need reflection-based serializationTest plan
Part of #49