-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid allocating intermediate field builder list. (#245)
During encoding, we used to create a list of builders for the fields of a protobuf message and then make a call to mconcat on the message builder type. But mconcat is recursive and therefore cannot be inlined as such, and GHC seems reluctant to perform beta reduction on known constructors such as (:) across module boundaries. Therefore this commit switches from "mconcat [x, y, z]" to "mappend (mappend x y) z" (for example). These appends are left associativity because the builder writes in reverse, starting with the rightmost field.
- Loading branch information
Showing
2 changed files
with
11 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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