protobuf-go/reflect/protoreflect
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
..
proto_test.go
proto.go reflect/protoreflect: improve package documentation 2019-08-20 18:44:49 +00:00
source.go reflect/protoreflect: add FileDescriptor.SourceLocations 2019-07-13 00:15:59 +00:00
type.go reflect/protoreflect: improve package documentation 2019-08-20 18:44:49 +00:00
value_pure.go all: change module to google.golang.org/protobuf 2019-05-14 17:28:29 +00:00
value_test.go
value_union.go reflect/protoreflect: add non-allocating Value constructors 2019-08-26 17:48:05 +00:00
value_unsafe.go all: change module to google.golang.org/protobuf 2019-05-14 17:28:29 +00:00
value.go all: refactor extensions, add proto.GetExtension etc. 2019-08-08 18:20:51 +00:00