-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API Marshaling: Add generated marshalers for RESTXML protocol #1409
Conversation
e9910f6
to
1c53899
Compare
134c5ca
to
d5b167a
Compare
d5b167a
to
f6ff120
Compare
private/model/api/passes.go
Outdated
@@ -61,6 +61,16 @@ func (a *API) resolveReferences() { | |||
o.ErrorRefs[i].Shape.IsError = true | |||
} | |||
} | |||
|
|||
// TODO put this somewhere better |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this TODO still valid? Or are we going to put this somewhere else later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah no I'll remove that
} | ||
if context.IsRefPayloadReader(refName, ref) { | ||
if strings.HasSuffix(context.ShapeName, "Output") { | ||
return "// Skipping " + refName + " Output type's body not valid." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer fmt.Sprintf
here
// Will panic if error. | ||
func MarshalShapeRefGoCode(refName string, ref *ShapeRef, context *Shape) string { | ||
if ref.XMLAttribute { | ||
return "// Skipping " + refName + " XML Attribute." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Sprintf
here
|
||
switch mRef.Location() { | ||
case "StatusCode": | ||
return "// ignoring invalid encode state, StatusCode. " + refName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
This change is the start of an iterative set of changes that will replace the SDK's current reflection base protocol marshalers with generated code for each API type. This works starts with the RESTXML protocol's encoders. The following benchmarks show a significant improvement of execution speed and reduced memory usage. Benchmarks of RESTXML build and full request lifecycle between master and this change. benchmark old ns/op new ns/op delta BenchmarkRESTXMLBuild_Complex_CFCreateDistro-8 264834 59891 -77.39% BenchmarkRESTXMLBuild_Simple_CFDeleteDistro-8 9666 5894 -39.02% BenchmarkRESTXMLBuild_REST_S3HeadObject-8 19723 7340 -62.78% BenchmarkRESTXMLBuild_XML_S3PutObjectAcl-8 44739 15656 -65.01% BenchmarkRESTXMLRequest_Complex_CFCreateDistro-8 586238 292755 -50.06% BenchmarkRESTXMLRequest_Simple_CFDeleteDistro-8 168954 158484 -6.20% BenchmarkRESTXMLRequest_REST_S3HeadObject-8 228720 199964 -12.57% BenchmarkRESTXMLRequest_XML_S3PutObjectAcl-8 253821 206911 -18.48% benchmark old allocs new allocs delta BenchmarkRESTXMLBuild_Complex_CFCreateDistro-8 1332 478 -64.11% BenchmarkRESTXMLBuild_Simple_CFDeleteDistro-8 63 44 -30.16% BenchmarkRESTXMLBuild_REST_S3HeadObject-8 134 57 -57.46% BenchmarkRESTXMLBuild_XML_S3PutObjectAcl-8 247 113 -54.25% BenchmarkRESTXMLRequest_Complex_CFCreateDistro-8 1641 786 -52.10% BenchmarkRESTXMLRequest_Simple_CFDeleteDistro-8 230 211 -8.26% BenchmarkRESTXMLRequest_REST_S3HeadObject-8 443 366 -17.38% BenchmarkRESTXMLRequest_XML_S3PutObjectAcl-8 466 331 -28.97% benchmark old bytes new bytes delta BenchmarkRESTXMLBuild_Complex_CFCreateDistro-8 87893 27936 -68.22% BenchmarkRESTXMLBuild_Simple_CFDeleteDistro-8 8104 7880 -2.76% BenchmarkRESTXMLBuild_REST_S3HeadObject-8 9544 8800 -7.80% BenchmarkRESTXMLBuild_XML_S3PutObjectAcl-8 17701 11704 -33.88% BenchmarkRESTXMLRequest_Complex_CFCreateDistro-8 141892 80852 -43.02% BenchmarkRESTXMLRequest_Simple_CFDeleteDistro-8 52773 52543 -0.44% BenchmarkRESTXMLRequest_REST_S3HeadObject-8 61947 61193 -1.22% BenchmarkRESTXMLRequest_XML_S3PutObjectAcl-8 70800 64671 -8.66%
…n slice instead of string.
f6ff120
to
9be458e
Compare
* Revert "API Marshaler: Add generated marshalers for RESTJSON protocol (#1547)" This reverts commit 1a10a10. Reverts RESTJSON marshaler improvement due to bug in RESTXML * Revert "API Marshaling: Add generated marshalers for RESTXML protocol (#1409)" This reverts commit 37448a9. Reverts RESTXML due to #1550
This change is the start of an iterative set of changes that will
replace the SDK's current reflection base protocol marshalers with
generated code for each API type.
This works starts with the RESTXML protocol's encoders. The following
benchmarks show a significant improvement of execution speed and reduced
memory usage.
Benchmarks of RESTXML build and full request lifecycle between master and this change.
Build
benchmarks focus on just the marshaling of the request's input parameters.Request
benchmarks provide a view of the impact of the changes in context to a full request lifecycle. Does not include network latency, nor umarshaling of a response object.Work in progress PR: