proto: make use of fast-path initialization checks

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 <thebrokentoaster@gmail.com>
This commit is contained in:
Damien Neil 2020-01-29 14:39:00 -08:00
parent 0ae1c9789a
commit ca6f40c880

View File

@ -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)