aws-sdk-java-v2 icon indicating copy to clipboard operation
aws-sdk-java-v2 copied to clipboard

RPCv2 performance improvements.

Open sugmanue opened this issue 1 year ago • 1 comments

Motivation and Context

Adds some performance improvements changes to improve the RPCv2 protocol, including:

Allow reading numbers without parsing

CBOR encodes numbers that are faster to read from its encoded form than converting them to strings and then parsing them back. For that we changed 1) the way we parse to return embedded objects when appropriate, and, 2) the way we unmarshall to support numbers as embedded objects, we also changed the way Instant is unmarshalled as in CBOR that's done as a number.

Faster lookups for unmarshallers

We keep a map in AbstractMarshallingRegistry to register different

. This map is used heavily during unmarshalling to find which unmarshall to use for each value.

to store, keyed on MarshallngType, to register unmarshallers for different types, however the types that we care about are static and known at compile time, this allow us to make an optimization, add an enum key to each of the known MarshallngType that we care about and index those using this enum to use EnumMap that has better performance than regular maps, and, fallback to use a regular map for the marshalling types that are not know.

Modifications

to find the unmarshaller for the given type, and, on Trait.class to find traits stored in the SdkField instances. To improve the performance of both we rely on the fact that both classes have a known set of static values that we care about,

Testing

Screenshots (if appropriate)

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)

Checklist

  • [ ] I have read the CONTRIBUTING document
  • [ ] Local run of mvn install succeeds
  • [ ] My code follows the code style of this project
  • [ ] My change requires a change to the Javadoc documentation
  • [ ] I have updated the Javadoc documentation accordingly
  • [ ] I have added tests to cover my changes
  • [ ] All new and existing tests passed
  • [ ] I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • [ ] My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • [ ] I confirm that this pull request can be released under the Apache 2 license

sugmanue avatar Aug 26 '24 16:08 sugmanue

Quality Gate Failed Quality Gate failed

Failed conditions
50.1% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

sonarqubecloud[bot] avatar Aug 27 '24 17:08 sonarqubecloud[bot]