Skip to content

Optimize generated Jackson deserialization - #3029

Open
schlosna wants to merge 3 commits into
developfrom
davids/serDe
Open

Optimize generated Jackson deserialization#3029
schlosna wants to merge 3 commits into
developfrom
davids/serDe

Conversation

@schlosna

Copy link
Copy Markdown
Contributor

Summary

  • Add repository guidance for coding agents and Java stream conventions.
  • Generate a type-first union deserialization fast path with mapper-local, lazy, thread-safe wrapper deserializer caching.
  • Use prefix-only buffering for out-of-order union discriminators and a single discriminator switch.
  • Populate generated builder maps directly during Jackson deserialization and declare Jackson Core dependencies explicitly.
  • Regenerate the integration input fixtures.

Performance

Midpoints from two JVM forks with seven measured trials per fork:

Scenario Baseline ns/op Final ns/op Baseline B/op Final B/op
Union, type first 508 314 1,552 1,076
Union, out of order 492 489 1,552 1,576
Sealed union, type first 446 319 1,536 1,040
101-variant union, type first 480 328 1,552 1,056
101-variant union, out of order 510 517 1,552 1,640
32-entry map 3,019 2,474 8,224 6,552

Cold reader creation plus first read for the 101-variant union improved from about 490 microseconds and 134 KB to 300 microseconds and 22 KB. Serialization allocation remained unchanged; timing did not show a consistent shift.

The generated 101-variant deserializer decreased from 26,191 to 21,214 bytes compared with the initial reviewed implementation.

Testing

  • ./gradlew :conjure-java-core:test
  • ./gradlew build -x :conjure-java-server-verifier:test

The server verifier test is excluded because the local native verifier requires unavailable libssl.so.1.1.

@changelog-app

changelog-app Bot commented Aug 21, 2026

Copy link
Copy Markdown

Generate changelog in changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

Optimize generated Jackson deserialization

Check the box to generate changelog(s)

  • Generate changelog entry

@schlosna schlosna changed the title Optimize generated Jackson serialization Optimize generated Jackson deserialization Aug 21, 2026
@changelog-app

changelog-app Bot commented Aug 21, 2026

Copy link
Copy Markdown

Successfully generated changelog entry!

Need to regenerate?

Simply interact with the changelog bot comment again to regenerate these entries.


📋Changelog Preview

💡 Improvements

  • Optimize generated Jackson deserialization (#3029)

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