Repository navigation
Add generated message fast-paths for JSON well-known types. - #2358
Merged
Merged
Conversation
copybara-service
Bot
force-pushed
the
test_996898131
branch
2 times, most recently
from
October 12, 2026 18:47
8b313e3 to
23ef6d6
Compare
`ParsedJsonMapValue`, `ParsedJsonListValue`, and `ParsedJsonValue` previously always accessed `google.protobuf.Struct`, `google.protobuf.ListValue`, and `google.protobuf.Value` via descriptor/reflection lookups (`FindFieldByNumber`, `GetReflection()`, `MapSize`, `LookupMapValue`, `GetRepeatedMessage`, `ListFields`), and `ParsedJsonValue` copied `string_value` onto the evaluation arena even when the `google.protobuf.Value` message was already arena-allocated. Try `proto2::DynamicCastMessage` to the generated `google::protobuf::Struct`, `google::protobuf::ListValue`, and `google::protobuf::Value` types first (falling back to reflection for dynamic messages), and use `StringValue::Wrap` when `value->GetArena() != nullptr` so arena-owned `string_value` strings are borrowed zero-copy. PiperOrigin-RevId: 998080226
copybara-service
Bot
force-pushed
the
test_996898131
branch
from
October 12, 2026 19:24
23ef6d6 to
b5e6a2f
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add generated message fast-paths for JSON well-known types.
ParsedJsonMapValue,ParsedJsonListValue, andParsedJsonValuepreviously always accessedgoogle.protobuf.Struct,google.protobuf.ListValue, andgoogle.protobuf.Valuevia descriptor/reflection lookups (FindFieldByNumber,GetReflection(),MapSize,LookupMapValue,GetRepeatedMessage,ListFields), andParsedJsonValuecopiedstring_valueonto the evaluation arena even when thegoogle.protobuf.Valuemessage was already arena-allocated.Try
proto2::DynamicCastMessageto the generatedgoogle::protobuf::Struct,google::protobuf::ListValue, andgoogle::protobuf::Valuetypes first (falling back to reflection for dynamic messages), and useStringValue::Wrapwhenvalue->GetArena() != nullptrso arena-ownedstring_valuestrings are borrowed zero-copy.