-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
codec: optimize decoding for ZeroCopy mode and use mode for benchmarks
NewDecoderBytes with ZeroCopy=true will return []byte and string that point into the input []byte. This reduces allocation and improves performance, in both codecgen and normal mode, showing ~ 50% reduction in allocation. To support this, we track decByteState after during each call to DecodeBytes or DecodeStringAsByte. Folks that care can check the value right after the call. We also optimized json decoding, so we can return a view into the input []byte if possible, instead of always doing a copy. Helper functions were added to make it easy to get a string value from a []byte with optimization e.g. zerocopy, interning, etc. We now run benchmarks by default with ZeroCopy=true.
- Loading branch information
Showing
24 changed files
with
621 additions
and
438 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
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
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
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
Oops, something went wrong.