benchsuite

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: GPL-3.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package benchsuite provides standardized protocol performance benchmarking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatResults

func FormatResults(results []*BenchResult) string

FormatResults formats benchmark results as a table.

Types

type BenchResult

type BenchResult struct {
	Protocol    string        `json:"protocol"`
	Operation   string        `json:"operation"` // "encode", "decode"
	Iterations  int           `json:"iterations"`
	TotalTime   time.Duration `json:"total_time"`
	OpsPerSec   float64       `json:"ops_per_sec"`
	NsPerOp     int64         `json:"ns_per_op"`
	BytesPerOp  int64         `json:"bytes_per_op"`
	AllocsPerOp int64         `json:"allocs_per_op"`
}

BenchResult holds the result of a single benchmark.

type Suite

type Suite struct {
	// contains filtered or unexported fields
}

Suite runs protocol benchmarks.

func NewSuite

func NewSuite(lib *protocol.Library, iterations int) *Suite

NewSuite creates a new benchmark suite.

func (*Suite) RunDecode

func (s *Suite) RunDecode(protoName string, data []byte) (*BenchResult, error)

RunDecode benchmarks decoding for a protocol.

func (*Suite) RunEncode

func (s *Suite) RunEncode(protoName string, packet map[string]any) (*BenchResult, error)

RunEncode benchmarks encoding for a protocol.

Jump to

Keyboard shortcuts

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