protobuf-go/internal/impl/merge_gen.go

210 lines
4.5 KiB
Go
Raw Normal View History

proto, runtime/protoiface, internal/impl: add fast-path Merge Comparing -tags=protoreflect to fast-path: name old time/op new time/op delta pkg:google.golang.org/protobuf/internal/benchmarks goos:linux goarch:amd64 /Clone/google_message1_proto2-12 1.70µs ± 1% 0.30µs ± 1% -82.64% (p=0.001 n=7+7) /Clone/google_message1_proto3-12 1.01µs ± 1% 0.19µs ± 1% -80.77% (p=0.000 n=7+8) /Clone/google_message2-12 818µs ± 8% 141µs ± 6% -82.78% (p=0.000 n=8+8) pkg:google.golang.org/protobuf/internal/benchmarks/micro goos:linux goarch:amd64 EmptyMessage/Clone-12 51.1ns ± 1% 39.3ns ± 3% -23.03% (p=0.000 n=7+8) RepeatedInt32/Clone-12 24.5µs ± 1% 1.1µs ± 3% -95.64% (p=0.000 n=8+8) Required/Clone-12 978ns ± 1% 132ns ± 2% -86.46% (p=0.000 n=8+8) name old alloc/op new alloc/op delta pkg:google.golang.org/protobuf/internal/benchmarks goos:linux goarch:amd64 /Clone/google_message1_proto2-12 1.08kB ± 0% 0.74kB ± 0% -31.85% (p=0.000 n=8+8) /Clone/google_message1_proto3-12 872B ± 0% 544B ± 0% -37.61% (p=0.000 n=8+8) /Clone/google_message2-12 602kB ± 0% 411kB ± 0% -31.65% (p=0.000 n=8+8) pkg:google.golang.org/protobuf/internal/benchmarks/micro goos:linux goarch:amd64 EmptyMessage/Clone-12 96.0B ± 0% 64.0B ± 0% -33.33% (p=0.000 n=8+8) RepeatedInt32/Clone-12 25.4kB ± 0% 3.2kB ± 0% -87.33% (p=0.000 n=8+8) Required/Clone-12 416B ± 0% 256B ± 0% -38.46% (p=0.000 n=8+8) name old allocs/op new allocs/op delta pkg:google.golang.org/protobuf/internal/benchmarks goos:linux goarch:amd64 /Clone/google_message1_proto2-12 52.0 ± 0% 21.0 ± 0% -59.62% (p=0.000 n=8+8) /Clone/google_message1_proto3-12 33.0 ± 0% 3.0 ± 0% -90.91% (p=0.000 n=8+8) /Clone/google_message2-12 22.3k ± 0% 7.5k ± 0% -66.41% (p=0.000 n=8+8) pkg:google.golang.org/protobuf/internal/benchmarks/micro goos:linux goarch:amd64 EmptyMessage/Clone-12 3.00 ± 0% 2.00 ± 0% -33.33% (p=0.000 n=8+8) RepeatedInt32/Clone-12 1.51k ± 0% 0.00k ± 0% -99.80% (p=0.000 n=8+8) Required/Clone-12 51.0 ± 0% 18.0 ± 0% -64.71% (p=0.000 n=8+8) Change-Id: Ife9018097c34cb025dc9c4fdd9a61b2f947853c6 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/219147 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2020-02-11 19:25:16 +00:00
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
proto, runtime/protoiface, internal/impl: add fast-path Merge Comparing -tags=protoreflect to fast-path: name old time/op new time/op delta pkg:google.golang.org/protobuf/internal/benchmarks goos:linux goarch:amd64 /Clone/google_message1_proto2-12 1.70µs ± 1% 0.30µs ± 1% -82.64% (p=0.001 n=7+7) /Clone/google_message1_proto3-12 1.01µs ± 1% 0.19µs ± 1% -80.77% (p=0.000 n=7+8) /Clone/google_message2-12 818µs ± 8% 141µs ± 6% -82.78% (p=0.000 n=8+8) pkg:google.golang.org/protobuf/internal/benchmarks/micro goos:linux goarch:amd64 EmptyMessage/Clone-12 51.1ns ± 1% 39.3ns ± 3% -23.03% (p=0.000 n=7+8) RepeatedInt32/Clone-12 24.5µs ± 1% 1.1µs ± 3% -95.64% (p=0.000 n=8+8) Required/Clone-12 978ns ± 1% 132ns ± 2% -86.46% (p=0.000 n=8+8) name old alloc/op new alloc/op delta pkg:google.golang.org/protobuf/internal/benchmarks goos:linux goarch:amd64 /Clone/google_message1_proto2-12 1.08kB ± 0% 0.74kB ± 0% -31.85% (p=0.000 n=8+8) /Clone/google_message1_proto3-12 872B ± 0% 544B ± 0% -37.61% (p=0.000 n=8+8) /Clone/google_message2-12 602kB ± 0% 411kB ± 0% -31.65% (p=0.000 n=8+8) pkg:google.golang.org/protobuf/internal/benchmarks/micro goos:linux goarch:amd64 EmptyMessage/Clone-12 96.0B ± 0% 64.0B ± 0% -33.33% (p=0.000 n=8+8) RepeatedInt32/Clone-12 25.4kB ± 0% 3.2kB ± 0% -87.33% (p=0.000 n=8+8) Required/Clone-12 416B ± 0% 256B ± 0% -38.46% (p=0.000 n=8+8) name old allocs/op new allocs/op delta pkg:google.golang.org/protobuf/internal/benchmarks goos:linux goarch:amd64 /Clone/google_message1_proto2-12 52.0 ± 0% 21.0 ± 0% -59.62% (p=0.000 n=8+8) /Clone/google_message1_proto3-12 33.0 ± 0% 3.0 ± 0% -90.91% (p=0.000 n=8+8) /Clone/google_message2-12 22.3k ± 0% 7.5k ± 0% -66.41% (p=0.000 n=8+8) pkg:google.golang.org/protobuf/internal/benchmarks/micro goos:linux goarch:amd64 EmptyMessage/Clone-12 3.00 ± 0% 2.00 ± 0% -33.33% (p=0.000 n=8+8) RepeatedInt32/Clone-12 1.51k ± 0% 0.00k ± 0% -99.80% (p=0.000 n=8+8) Required/Clone-12 51.0 ± 0% 18.0 ± 0% -64.71% (p=0.000 n=8+8) Change-Id: Ife9018097c34cb025dc9c4fdd9a61b2f947853c6 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/219147 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2020-02-11 19:25:16 +00:00
// license that can be found in the LICENSE file.
// Code generated by generate-types. DO NOT EDIT.
package impl
import ()
func mergeBool(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
*dst.Bool() = *src.Bool()
}
func mergeBoolNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
v := *src.Bool()
if v != false {
*dst.Bool() = v
}
}
func mergeBoolPtr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
p := *src.BoolPtr()
if p != nil {
v := *p
*dst.BoolPtr() = &v
}
}
func mergeBoolSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
ds := dst.BoolSlice()
ss := src.BoolSlice()
*ds = append(*ds, *ss...)
}
func mergeInt32(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
*dst.Int32() = *src.Int32()
}
func mergeInt32NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
v := *src.Int32()
if v != 0 {
*dst.Int32() = v
}
}
func mergeInt32Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
p := *src.Int32Ptr()
if p != nil {
v := *p
*dst.Int32Ptr() = &v
}
}
func mergeInt32Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
ds := dst.Int32Slice()
ss := src.Int32Slice()
*ds = append(*ds, *ss...)
}
func mergeUint32(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
*dst.Uint32() = *src.Uint32()
}
func mergeUint32NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
v := *src.Uint32()
if v != 0 {
*dst.Uint32() = v
}
}
func mergeUint32Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
p := *src.Uint32Ptr()
if p != nil {
v := *p
*dst.Uint32Ptr() = &v
}
}
func mergeUint32Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
ds := dst.Uint32Slice()
ss := src.Uint32Slice()
*ds = append(*ds, *ss...)
}
func mergeInt64(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
*dst.Int64() = *src.Int64()
}
func mergeInt64NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
v := *src.Int64()
if v != 0 {
*dst.Int64() = v
}
}
func mergeInt64Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
p := *src.Int64Ptr()
if p != nil {
v := *p
*dst.Int64Ptr() = &v
}
}
func mergeInt64Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
ds := dst.Int64Slice()
ss := src.Int64Slice()
*ds = append(*ds, *ss...)
}
func mergeUint64(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
*dst.Uint64() = *src.Uint64()
}
func mergeUint64NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
v := *src.Uint64()
if v != 0 {
*dst.Uint64() = v
}
}
func mergeUint64Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
p := *src.Uint64Ptr()
if p != nil {
v := *p
*dst.Uint64Ptr() = &v
}
}
func mergeUint64Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
ds := dst.Uint64Slice()
ss := src.Uint64Slice()
*ds = append(*ds, *ss...)
}
func mergeFloat32(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
*dst.Float32() = *src.Float32()
}
func mergeFloat32NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
v := *src.Float32()
if v != 0 {
*dst.Float32() = v
}
}
func mergeFloat32Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
p := *src.Float32Ptr()
if p != nil {
v := *p
*dst.Float32Ptr() = &v
}
}
func mergeFloat32Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
ds := dst.Float32Slice()
ss := src.Float32Slice()
*ds = append(*ds, *ss...)
}
func mergeFloat64(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
*dst.Float64() = *src.Float64()
}
func mergeFloat64NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
v := *src.Float64()
if v != 0 {
*dst.Float64() = v
}
}
func mergeFloat64Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
p := *src.Float64Ptr()
if p != nil {
v := *p
*dst.Float64Ptr() = &v
}
}
func mergeFloat64Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
ds := dst.Float64Slice()
ss := src.Float64Slice()
*ds = append(*ds, *ss...)
}
func mergeString(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
*dst.String() = *src.String()
}
func mergeStringNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
v := *src.String()
if v != "" {
*dst.String() = v
}
}
func mergeStringPtr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
p := *src.StringPtr()
if p != nil {
v := *p
*dst.StringPtr() = &v
}
}
func mergeStringSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
ds := dst.StringSlice()
ss := src.StringSlice()
*ds = append(*ds, *ss...)
}