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>
diff --git a/proto/decode.go b/proto/decode.go
index e1177b8..2e2ce8d 100644
--- a/proto/decode.go
+++ b/proto/decode.go
@@ -99,7 +99,7 @@
if err != nil {
return out, err
}
- if allowPartial {
+ if allowPartial || out.Initialized {
return out, nil
}
return out, isInitialized(m)