Context
During the review of PR #1561, a discussion arose regarding the parameter passing strategy for callbacks in the codebase.
Currently, most of the codebase passes callbacks by value. The PR initially used rvalue references (auto&&) for callback parameters, which offers potential benefits:
- Increased flexibility: Allows callbacks to be not just lambdas, but also objects that hold stateful values
- Efficiency: Using rvalue references allows passing objects into the call and using them later without unnecessary copies
Proposal
Evaluate whether it would be beneficial to update the codebase to consistently use rvalue references for callback parameters instead of pass-by-value.
References
Requested by: @LinZhihao-723
Context
During the review of PR #1561, a discussion arose regarding the parameter passing strategy for callbacks in the codebase.
Currently, most of the codebase passes callbacks by value. The PR initially used rvalue references (
auto&&) for callback parameters, which offers potential benefits:Proposal
Evaluate whether it would be beneficial to update the codebase to consistently use rvalue references for callback parameters instead of pass-by-value.
References
EncodedTextAstimplementation that usesStringBlobto reduce allocation overhead. #1561 (comment)EncodedTextAstimplementation that usesStringBlobto reduce allocation overhead. #1561Requested by: @LinZhihao-723