-
Notifications
You must be signed in to change notification settings - Fork 502
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create xdr.EncodingBuffer, which reduces buffer allocations (#4056)
The improvement is considerable. It reduces the allocations (and CPU consumption) by roughly half. ``` goos: darwin goarch: amd64 pkg: github.com/stellar/go/benchmarks cpu: Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz BenchmarkXDRMarshal BenchmarkXDRMarshal-8 1000000 1050 ns/op 1352 B/op 14 allocs/op BenchmarkXDRMarshalWithEncoder BenchmarkXDRMarshalWithEncoder-8 1909111 619.1 ns/op 176 B/op 9 allocs/op BenchmarkGXDRMarshal BenchmarkGXDRMarshal-8 151929 7880 ns/op 2152 B/op 157 allocs/op BenchmarkXDRMarshalHex BenchmarkXDRMarshalHex-8 473662 2199 ns/op 3640 B/op 19 allocs/op BenchmarkXDRMarshalHexWithEncoder BenchmarkXDRMarshalHexWithEncoder-8 846926 1406 ns/op 1072 B/op 10 allocs/op BenchmarkXDRUnsafeMarshalHexWithEncoder BenchmarkXDRUnsafeMarshalHexWithEncoder-8 1000000 1137 ns/op 176 B/op 9 allocs/op BenchmarkXDRMarshalBase64 BenchmarkXDRMarshalBase64-8 555267 1918 ns/op 3000 B/op 19 allocs/op BenchmarkXDRMarshalBase64WithEncoder BenchmarkXDRMarshalBase64WithEncoder-8 998617 1217 ns/op 752 B/op 10 allocs/op BenchmarkXDRUnsafeMarshalBase64WithEncoder BenchmarkXDRUnsafeMarshalBase64WithEncoder-8 1000000 1048 ns/op 176 B/op 9 allocs/op PASS ```
- Loading branch information
Showing
8 changed files
with
207 additions
and
65 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.