Skip to content

Wire createX() factory methods to the mapper's converter layer instead of builder methods - #7384

Merged
RanVaknin merged 2 commits into
feature/master/DDB-mapperv2from
rvaknin/wire-createX-methods-into-converter-layer
Sep 21, 2026
Merged

RanVaknin merged 2 commits into
feature/master/DDB-mapperv2from
rvaknin/wire-createX-methods-into-converter-layer

Conversation

@RanVaknin

@RanVaknin RanVaknin commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Context

#7039 code generated new factory methods that create AttributeValues directly and avoid allocations that the Builder pattern adds. in #7073 we wired these new factory methods into the Enhanced client. This PR wires the same thing just for the Mapper

Changes

This PR does 2 things:

  1. swap builder() with factory methods - one file change in StandardModelFactories.java. This is the layer that creates the AV for the converters engine (the @deprecated Marshaller layer is untouched)
  2. wiring in mapper v2 into the existing DDB JMH harness.

Testing

Since we knew about this optimization ahead of time, adequate testing was added early on to catch potential regressions.

Write direction (convert):

  • StandardModelFactoriesTest (68 tests)
  • StandardModelFactoriesV1Test (18), StandardModelFactoriesV2CompatibleTest (20), StandardModelFactoriesV2Test (21) — same assertions across all three conversion schemas
  • StandardModelFactoriesEdgeCasesTest (14) — null/empty-string/empty-set branches (createNul)

Read direction (unconvert):

  • StandardModelFactoriesV2UnconvertTest (21)
  • shape/ShapeResponseTest — parameterized golden-master; reconstructs POJOs from canned attribute maps against unmarshall_item_fixture.json
  • shape/ShapeResponseBehaviorTest (6)

Custom converter interaction:

  • ConversionToAttributeValuesTest

Per-type round-trip integration (save + load):

  • mapper/V2CompatibleBooleansTest (24) — BOOL and boolean-as-N
  • mapper/SimpleStringAttributesIntegrationTest (6) — S
  • mapper/SimpleNumericAttributesIntegrationTest (6) — N
  • mapper/BinaryAttributesIntegrationTest (5) — B
  • mapper/StringSetAttributesIntegrationTest (4) — SS
  • mapper/NumericSetAttributesIntegrationTest (3) — NS
  • mapper/EmptyBinarySetByteBufferAttributesTest (3) — BS + empty-set edge

Every createX factory wired in this PR (createS, createN, createB, createSs, createNs, createBs, createBool, createL, createM, createNul) has at least one test asserting its output above.

Performance

Operation Payload Baseline ops/s Candidate ops/s Throughput Baseline B/op Candidate B/op Allocation
DELETE HUGE 3,414,517 3,588,195 +5.09% 640 592 -7.50%
DELETE HUGE_FLAT 3,351,349 3,767,951 +12.43% 672 592 -11.90%
DELETE SMALL 3,399,646 3,616,885 +6.39% 656 592 -9.76%
DELETE TINY 3,404,190 3,936,064 +15.62% 640 592 -7.50%
GET HUGE 141,655 144,273 +1.85% 10,096 9,968 -1.27%
GET HUGE_FLAT 173,222 173,752 +0.31% 2,720 2,624 -3.53%
GET SMALL 1,068,911 1,232,606 +15.31% 1,016 888 -12.60%
GET TINY 1,713,863 2,105,325 +22.84% 752 632 -15.96%
PUT HUGE 66,105 92,423 +39.81% 29,392 17,868 -39.21%
PUT HUGE_FLAT 79,497 93,424 +17.52% 19,592 17,536 -10.49%
PUT SMALL 798,939 1,056,863 +32.28% 2,432 1,856 -23.68%
PUT TINY 1,821,874 2,077,679 +14.04% 1,172 1,088 -7.17%
QUERY HUGE 47,015 46,985 -0.06% 30,184 30,056 -0.42%
QUERY HUGE_FLAT 56,857 56,800 -0.10% 7,528 7,432 -1.28%
QUERY SMALL 409,822 410,429 +0.15% 2,952 2,912 -1.36%
QUERY TINY 706,615 732,691 +3.69% 2,232 2,184 -2.15%
SCAN HUGE 49,117 49,172 +0.11% 28,880 28,880 -0.00%
SCAN HUGE_FLAT 63,920 57,731 -9.68% 6,224 6,224 +0.00%
SCAN SMALL 559,194 532,875 -4.71% 1,736 1,736 +0.00%
SCAN TINY 1,186,133 1,183,984 -0.18% 1,120 1,120 +0.00%
UPDATE HUGE 59,941 85,869 +43.26% 30,304 18,784 -38.01%
UPDATE HUGE_FLAT 47,935 58,259 +21.54% 26,664 20,616 -22.68%
UPDATE SMALL 552,477 682,228 +23.49% 3,160 2,592 -17.97%
UPDATE TINY 1,216,015 1,322,968 +8.80% 1,576 1,448 -8.12%

@RanVaknin
RanVaknin requested a review from a team as a code owner September 17, 2026 23:02
@RanVaknin RanVaknin changed the title Wire createX to the mapper converter layer instead of builder Wire createX() factory methods to the mapper's converter layer instead of builder methods Sep 17, 2026
@RanVaknin RanVaknin added the perf-improvement Label for PRs that contain performance improvement changes. label Sep 18, 2026
@RanVaknin
RanVaknin merged commit 4637f0c into feature/master/DDB-mapperv2 Sep 21, 2026
7 of 8 checks passed
@github-actions

Copy link
Copy Markdown

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

perf-improvement Label for PRs that contain performance improvement changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants