Skip to content

perf: tighten smithy serde hot paths (1/3) - #359

Draft
jterapin wants to merge 1 commit into
mainfrom
serde-opt/1-serde
Draft

perf: tighten smithy serde hot paths (1/3)#359
jterapin wants to merge 1 commit into
mainfrom
serde-opt/1-serde

Conversation

@jterapin

@jterapin jterapin commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Part 1 of 3 splitting #358.

Summary

Consolidates JSON, XML, and CBOR serde optimizations plus the smithy-schema extension helpers they share.

Changes

  • Cache list/map member and wire-name lookups on hot paths
  • Reuse Builder and Parser instances within codecs
  • Avoid coercion and helper indirection in union/structure handling
  • Align JSON and CBOR parser lookups with schema metadata
  • Honor protocol default timestamp behavior across serde
  • Lazily buffer XML parser text chunks; cache flattened trait lookups
  • Move sparse? and related helpers from ExtensionHelpers into Extension
  • Focus serde specs on behavior

Benchmarks

Paired V3-vs-V4 serde runs on graviton and intel: ~26% faster than V3 at the median, zero regressions on either architecture.

Per-protocol delta vs V3 (graviton, all rows are wins):

protocol worst median best
awsJson1_0 -9.4% -22.0% -79.9%
restJson1 -24.4% -46.3% -63.7%
restXml -25.0% -44.5% -59.2%
awsQuery -12.6% -27.9% -38.9%
rpcv2Cbor -2.2% -16.7% -58.2%

Stack

Validation

  • bundle exec rspec per gem: smithy-schema (161), smithy-json (78), smithy-xml (67), smithy-cbor (265), smithy-client (897, 2 pending). All pass.

Consolidates the JSON, XML, and CBOR serde optimizations plus the
smithy-schema extension helpers they share.

- Cache list/map member and wire-name lookups on hot paths
- Reuse Builder and Parser instances within codecs
- Avoid coercion and helper indirection in union/structure handling
- Align JSON and CBOR parser lookups with schema metadata
- Honor protocol default timestamp behavior across serde
- Lazily buffer XML parser text chunks; cache flattened trait lookups
- Move sparse? and related helpers from ExtensionHelpers into Extension
- Focus serde specs on behavior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant