serialization

package
v0.0.0-...-ba4ce30 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JsonSmall = `{"action":"benchmark","key":"ZGF0YSB0byBiZSBzZW50"}`

	JsonMedium = `` /* 269-byte string literal not displayed */

	JsonLarge = `` /* 852-byte string literal not displayed */
)
View Source
var (
	ProtocSmall = BenchSmall{
		Action: "benchmark",
		Key:    []byte("data to be sent"),
	}

	ProtocMedium = BenchMedium{
		Name:   "Tester",
		Age:    20,
		Height: 5.8,
		Weight: 180.7,
		Alive:  true,
		Desc: []byte(`If you've ever heard of ProtoBuf you may be thinking 
		that the results of this benchmarking experiment will be obvious,
		JSON < ProtoBuf.`),
	}

	ProtocLarge = BenchLarge{
		Name:     "Tester",
		Age:      20,
		Height:   5.8,
		Weight:   180.7,
		Alive:    true,
		Desc:     []byte("Lets benchmark some json and protobuf"),
		Nickname: "Another name",
		Num:      2314,
		Flt:      123451231.1234,
		Data: []byte(`If you've ever heard of ProtoBuf you may be thinking that
		the results of this benchmarking experiment will be obvious, JSON < ProtoBuf.
		My interest was in how much they actually differ in practice.
		How do they compare on a couple of different metrics, specifically serialization
		and de-serialization speeds, and the memory footprint of encoding the data.
		I was also curious about how the different serialization methods would
		behave under small, medium, and large chunks of data.`),
	}
)
View Source
var File_chapter_2_serialization_info_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type BenchLarge

type BenchLarge struct {
	Name     string  `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Age      int64   `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"`
	Height   float32 `protobuf:"fixed32,3,opt,name=height,proto3" json:"height,omitempty"`
	Weight   float64 `protobuf:"fixed64,4,opt,name=weight,proto3" json:"weight,omitempty"`
	Alive    bool    `protobuf:"varint,5,opt,name=alive,proto3" json:"alive,omitempty"`
	Desc     []byte  `protobuf:"bytes,6,opt,name=desc,proto3" json:"desc,omitempty"`
	Nickname string  `protobuf:"bytes,7,opt,name=nickname,proto3" json:"nickname,omitempty"`
	Num      int64   `protobuf:"varint,8,opt,name=num,proto3" json:"num,omitempty"`
	Flt      float32 `protobuf:"fixed32,9,opt,name=flt,proto3" json:"flt,omitempty"`
	Dbl      float64 `protobuf:"fixed64,10,opt,name=dbl,proto3" json:"dbl,omitempty"`
	Tru      bool    `protobuf:"varint,11,opt,name=tru,proto3" json:"tru,omitempty"`
	Data     []byte  `protobuf:"bytes,12,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*BenchLarge) Descriptor deprecated

func (*BenchLarge) Descriptor() ([]byte, []int)

Deprecated: Use BenchLarge.ProtoReflect.Descriptor instead.

func (*BenchLarge) GetAge

func (x *BenchLarge) GetAge() int64

func (*BenchLarge) GetAlive

func (x *BenchLarge) GetAlive() bool

func (*BenchLarge) GetData

func (x *BenchLarge) GetData() []byte

func (*BenchLarge) GetDbl

func (x *BenchLarge) GetDbl() float64

func (*BenchLarge) GetDesc

func (x *BenchLarge) GetDesc() []byte

func (*BenchLarge) GetFlt

func (x *BenchLarge) GetFlt() float32

func (*BenchLarge) GetHeight

func (x *BenchLarge) GetHeight() float32

func (*BenchLarge) GetName

func (x *BenchLarge) GetName() string

func (*BenchLarge) GetNickname

func (x *BenchLarge) GetNickname() string

func (*BenchLarge) GetNum

func (x *BenchLarge) GetNum() int64

func (*BenchLarge) GetTru

func (x *BenchLarge) GetTru() bool

func (*BenchLarge) GetWeight

func (x *BenchLarge) GetWeight() float64

func (*BenchLarge) ProtoMessage

func (*BenchLarge) ProtoMessage()

func (*BenchLarge) ProtoReflect

func (x *BenchLarge) ProtoReflect() protoreflect.Message

func (*BenchLarge) Reset

func (x *BenchLarge) Reset()

func (*BenchLarge) String

func (x *BenchLarge) String() string

type BenchMedium

type BenchMedium struct {
	Name   string  `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Age    int64   `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"`
	Height float32 `protobuf:"fixed32,3,opt,name=height,proto3" json:"height,omitempty"`
	Weight float64 `protobuf:"fixed64,4,opt,name=weight,proto3" json:"weight,omitempty"`
	Alive  bool    `protobuf:"varint,5,opt,name=alive,proto3" json:"alive,omitempty"`
	Desc   []byte  `protobuf:"bytes,6,opt,name=desc,proto3" json:"desc,omitempty"`
	// contains filtered or unexported fields
}

func (*BenchMedium) Descriptor deprecated

func (*BenchMedium) Descriptor() ([]byte, []int)

Deprecated: Use BenchMedium.ProtoReflect.Descriptor instead.

func (*BenchMedium) GetAge

func (x *BenchMedium) GetAge() int64

func (*BenchMedium) GetAlive

func (x *BenchMedium) GetAlive() bool

func (*BenchMedium) GetDesc

func (x *BenchMedium) GetDesc() []byte

func (*BenchMedium) GetHeight

func (x *BenchMedium) GetHeight() float32

func (*BenchMedium) GetName

func (x *BenchMedium) GetName() string

func (*BenchMedium) GetWeight

func (x *BenchMedium) GetWeight() float64

func (*BenchMedium) ProtoMessage

func (*BenchMedium) ProtoMessage()

func (*BenchMedium) ProtoReflect

func (x *BenchMedium) ProtoReflect() protoreflect.Message

func (*BenchMedium) Reset

func (x *BenchMedium) Reset()

func (*BenchMedium) String

func (x *BenchMedium) String() string

type BenchSmall

type BenchSmall struct {
	Action string `protobuf:"bytes,1,opt,name=action,proto3" json:"action,omitempty"`
	Key    []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
	// contains filtered or unexported fields
}

func (*BenchSmall) Descriptor deprecated

func (*BenchSmall) Descriptor() ([]byte, []int)

Deprecated: Use BenchSmall.ProtoReflect.Descriptor instead.

func (*BenchSmall) GetAction

func (x *BenchSmall) GetAction() string

func (*BenchSmall) GetKey

func (x *BenchSmall) GetKey() []byte

func (*BenchSmall) ProtoMessage

func (*BenchSmall) ProtoMessage()

func (*BenchSmall) ProtoReflect

func (x *BenchSmall) ProtoReflect() protoreflect.Message

func (*BenchSmall) Reset

func (x *BenchSmall) Reset()

func (*BenchSmall) String

func (x *BenchSmall) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL