forked from golang/glog
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce memory allocations during message quoting
Optimization is accomplished by preallocating a fixed-size buffer and using strconv.AppendQuote instead of always dynamically allocating memory in strconv.Quote. make([]byte, 0, 1024) doesn't escape to heap at least in Go 1.19 and 1.23 Signed-off-by: Alexandr Stefurishin <alexandr.stefurishin@flant.com>
- Loading branch information
Alexandr Stefurishin
committed
Oct 17, 2024
1 parent
5496965
commit a1604b5
Showing
3 changed files
with
20 additions
and
8 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