perf: specialize spawn_fold serving path - #7
Merged
Merged
Conversation
Give spawn_fold a dedicated serving path that handles Tell directly and treats Unit asks as FIFO receipts, removing the generic query callback and state/reply tuple from the dominant tell-oriented actor shape. Mark the command handler local for MoonBit parameter inlining.
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.
Why
spawn_foldis the dominant tell-oriented actor shape, but it currently delegates to the fully generic command/query loop withQuery = UnitandReply = Unit. Every receipt ask therefore still flows through the generic query callback and tuple-return path.What changed
spawn_foldits own loop and serving path;Tell(cmd)directly through the command handler;Ask(())as a FIFO receipt without invoking a generic query callback or constructing a(State, Reply)pair;Measured result
On the same GitHub runner host (
runnervmlun5p), AMD EPYC 9V74, same MoonBit toolchain:All repository tests passed in the experimental benchmark run.
Compiler note
I also tested propagating
#locals(on_cmd)one level outward ontofuwaroid_loop_fold. MoonBit rejects that with E4163 (This parameter is expected to be local, but it escapes) because the handler is captured by thehandle_cancellationasync closure. The locality hint therefore remains on the innermostfuwaroid_serve_fold, where it is valid and benchmarked.