2020-06-12 23:04:01 -04:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
// Code generated by github.com/tinylib/msgp DO NOT EDIT.
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/tinylib/msgp/msgp"
|
|
|
|
)
|
|
|
|
|
2021-11-18 15:15:22 -05:00
|
|
|
func TestMarshalUnmarshalxlMetaDataDirDecoder(t *testing.T) {
|
|
|
|
v := xlMetaDataDirDecoder{}
|
2020-06-12 23:04:01 -04:00
|
|
|
bts, err := v.MarshalMsg(nil)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
left, err := v.UnmarshalMsg(bts)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
if len(left) > 0 {
|
|
|
|
t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left)
|
|
|
|
}
|
|
|
|
|
|
|
|
left, err = msgp.Skip(bts)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
if len(left) > 0 {
|
|
|
|
t.Errorf("%d bytes left over after Skip(): %q", len(left), left)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-18 15:15:22 -05:00
|
|
|
func BenchmarkMarshalMsgxlMetaDataDirDecoder(b *testing.B) {
|
|
|
|
v := xlMetaDataDirDecoder{}
|
2020-06-12 23:04:01 -04:00
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
v.MarshalMsg(nil)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-18 15:15:22 -05:00
|
|
|
func BenchmarkAppendMsgxlMetaDataDirDecoder(b *testing.B) {
|
|
|
|
v := xlMetaDataDirDecoder{}
|
2020-06-12 23:04:01 -04:00
|
|
|
bts := make([]byte, 0, v.Msgsize())
|
|
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
|
|
b.SetBytes(int64(len(bts)))
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-18 15:15:22 -05:00
|
|
|
func BenchmarkUnmarshalxlMetaDataDirDecoder(b *testing.B) {
|
|
|
|
v := xlMetaDataDirDecoder{}
|
2020-06-12 23:04:01 -04:00
|
|
|
bts, _ := v.MarshalMsg(nil)
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.SetBytes(int64(len(bts)))
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
_, err := v.UnmarshalMsg(bts)
|
|
|
|
if err != nil {
|
|
|
|
b.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-18 15:15:22 -05:00
|
|
|
func TestEncodeDecodexlMetaDataDirDecoder(t *testing.T) {
|
|
|
|
v := xlMetaDataDirDecoder{}
|
2020-06-12 23:04:01 -04:00
|
|
|
var buf bytes.Buffer
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
|
|
|
|
m := v.Msgsize()
|
|
|
|
if buf.Len() > m {
|
2021-11-18 15:15:22 -05:00
|
|
|
t.Log("WARNING: TestEncodeDecodexlMetaDataDirDecoder Msgsize() is inaccurate")
|
2020-06-12 23:04:01 -04:00
|
|
|
}
|
|
|
|
|
2021-11-18 15:15:22 -05:00
|
|
|
vn := xlMetaDataDirDecoder{}
|
2020-06-12 23:04:01 -04:00
|
|
|
err := msgp.Decode(&buf, &vn)
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
buf.Reset()
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
err = msgp.NewReader(&buf).Skip()
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-18 15:15:22 -05:00
|
|
|
func BenchmarkEncodexlMetaDataDirDecoder(b *testing.B) {
|
|
|
|
v := xlMetaDataDirDecoder{}
|
2020-06-12 23:04:01 -04:00
|
|
|
var buf bytes.Buffer
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
b.SetBytes(int64(buf.Len()))
|
|
|
|
en := msgp.NewWriter(msgp.Nowhere)
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
v.EncodeMsg(en)
|
|
|
|
}
|
|
|
|
en.Flush()
|
|
|
|
}
|
|
|
|
|
2021-11-18 15:15:22 -05:00
|
|
|
func BenchmarkDecodexlMetaDataDirDecoder(b *testing.B) {
|
|
|
|
v := xlMetaDataDirDecoder{}
|
2020-06-12 23:04:01 -04:00
|
|
|
var buf bytes.Buffer
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
b.SetBytes(int64(buf.Len()))
|
|
|
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
|
|
|
dc := msgp.NewReader(rd)
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
err := v.DecodeMsg(dc)
|
|
|
|
if err != nil {
|
|
|
|
b.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestMarshalUnmarshalxlMetaV2DeleteMarker(t *testing.T) {
|
|
|
|
v := xlMetaV2DeleteMarker{}
|
|
|
|
bts, err := v.MarshalMsg(nil)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
left, err := v.UnmarshalMsg(bts)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
if len(left) > 0 {
|
|
|
|
t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left)
|
|
|
|
}
|
|
|
|
|
|
|
|
left, err = msgp.Skip(bts)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
if len(left) > 0 {
|
|
|
|
t.Errorf("%d bytes left over after Skip(): %q", len(left), left)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkMarshalMsgxlMetaV2DeleteMarker(b *testing.B) {
|
|
|
|
v := xlMetaV2DeleteMarker{}
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
v.MarshalMsg(nil)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkAppendMsgxlMetaV2DeleteMarker(b *testing.B) {
|
|
|
|
v := xlMetaV2DeleteMarker{}
|
|
|
|
bts := make([]byte, 0, v.Msgsize())
|
|
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
|
|
b.SetBytes(int64(len(bts)))
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkUnmarshalxlMetaV2DeleteMarker(b *testing.B) {
|
|
|
|
v := xlMetaV2DeleteMarker{}
|
|
|
|
bts, _ := v.MarshalMsg(nil)
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.SetBytes(int64(len(bts)))
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
_, err := v.UnmarshalMsg(bts)
|
|
|
|
if err != nil {
|
|
|
|
b.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestEncodeDecodexlMetaV2DeleteMarker(t *testing.T) {
|
|
|
|
v := xlMetaV2DeleteMarker{}
|
|
|
|
var buf bytes.Buffer
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
|
|
|
|
m := v.Msgsize()
|
|
|
|
if buf.Len() > m {
|
|
|
|
t.Log("WARNING: TestEncodeDecodexlMetaV2DeleteMarker Msgsize() is inaccurate")
|
|
|
|
}
|
|
|
|
|
|
|
|
vn := xlMetaV2DeleteMarker{}
|
|
|
|
err := msgp.Decode(&buf, &vn)
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
buf.Reset()
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
err = msgp.NewReader(&buf).Skip()
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkEncodexlMetaV2DeleteMarker(b *testing.B) {
|
|
|
|
v := xlMetaV2DeleteMarker{}
|
|
|
|
var buf bytes.Buffer
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
b.SetBytes(int64(buf.Len()))
|
|
|
|
en := msgp.NewWriter(msgp.Nowhere)
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
v.EncodeMsg(en)
|
|
|
|
}
|
|
|
|
en.Flush()
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkDecodexlMetaV2DeleteMarker(b *testing.B) {
|
|
|
|
v := xlMetaV2DeleteMarker{}
|
|
|
|
var buf bytes.Buffer
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
b.SetBytes(int64(buf.Len()))
|
|
|
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
|
|
|
dc := msgp.NewReader(rd)
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
err := v.DecodeMsg(dc)
|
|
|
|
if err != nil {
|
|
|
|
b.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestMarshalUnmarshalxlMetaV2Object(t *testing.T) {
|
|
|
|
v := xlMetaV2Object{}
|
|
|
|
bts, err := v.MarshalMsg(nil)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
left, err := v.UnmarshalMsg(bts)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
if len(left) > 0 {
|
|
|
|
t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left)
|
|
|
|
}
|
|
|
|
|
|
|
|
left, err = msgp.Skip(bts)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
if len(left) > 0 {
|
|
|
|
t.Errorf("%d bytes left over after Skip(): %q", len(left), left)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkMarshalMsgxlMetaV2Object(b *testing.B) {
|
|
|
|
v := xlMetaV2Object{}
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
v.MarshalMsg(nil)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkAppendMsgxlMetaV2Object(b *testing.B) {
|
|
|
|
v := xlMetaV2Object{}
|
|
|
|
bts := make([]byte, 0, v.Msgsize())
|
|
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
|
|
b.SetBytes(int64(len(bts)))
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkUnmarshalxlMetaV2Object(b *testing.B) {
|
|
|
|
v := xlMetaV2Object{}
|
|
|
|
bts, _ := v.MarshalMsg(nil)
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.SetBytes(int64(len(bts)))
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
_, err := v.UnmarshalMsg(bts)
|
|
|
|
if err != nil {
|
|
|
|
b.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestEncodeDecodexlMetaV2Object(t *testing.T) {
|
|
|
|
v := xlMetaV2Object{}
|
|
|
|
var buf bytes.Buffer
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
|
|
|
|
m := v.Msgsize()
|
|
|
|
if buf.Len() > m {
|
|
|
|
t.Log("WARNING: TestEncodeDecodexlMetaV2Object Msgsize() is inaccurate")
|
|
|
|
}
|
|
|
|
|
|
|
|
vn := xlMetaV2Object{}
|
|
|
|
err := msgp.Decode(&buf, &vn)
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
buf.Reset()
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
err = msgp.NewReader(&buf).Skip()
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkEncodexlMetaV2Object(b *testing.B) {
|
|
|
|
v := xlMetaV2Object{}
|
|
|
|
var buf bytes.Buffer
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
b.SetBytes(int64(buf.Len()))
|
|
|
|
en := msgp.NewWriter(msgp.Nowhere)
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
v.EncodeMsg(en)
|
|
|
|
}
|
|
|
|
en.Flush()
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkDecodexlMetaV2Object(b *testing.B) {
|
|
|
|
v := xlMetaV2Object{}
|
|
|
|
var buf bytes.Buffer
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
b.SetBytes(int64(buf.Len()))
|
|
|
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
|
|
|
dc := msgp.NewReader(rd)
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
err := v.DecodeMsg(dc)
|
|
|
|
if err != nil {
|
|
|
|
b.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestMarshalUnmarshalxlMetaV2Version(t *testing.T) {
|
|
|
|
v := xlMetaV2Version{}
|
|
|
|
bts, err := v.MarshalMsg(nil)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
left, err := v.UnmarshalMsg(bts)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
if len(left) > 0 {
|
|
|
|
t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left)
|
|
|
|
}
|
|
|
|
|
|
|
|
left, err = msgp.Skip(bts)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
if len(left) > 0 {
|
|
|
|
t.Errorf("%d bytes left over after Skip(): %q", len(left), left)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkMarshalMsgxlMetaV2Version(b *testing.B) {
|
|
|
|
v := xlMetaV2Version{}
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
v.MarshalMsg(nil)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkAppendMsgxlMetaV2Version(b *testing.B) {
|
|
|
|
v := xlMetaV2Version{}
|
|
|
|
bts := make([]byte, 0, v.Msgsize())
|
|
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
|
|
b.SetBytes(int64(len(bts)))
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkUnmarshalxlMetaV2Version(b *testing.B) {
|
|
|
|
v := xlMetaV2Version{}
|
|
|
|
bts, _ := v.MarshalMsg(nil)
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.SetBytes(int64(len(bts)))
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
_, err := v.UnmarshalMsg(bts)
|
|
|
|
if err != nil {
|
|
|
|
b.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestEncodeDecodexlMetaV2Version(t *testing.T) {
|
|
|
|
v := xlMetaV2Version{}
|
|
|
|
var buf bytes.Buffer
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
|
|
|
|
m := v.Msgsize()
|
|
|
|
if buf.Len() > m {
|
|
|
|
t.Log("WARNING: TestEncodeDecodexlMetaV2Version Msgsize() is inaccurate")
|
|
|
|
}
|
|
|
|
|
|
|
|
vn := xlMetaV2Version{}
|
|
|
|
err := msgp.Decode(&buf, &vn)
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
buf.Reset()
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
err = msgp.NewReader(&buf).Skip()
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkEncodexlMetaV2Version(b *testing.B) {
|
|
|
|
v := xlMetaV2Version{}
|
|
|
|
var buf bytes.Buffer
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
b.SetBytes(int64(buf.Len()))
|
|
|
|
en := msgp.NewWriter(msgp.Nowhere)
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
v.EncodeMsg(en)
|
|
|
|
}
|
|
|
|
en.Flush()
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkDecodexlMetaV2Version(b *testing.B) {
|
|
|
|
v := xlMetaV2Version{}
|
|
|
|
var buf bytes.Buffer
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
b.SetBytes(int64(buf.Len()))
|
|
|
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
|
|
|
dc := msgp.NewReader(rd)
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
err := v.DecodeMsg(dc)
|
|
|
|
if err != nil {
|
|
|
|
b.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-11-18 15:15:22 -05:00
|
|
|
|
|
|
|
func TestMarshalUnmarshalxlMetaV2VersionHeader(t *testing.T) {
|
|
|
|
v := xlMetaV2VersionHeader{}
|
|
|
|
bts, err := v.MarshalMsg(nil)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
left, err := v.UnmarshalMsg(bts)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
if len(left) > 0 {
|
|
|
|
t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left)
|
|
|
|
}
|
|
|
|
|
|
|
|
left, err = msgp.Skip(bts)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
if len(left) > 0 {
|
|
|
|
t.Errorf("%d bytes left over after Skip(): %q", len(left), left)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkMarshalMsgxlMetaV2VersionHeader(b *testing.B) {
|
|
|
|
v := xlMetaV2VersionHeader{}
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
v.MarshalMsg(nil)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkAppendMsgxlMetaV2VersionHeader(b *testing.B) {
|
|
|
|
v := xlMetaV2VersionHeader{}
|
|
|
|
bts := make([]byte, 0, v.Msgsize())
|
|
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
|
|
b.SetBytes(int64(len(bts)))
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
bts, _ = v.MarshalMsg(bts[0:0])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkUnmarshalxlMetaV2VersionHeader(b *testing.B) {
|
|
|
|
v := xlMetaV2VersionHeader{}
|
|
|
|
bts, _ := v.MarshalMsg(nil)
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.SetBytes(int64(len(bts)))
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
_, err := v.UnmarshalMsg(bts)
|
|
|
|
if err != nil {
|
|
|
|
b.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestEncodeDecodexlMetaV2VersionHeader(t *testing.T) {
|
|
|
|
v := xlMetaV2VersionHeader{}
|
|
|
|
var buf bytes.Buffer
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
|
|
|
|
m := v.Msgsize()
|
|
|
|
if buf.Len() > m {
|
|
|
|
t.Log("WARNING: TestEncodeDecodexlMetaV2VersionHeader Msgsize() is inaccurate")
|
|
|
|
}
|
|
|
|
|
|
|
|
vn := xlMetaV2VersionHeader{}
|
|
|
|
err := msgp.Decode(&buf, &vn)
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
buf.Reset()
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
err = msgp.NewReader(&buf).Skip()
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkEncodexlMetaV2VersionHeader(b *testing.B) {
|
|
|
|
v := xlMetaV2VersionHeader{}
|
|
|
|
var buf bytes.Buffer
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
b.SetBytes(int64(buf.Len()))
|
|
|
|
en := msgp.NewWriter(msgp.Nowhere)
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
v.EncodeMsg(en)
|
|
|
|
}
|
|
|
|
en.Flush()
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkDecodexlMetaV2VersionHeader(b *testing.B) {
|
|
|
|
v := xlMetaV2VersionHeader{}
|
|
|
|
var buf bytes.Buffer
|
|
|
|
msgp.Encode(&buf, &v)
|
|
|
|
b.SetBytes(int64(buf.Len()))
|
|
|
|
rd := msgp.NewEndlessReader(buf.Bytes(), b)
|
|
|
|
dc := msgp.NewReader(rd)
|
|
|
|
b.ReportAllocs()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
err := v.DecodeMsg(dc)
|
|
|
|
if err != nil {
|
|
|
|
b.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|