Documentation
¶
Overview ¶
Package corpus resolves the trees the benchmarks measure.
The corpora ship with the repository as one archive (internal/benchmarks/testdata/corpus.tgz) and are unpacked on demand, so a measurement needs a clone and nothing else — no external checkout, no environment variable naming somebody's home directory, and no network. Both trees carry their dependencies in vendor/, which is what makes that last one true.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Corpus ¶
type Corpus struct {
Name string
Dir string // absolute path to the unpacked tree
Pattern string // package pattern to scan
}
Corpus is one tree to measure.
Two shapes on purpose, because a conclusion that only holds on one of them is not a conclusion:
- dockerctl — a generated CLIENT for a reasonably large API. Light code, 198 definitions, no paths: the annotations are all on models.
- kubeapi — a generated SERVER for a very large API. Heavy code, four times the source, 222 definitions and 260 paths, so the route and operation rendering paths carry real weight.
func Ensure ¶
Ensure unpacks the archive if needed and returns the corpora.
The unpacked tree is stamped with the archive's digest, so a re-rolled archive is noticed and unpacked again rather than measured stale — the failure mode that would otherwise be invisible, since a stale tree scans perfectly well.
func Find ¶
Find returns one corpus by name.
The name is checked before anything is unpacked. Otherwise a typo pays for the whole archive before being told it was a typo — and, less obviously, the test covering that refusal would unpack 55 MB on every CI job of every platform, which is exactly what the measurement gate exists to prevent.