You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reduce per-field dispatch and avoid repeated JSONWriter.isUTF8() checks by hoisting the UTF-8 selection once per message and enable faster typed runtime encoding.
Improve runtime-typed encoding for well-known Timestamp and Duration fields by using direct seconds/nanos formatting matching generated encoders and avoid descriptor-based generic WKT dispatch in hot paths.
Add a regression to ensure repeated Timestamp/Duration arrays serialize identically across all encoder paths and record a Java 25 runtime encode/decode baseline to guide further runtime specialization.
Description
Hoist UTF-8 selection into TypedMessageSchema.writeFields and change FieldName.writeTo to accept an isUtf8 boolean so callers pass the chosen form once per message.
Add a boolean utf8 parameter to TypedFieldAccessor.write and update all accessor implementations to use name.writeTo(jw, utf8).
Introduce typed handling for Timestamp/Duration values and collections by adding writeTimestampValue, writeDurationValue, PresenceTimestampAccessor, PresenceDurationAccessor, RepeatedTimestampAccessor, and RepeatedDurationAccessor, and wire them through TypedFieldAccessorFactory via createPresenceMessageAccessor and createRepeatedMessageAccessor.
Ensure safe fallback to generic WellKnownTypes.write for non-standard Message implementations and update a few javadocs/comments related to typed accessors and well-known types.
Add a unit regression repeatedTimestampAndDurationMatchAcrossAllPaths in BuffJsonEncodingRegressionTest and include Java 25 runtime encode/decode baseline artifacts: a measurement report (.md) and CSV results.
Testing
Ran the project unit test suite (mvn test) and the tests completed successfully, including the new repeatedTimestampAndDurationMatchAcrossAllPaths regression.
No new benchmark jobs were executed in CI; the PR includes measured JMH baseline artifacts (docs/performance-results/* and docs/java25-runtime-encode-performance.md) for reference.
Existing automated tests covering protobuf JSON encoding were preserved and passed after the changes.
Throughput alerts are advisory. Existing allocation budgets are enforced separately.
A timing signal needs at least 10% change and separated JMH 99.9% intervals; otherwise it is inconclusive.
Allocation alerts need both >5% and >16 B/op growth (or >16 B/op from zero).
Throughput alerts are advisory. Existing allocation budgets are enforced separately.
A timing signal needs at least 10% change and separated JMH 99.9% intervals; otherwise it is inconclusive.
Allocation alerts need both >5% and >16 B/op growth (or >16 B/op from zero).
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
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.
Motivation
JSONWriter.isUTF8()checks by hoisting the UTF-8 selection once per message and enable faster typed runtime encoding.TimestampandDurationfields by using direct seconds/nanos formatting matching generated encoders and avoid descriptor-based generic WKT dispatch in hot paths.Description
TypedMessageSchema.writeFieldsand changeFieldName.writeToto accept anisUtf8boolean so callers pass the chosen form once per message.utf8parameter toTypedFieldAccessor.writeand update all accessor implementations to usename.writeTo(jw, utf8).Timestamp/Durationvalues and collections by addingwriteTimestampValue,writeDurationValue,PresenceTimestampAccessor,PresenceDurationAccessor,RepeatedTimestampAccessor, andRepeatedDurationAccessor, and wire them throughTypedFieldAccessorFactoryviacreatePresenceMessageAccessorandcreateRepeatedMessageAccessor.WellKnownTypes.writefor non-standardMessageimplementations and update a few javadocs/comments related to typed accessors and well-known types.repeatedTimestampAndDurationMatchAcrossAllPathsinBuffJsonEncodingRegressionTestand include Java 25 runtime encode/decode baseline artifacts: a measurement report (.md) and CSV results.Testing
mvn test) and the tests completed successfully, including the newrepeatedTimestampAndDurationMatchAcrossAllPathsregression.docs/performance-results/*anddocs/java25-runtime-encode-performance.md) for reference.Codex Task