Documentation
¶
Overview ¶
Package benchfixture provides canonical message fixtures at three size tiers (Small, Medium, Large) for benchmark tests. All fixtures are built using only internal packages (descriptor, dynamicpb, protoreflect, scalar) with zero external dependencies.
Index ¶
- func BuildLargeMessage() (*descriptor.MessageDescriptor, *dynamicpb.Message)
- func BuildMediumMessage() (*descriptor.MessageDescriptor, *dynamicpb.Message)
- func BuildSmallMessage() (*descriptor.MessageDescriptor, *dynamicpb.Message)
- func PreMarshalBinary(msg *dynamicpb.Message) ([]byte, error)
- func PreMarshalJSON(msg *dynamicpb.Message) ([]byte, error)
- func PreMarshalText(msg *dynamicpb.Message) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildLargeMessage ¶
func BuildLargeMessage() (*descriptor.MessageDescriptor, *dynamicpb.Message)
BuildLargeMessage builds a canonical large benchmark message with 100+ fields including repeated string (50 elements), map<string, int32> (20 entries), 3-level nested messages, a oneof group with 3 alternatives, and diverse scalar types. It returns the outermost message descriptor and a populated dynamicpb.Message.
func BuildMediumMessage ¶
func BuildMediumMessage() (*descriptor.MessageDescriptor, *dynamicpb.Message)
BuildMediumMessage builds a canonical medium benchmark message with ~30 fields including 3-level nesting (Outer -> Middle -> Inner) and a repeated int32 field with 20 elements. It returns the outermost message descriptor and a populated dynamicpb.Message.
func BuildSmallMessage ¶
func BuildSmallMessage() (*descriptor.MessageDescriptor, *dynamicpb.Message)
BuildSmallMessage builds a canonical small benchmark message with 10 scalar fields of diverse types. It returns the message descriptor and a populated dynamicpb.Message.
func PreMarshalBinary ¶
PreMarshalBinary marshals the given message to binary wire format and returns the resulting bytes. This is used by benchmarks that need pre-encoded data for unmarshal or SetBytes operations.
func PreMarshalJSON ¶
PreMarshalJSON marshals the given message to canonical JSON and returns the resulting bytes. This is used by codec benchmarks that need pre-encoded JSON data for unmarshal benchmarks or b.SetBytes reporting.
Types ¶
This section is empty.