allocguard

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 4 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 allocguard reports a failed allocation guard in words that say what to do.

The guards (the tests named Test...AllocationsBudget) hold the number of allocations of each path to its budget. The budget is the figure that was measured, and a figure up to 10% above it passes (one more for a budget under 10): only a figure above that fails the row, and the message says how to find the new allocation. A figure that fell passes, and when it fell by more than 10% the test logs a hint to lower the budget.

Index

Constants

View Source
const Docs = "docs/dev/performance.md#allocation-guard"

Docs is the page and the section that describe the guard and how to update a budget.

Variables

This section is empty.

Functions

func Assert

func Assert(tb testing.TB, path string, budget, measured float64)

Assert fails the test when the measured figure of a path is more than 10% above its budget (see Message), and logs the Hint when it is more than 10% below.

func Hint

func Hint(path string, budget, measured float64) string

Hint is the advice to lower the budget of a row whose figure fell by more than 10%, or "" for any other figure.

func Message

func Message(path, test string, budget, measured float64) string

Message is the failure text of a row, or "" when the measured figure is at most 10% above the budget. The text names the path, the budget and the measured figure, says that the figure ROSE, and how to find the allocation. The test is the name of the test that holds the row (t.Name() of the top-level test).

Types

This section is empty.

Jump to

Keyboard shortcuts

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