protobuf-go/internal
Damien Neil 79571e90e2 internal/impl: improve extension fast path performance
Stash fast-path information for extensions on the ExtensionInfo. In
the usual case where an ExtensionType's underlying implementation is
an *ExtensionInfo, fetching the fast-path information becomes a type
assertion rather than a mutex-guarded map access.

Maintain a global sync.Map for the case where an ExtensionType isn't an
*ExtensionInfo.

Substantially improves performance for fast-path operations on
extensions:

Encode/MessageSet_type_id_before_message_content-12      267ns ± 1%   185ns ± 1%  -30.44%  (p=0.001 n=7+7)
Encode/basic_scalar_types_(*test.TestAllExtensions)-12  1.94µs ± 1%  0.40µs ± 1%  -79.32%  (p=0.000 n=8+7)

Change-Id: If048b521deb3665a090ea3d0a178c61691d4201e
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/210540
Reviewed-by: Joe Tsai <joetsai@google.com>
2019-12-09 18:59:42 +00:00
..
cmd proto: consistently use non-nil, zero-length []bytes for empty bytes strings 2019-12-09 17:33:50 +00:00
conformance encoding/prototext: add MarshalOptions.EmitUnknown 2019-09-17 02:56:29 +00:00
descfmt internal: improve use of detrand in descfmt and errors 2019-09-09 18:30:00 +00:00
descopts
detrand internal: improve use of detrand in descfmt and errors 2019-09-09 18:30:00 +00:00
encoding all: don't allow invalid field numbers when legacy support is on 2019-12-09 18:35:13 +00:00
errors internal: improve use of detrand in descfmt and errors 2019-09-09 18:30:00 +00:00
fieldnum
fieldsort proto, internal/impl: make wire output more consistent with v1 2019-11-12 20:59:03 +00:00
filedesc internal/filedesc: move message options to L1 initialization 2019-11-08 00:29:25 +00:00
filetype reflect/protoregistry: add (*Types).Register{Message,Enum,Extension} 2019-10-31 16:23:42 +00:00
flags
fuzz reflect/protoreflect: remove nullability from repeated extension fields 2019-11-05 18:31:30 +00:00
impl internal/impl: improve extension fast path performance 2019-12-09 18:59:42 +00:00
mapsort internal/mapsort: use explicit kind for strings 2019-09-05 22:07:15 +00:00
pragma
protolegacy reflect/protoregistry: add (*Types).Register{Message,Enum,Extension} 2019-10-31 16:23:42 +00:00
set
strs
testprotos all: don't allow invalid field numbers when legacy support is on 2019-12-09 18:35:13 +00:00