protobuf-go/proto
Damien Neil c5060d2fe6 reflect/protoreflect: add non-allocating Value constructors
Passing a non-pointer type to protoreflect.NewValue causes an
unnecessary allocation in order to store the value in an interface{}.
While this allocation could be avoided by a smarter compiler, no such
compiler exists today.

Add functions for creating new values of a specific type, avoiding the
allocation. (And also adding a small amount of type safety, although
this is unlikely to be important.)

Update the proto and internal/impl packages to use these functions.

Change-Id: Ic733de22ddf19c530189166c853348e1b54b7391
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/191457
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2019-08-26 17:48:05 +00:00
..
bench_test.go
decode_gen.go reflect/protoreflect: add non-allocating Value constructors 2019-08-26 17:48:05 +00:00
decode_test.go proto: add tests for unmarshalling invalid field numbers 2019-08-23 21:35:40 +00:00
decode.go all: refactor extensions, add proto.GetExtension etc. 2019-08-08 18:20:51 +00:00
doc.go
encode_gen.go
encode_test.go internal/impl: treat a nil oneof wrapper as if it were unset 2019-08-16 00:24:53 +00:00
encode.go
equal_test.go proto: equate floating-point NaNs 2019-07-15 21:36:38 +00:00
equal.go proto: equate floating-point NaNs 2019-07-15 21:36:38 +00:00
extension_test.go all: refactor extensions, add proto.GetExtension etc. 2019-08-08 18:20:51 +00:00
extension.go all: refactor extensions, add proto.GetExtension etc. 2019-08-08 18:20:51 +00:00
isinit_test.go
isinit.go
merge_test.go all: unify protoV1.ExtensionDesc and proto.ExtensionType 2019-08-20 21:32:57 +00:00
merge.go
messageset_test.go all: rename tag and flags for legacy support 2019-08-08 20:49:00 +00:00
messageset.go all: rename tag and flags for legacy support 2019-08-08 20:49:00 +00:00
proto_methods.go
proto_reflect.go
proto.go all: remove dead code 2019-08-06 21:16:48 +00:00
reset_test.go internal/impl: treat a nil oneof wrapper as if it were unset 2019-08-16 00:24:53 +00:00
reset.go
size_gen.go
size.go
wrappers.go