Optimize XML Codec#1231
Open
adwsingh wants to merge 1 commit into
Open
Conversation
28c7b19 to
ca55468
Compare
ca55468 to
5900a1d
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What behavior changes?
Builder.useNative(true)or-Dsmithy-java.xml-provider=smithy. StAX remains default.codec-commonsmodule with sharedNumberCodec,TimestampCodec, andStripedPool. JSON/XML and Query codecs now use these instead of inlined copies.QueryFormSerializerrewritten with inline byte buffer +StripedPool, replacingFormUrlEncodedSink.Why is this change needed?
Performance. StAX imposes per-element overhead from stream state machines and String allocations. The native codec does byte-level parsing/writing inline with pre-computed element name bytes and speculative in-order member lookup.
How was this validated?
DifferentialXmlFuzzTest— native vs StAX reference produce identical output on fuzz inputsGeneratedModelSerdeTest— all Smithy types through code-generated shapes, parameterized over both providersNumberCodecTest,TimestampCodecTest, and their fuzz counterpartsBenchmark Results
Summary
restXml
awsQuery — Deserialization (XML response parsing)
awsQuery — Serialization (form-urlencoded request)
awsJson1.0
restJson1
rpcv2Cbor
What should reviewers focus on?
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.