forked from aws/aws-sdk-go-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pre-allocate response body using Content-Length (aws#1565)
Updates SDK API client deserialization to pre-allocate byte slice and string response payloads. This saves us allocations when the response body is greater than 512 bytes. For large responses, like multi-megabyte Lambda Invoke responses, this can be a very significant number of allocations and slice copies because ioutil.ReadAll / io.ReadAll start with 512 bytes and follow append's growth rules: * https://cs.opensource.google/go/go/+/refs/tags/go1.17.6:src/io/io.go;drc=dc289d3dcb59f80b9e23c7e8f237628359d21d92;l=627 * https://cs.opensource.google/go/go/%20/master:src/runtime/slice.go;l=166?q=growslice S3 GetBucketPolicy benchmark: name old time/op new time/op delta GetBucketPolicy-12 12.7ms ± 2% 8.7ms ± 2% -31.60% (p=0.000 n=9+9) name old alloc/op new alloc/op delta GetBucketPolicy-12 83.4MB ± 0% 50.4MB ± 0% -39.60% (p=0.000 n=10+10) name old allocs/op new allocs/op delta GetBucketPolicy-12 256 ± 0% 216 ± 0% -15.49% (p=0.000 n=10+10) Schemas GetCodeBindingSource benchmarks: name old time/op new time/op delta GetCodeBindingSource-12 10.8ms ± 3% 7.4ms ± 4% -31.79% (p=0.000 n=10+10) name old alloc/op new alloc/op delta GetCodeBindingSource-12 70.8MB ± 0% 37.8MB ± 0% -46.64% (p=0.000 n=10+10) name old allocs/op new allocs/op delta GetCodeBindingSource-12 241 ± 0% 200 ± 0% -17.01% (p=0.000 n=10+10) * Add changelog Co-authored-by: Jason Del Ponte <[email protected]>
- Loading branch information
1 parent
bac80ad
commit feeedfd
Showing
25 changed files
with
658 additions
and
224 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"id": "183e085d-88ad-4366-9b69-7fde5cbf7cc5", | ||
"type": "bugfix", | ||
"collapse": true, | ||
"description": "Updates SDK API client deserialization to pre-allocate byte slice and string response payloads, [#1565](https://github.com/aws/aws-sdk-go-v2/pull/1565). Thanks to [Tyson Mote](https://github.com/tysonmote) for submitting this PR.", | ||
"modules": [ | ||
"internal/protocoltest/awsrestjson", | ||
"internal/protocoltest/restxml", | ||
"service/apigateway", | ||
"service/apigatewayv2", | ||
"service/appconfig", | ||
"service/appconfigdata", | ||
"service/appsync", | ||
"service/cloudfront", | ||
"service/codeartifact", | ||
"service/codeguruprofiler", | ||
"service/dataexchange", | ||
"service/ebs", | ||
"service/glacier", | ||
"service/internal/benchmark", | ||
"service/iotdataplane", | ||
"service/kinesisvideoarchivedmedia", | ||
"service/kinesisvideomedia", | ||
"service/lakeformation", | ||
"service/lambda", | ||
"service/lexruntimeservice", | ||
"service/lexruntimev2", | ||
"service/location", | ||
"service/medialive", | ||
"service/mediastoredata", | ||
"service/polly", | ||
"service/s3", | ||
"service/sagemakerruntime", | ||
"service/schemas", | ||
"service/workmailmessageflow" | ||
] | ||
} |
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.