From ca6f40c8805ac1ec4c94afccfc99a3f539dbd7f4 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Wed, 29 Jan 2020 14:39:00 -0800 Subject: [PATCH] proto: make use of fast-path initialization checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lost the check for the fast-path's Initialized output somewhere. Put it back in. name old time/op new time/op delta Required/Wire/Unmarshal-12 37.8ns ± 1% 30.5ns ± 1% -19.36% (p=0.000 n=8+8) Change-Id: Ica733366d00efba41023339a2bbd68167ab0df53 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/216897 Reviewed-by: Joe Tsai --- proto/decode.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/decode.go b/proto/decode.go index e1177b82..2e2ce8dd 100644 --- a/proto/decode.go +++ b/proto/decode.go @@ -99,7 +99,7 @@ func (o UnmarshalOptions) unmarshal(b []byte, message Message) (out protoiface.U if err != nil { return out, err } - if allowPartial { + if allowPartial || out.Initialized { return out, nil } return out, isInitialized(m)