Help us shape the future of Go! Take the 2026 Go Developer Survey

benchmark

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package benchmark measures complete Wails CLI invocations and applies explicit median-based performance budgets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(result Result, baseline *Result, maxMS, maxRegressionPercent float64) error

func CheckBudget

func CheckBudget(result Result, baseline *Result, budget Budget) error

func Write

func Write(path string, result Result) error

Types

type Artifact

type Artifact struct {
	Digest    string `json:"digest"`
	SizeBytes int64  `json:"size_bytes"`
}

type Budget

type Budget struct {
	MaxMedianWallMS                 float64
	MaxRegressionPercent            float64
	MaxMADPercent                   float64
	MaxOrchestrationOverheadPercent float64
	MinSamples                      int
	ExpectedExecutedSteps           *int
	ExpectedCachedSteps             *int
	RequireStableArtifacts          bool
}

type Config

type Config struct {
	Scenario         string
	Command          []string
	BeforeEach       []string
	WorkingDirectory string
	Environment      []string
	Artifacts        []string
	Warmups          int
	Samples          int
}

type Result

type Result struct {
	Version            int      `json:"version"`
	Scenario           string   `json:"scenario"`
	Command            []string `json:"command"`
	Samples            []Sample `json:"samples"`
	MedianWallMS       float64  `json:"median_wall_ms"`
	MinWallMS          float64  `json:"min_wall_ms"`
	MaxWallMS          float64  `json:"max_wall_ms"`
	MedianCPUMS        float64  `json:"median_cpu_ms"`
	MedianPeakRSSBytes int64    `json:"median_peak_rss_bytes,omitempty"`
	// MedianReportedBuildMS is the CLI's own graph duration. WallMS includes
	// process startup and reporting, so keeping both separates orchestration
	// critical-path work from complete command latency.
	MedianReportedBuildMS float64 `json:"median_reported_build_ms,omitempty"`
	// MedianAbsoluteDeviationMS and MADPercent describe run-to-run wall-time
	// variance without allowing one noisy outlier to decide the result.
	MedianAbsoluteDeviationMS float64 `json:"median_absolute_deviation_ms"`
	MADPercent                float64 `json:"mad_percent"`
	// OrchestrationOverheadPercent is complete process wall time minus the
	// duration reported by the build graph, as a percentage of graph time.
	OrchestrationOverheadPercent float64 `json:"orchestration_overhead_percent,omitempty"`
}

func Read

func Read(path string) (*Result, error)

func Run

func Run(ctx context.Context, config Config) (Result, error)

type Sample

type Sample struct {
	WallMS          float64             `json:"wall_ms"`
	CPUMS           float64             `json:"cpu_ms"`
	PeakRSSBytes    int64               `json:"peak_rss_bytes,omitempty"`
	ReportedBuildMS float64             `json:"reported_build_ms,omitempty"`
	ExecutedSteps   int                 `json:"executed_steps,omitempty"`
	CachedSteps     int                 `json:"cached_steps,omitempty"`
	StepsReported   bool                `json:"steps_reported,omitempty"`
	Artifacts       map[string]Artifact `json:"artifacts,omitempty"`
}

Jump to

Keyboard shortcuts

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