benchfixture

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 7 Imported by: 0

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

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

func PreMarshalBinary(msg *dynamicpb.Message) ([]byte, error)

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

func PreMarshalJSON(msg *dynamicpb.Message) ([]byte, error)

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.

func PreMarshalText

func PreMarshalText(msg *dynamicpb.Message) ([]byte, error)

PreMarshalText marshals the given message to text format and returns the resulting bytes. This is used by codec benchmarks that need pre-encoded text format data for unmarshal benchmarks or b.SetBytes reporting.

Types

This section is empty.

Jump to

Keyboard shortcuts

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