Skip to content

Cleanup bench - #118

Merged
fredbi merged 4 commits into
go-openapi:masterfrom
fredbi:cleanup-bench
Aug 16, 2026
Merged

Cleanup bench#118
fredbi merged 4 commits into
go-openapi:masterfrom
fredbi:cleanup-bench

Conversation

@fredbi

@fredbi fredbi commented Aug 16, 2026

Copy link
Copy Markdown
Member

Change type

Please select: 🆕 New feature or enhancement|🔧 Bug fix'|📃 Documentation update

Short description

Fixes

Full description

Checklist

  • I have signed all my commits with my name and email (see DCO. This does not require a PGP-signed commit
  • I have rebased and squashed my work, so only one commit remains
  • I have added tests to cover my changes.
  • I have properly enriched go doc comments in code.
  • I have properly documented any breaking change.

fredbi and others added 2 commits August 16, 2026 23:21
The benchmarks measured external checkouts named through the environment, so
nobody but their author could run them. They now measure two go-swagger
generated projects carried in the repository as one archive, unpacked on
demand: dockerctl, a light client over a reasonably large API, and kubeapi, a
heavy server over a very large one. Both vendor their dependencies, so a
measurement needs a clone and nothing else.

Corpus:
- a corpus package unpacks the archive on demand and stamps the result with
  its digest, so a re-rolled archive is never measured stale;
- an entry that would escape the destination fails the extraction rather than
  being relocated inside it;
- every load sets GOWORK=off, the trees sitting inside a workspace that does
  not list them.

Harness:
- the phase split and the profiling wrapper run over either corpus, not just
  the client, and every report is behind CODESCAN_BENCH=1;
- loader-benchmark builds one probe per released version instead of a single
  baseline, so the history is a column of the same table;
- the discovery and working-set axes go with the exploration they instrumented.

Documentation:
- one README under the benchmarks package replaces four documents that
  recorded how the measurements were arrived at. It reports the loader
  comparison warm and cold, and what six months moved: on kubeapi, 7.1 s and
  4555 MB allocated under v0.33.3 against 0.97 s and 447 MB today, for the
  identical document.

The second corpus used to be go-swagger itself, which is a CLI tool rather than
an API and whose figures nobody could reproduce.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
A maintainers page recapping the measurement work: the two independent
gains since the code left go-swagger — the annotation grammar and the
package loader — and how the three loader configurations fare warm and
cold. Mermaid xychart diagrams over the kubeapi corpus, which is the
server stub go-swagger generates from the kubernetes API manifest, not
kubernetes itself.

Every bar on the page comes from a scan that emitted the same 222
definitions and 260 paths, which is what makes them comparable.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Comment thread internal/benchmarks/corpus/corpus.go Fixed
@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
4372 2 4370 9
View the top 2 failed test(s) by shortest run time
github.com/go-openapi/codescan/internal/benchmarks/corpus::TestSafeJoin
Stack Traces | 0s run time
Failed
github.com/go-openapi/codescan/internal/benchmarks/corpus::TestSafeJoin/refuses_/absolute/escaped.go
Stack Traces | 0s run time
Failed

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

fredbi and others added 2 commits August 17, 2026 00:53
The corpus extractor refused an entry by asking the host whether its name was
absolute, and the answer differs: filepath.IsAbs("/x") is false on Windows,
which wants a volume, so the rooted entry Linux refused was accepted there. A
guard whose verdict depends on where it runs is the wrong shape for a guard,
whatever it lets through.

The name is now judged as the slash path the tar format defines — no leading
separator, no ".." element, and no backslash or colon, those being a separator
and a drive marker on one platform and ordinary filename characters on
another. One verdict everywhere.

The containment property is then restated on the joined path, redundantly and
on purpose: it is what this function exists to guarantee, and it is asserted on
the value it returns rather than inferred from the checks above it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Find resolved the archive first and judged the name afterwards, so asking for
a corpus that does not exist paid for 55 MB of extraction before being told it
was a typo.

It also quietly defeated the measurement gate. The test covering that refusal
needs no corpus and was therefore left ungated, but the call behind it unpacked
one — on every CI job of every platform, which is the cost the gate exists to
keep out of an ordinary `go test ./...`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
@fredbi
fredbi merged commit 27cc629 into go-openapi:master Aug 16, 2026
29 checks passed
@fredbi
fredbi deleted the cleanup-bench branch August 16, 2026 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants