stress

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package stress builds synthetic worst-case sheets for the stress benchmarks (see docs/contributing/limits.md and `make stress`). Every generator is deterministic, so runs compare, and builds through the public API the way importers do: Load cell by cell, then one RecalcAll.

Index

Constants

View Source
const (
	Rows = 8192
	Cols = 256
)

Rows and Cols are the size of the shapes: the grid of Lotus 1-2-3 that 012 had before it grew to Excel's, so runs before and after compare.

View Source
const (
	MaxRows = 1_000_000
	MaxCols = 10
)

MaxRows x MaxCols is sheet.DefaultMaxCells of numbers, the most an import keeps by default: a tall table, as imports make.

View Source
const BenchLockPath = "/tmp/012-bench.lock"

BenchLockPath is the lock timed runs on this machine share, as the speed gate takes it (internal/ui/speedlock_unix_test.go): a file locked with flock(2), or a directory made and removed after where there is no flock command (macOS).

Variables

View Source
var SaleCats = []string{"north", "south", "east", "west", "central", "coast", "hills", "islands"}

SaleCats are the categories, in the order rows draw them from.

Functions

func Arrays added in v0.2.0

func Arrays(n, k int) *sheet.Sheet

Arrays is a column of n numbers beside a column of eight categories, and k formulas in row 1 spilling from them, alternating a FILTER of the numbers by one category (n/8 rows each) and the UNIQUE categories: k arrays over n rows, every number's change recomputing half of them.

func BenchLock added in v0.6.0

func BenchLock(tb Logger) func()

BenchLock waits up to ten minutes for the lock and returns its release; past that, or when it can't be taken, it times without it.

func Chain

func Chain(n int) *sheet.Sheet

Chain is A1=1 and A(n)=A(n-1)+1 down n rows: the deepest dependency path, evaluated recursively.

func Charts

func Charts(s *sheet.Sheet, k int)

Charts adds k small column charts over a data block to s.

func Criteria

func Criteria(n, k int) *sheet.Sheet

Criteria is a table of n rows (a number, a category, an amount) and k conditional aggregates over whole columns of it: SUMIF, COUNTIFS with two conditions and AVERAGEIF in turn, each testing every row.

func Dense

func Dense(rows, cols int) *sheet.Sheet

Dense fills rows x cols with numbers: the storage and render bound.

func FanIn

func FanIn(n, k int) *sheet.Sheet

FanIn is a column of n numbers and k formulas that each SUM all of it: k range users over the same big range.

func FanInColumns

func FanInColumns(n, k int) *sheet.Sheet

FanInColumns is FanIn with whole-column ranges, =SUM(A:A): the same data, read through a range of a million rows.

func FanOut

func FanOut(k int) *sheet.Sheet

FanOut is one cell, A1, read directly by k formulas.

func GeneratedDir added in v0.6.0

func GeneratedDir(fallback string) string

GeneratedDir is where generated sources are kept: $STRESS_DIR's generated folder, or fallback.

func Laidout added in v0.3.0

func Laidout(rows, cols int) *sheet.Sheet

Laidout is a report of rows x cols: every cell bordered, a last column of notes that wrap over three lines, and a title merged across the top: what borders, tall rows and merged cells cost a frame.

func LiveHeap added in v0.6.0

func LiveHeap() uint64

LiveHeap is the heap in use after a collection.

func LongText

func LongText(rows, n int) *sheet.Sheet

LongText puts a length-n line of text, mixing ASCII, accents, CJK and emoji, in column A of rows rows and leaves everything else blank, so every row overflows across the whole screen.

func Lookup

func Lookup(n, k int) *sheet.Sheet

Lookup is n keys with a value beside each and k exact lookups into them: VLOOKUP, MATCH and XLOOKUP in turn, each key found somewhere along the column.

func Names

func Names(k int) *sheet.Sheet

Names defines k named ranges over a column of 8192 numbers and a formula using each: every changed cell is checked against every name.

func Nested

func Nested(depth int) string

Nested is a formula nested depth levels deep, e.g. =((((1+1)+1)+1)+1), in A1: the parser's and evaluator's recursion.

func NestedIF

func NestedIF(depth int) string

NestedIF is =IF(A1>0,IF(A1>1,...,0),0) depth levels deep.

func RunningTotals

func RunningTotals(n int) *sheet.Sheet

RunningTotals is n numbers with a running SUM beside each: n overlapping ranges of growing size, O(n^2) cells read in all.

func SalesParquet added in v0.6.0

func SalesParquet(dir string, rows int) (string, error)

SalesParquet is the Parquet source of rows rows in dir, written unless it's there.

func SalesSQLite added in v0.6.0

func SalesSQLite(dir string, rows int) (string, error)

SalesSQLite is the SQLite source of rows rows in dir, a table named sales, written unless it's there.

func SamplePeak added in v0.6.0

func SamplePeak() func() uint64

SamplePeak samples the heap's live objects every 100 us until the function it returns is called, which returns the most seen.

func Sparse

func Sparse(n, stride, k int) *sheet.Sheet

Sparse is a tall, sparse sheet: n numbers every stride rows down column A, a label beside each, and k of each of three formulas over whole columns: =SUM(A:A), running totals to every thousandth row, and =VLOOKUP over A:B. Its cost should follow its n cells, not the million rows they span.

func Table

func Table(rows, cols int) *sheet.Sheet

Table is a filterable, sortable table: a header row and rows rows of an id, a category, a number and a date-like text, in cols columns.

func Volatile

func Volatile(k int) *sheet.Sheet

Volatile is k cells alternating TODAY() and RAND(), recalculated on every change anywhere.

Types

type Logger added in v0.6.0

type Logger interface {
	Logf(format string, args ...any)
	Fatalf(format string, args ...any)
}

Logger is what BenchLock says why it times without the lock through: a testing.TB.

type SaleRow added in v0.6.0

type SaleRow struct {
	ID     int64   `parquet:"id"`
	Cat    string  `parquet:"cat,dict"`
	Amount float64 `parquet:"amount"`
	Day    int32   `parquet:"day,date"`
}

SaleRow is a row of the generated sources: an id, one of eight categories, an amount and a date. Its columns are A to D of the sources' tabs.

func Sale added in v0.6.0

func Sale(i int) SaleRow

Sale is row i of the sources, the same whenever it's asked for.

type Shape

type Shape struct {
	Name  string
	Build func() *sheet.Sheet
	// Edit is a cell whose change touches the shape's interesting
	// topology, for single-edit latency, and the entry to type there.
	Edit  sheet.Addr
	Input string
}

Shape is one synthetic sheet: a name for benchmark output, and a builder. Rows and Cols describe the populated area.

func Shapes

func Shapes() []Shape

Shapes are the edit-latency topologies at their stress sizes.

Directories

Path Synopsis
Command benchrec turns `go test -bench` output into run records, one JSON line per benchmark, appended to a results file that DuckDB (and ClickHouse) read; see scripts/stress and docs/contributing/observability.md.
Command benchrec turns `go test -bench` output into run records, one JSON line per benchmark, appended to a results file that DuckDB (and ClickHouse) read; see scripts/stress and docs/contributing/observability.md.

Jump to

Keyboard shortcuts

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