benchproc: correctly parse signed numeric sort keys

The regular expression used by parseNum did not include an optional sign
and was not anchored to the input. As a result, a value such as "-1k"
was parsed as positive 1000, while strings such as "abc1Mxyz" and
"1kB/s" were accepted by extracting a numeric substring.

Anchor the suffixed-number expression and include an optional leading
sign. Continue to use strconv.ParseFloat to validate the numeric portion.

Add tests for signed SI and IEC values and for rejecting inputs with
unrelated prefixes or suffixes.

Fixes golang/go#80770

Change-Id: If90675c4cdeaac3ba56f6efd992ee9d90d9bc8a0
Reviewed-on: https://go-review.googlesource.com/c/perf/+/811620
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
2 files changed
tree: 4aadd55b84f446bcf48e25d8ee2c212a7e6a62c3
  1. analysis/
  2. benchfmt/
  3. benchmath/
  4. benchproc/
  5. benchseries/
  6. benchstat/
  7. benchunit/
  8. cmd/
  9. internal/
  10. storage/
  11. CONTRIBUTING.md
  12. go.mod
  13. go.sum
  14. LICENSE
  15. PATENTS
  16. README.md
README.md

Go benchmark analysis tools

Go Reference

This subrepository holds tools and packages for analyzing Go benchmark results, such as the output of testing package benchmarks.

Tools

This subrepository contains command-line tools for analyzing benchmark result data.

cmd/benchstat computes statistical summaries and A/B comparisons of Go benchmarks.

cmd/benchfilter filters the contents of benchmark result files.

cmd/benchsave publishes benchmark results to perf.golang.org.

To install all of these commands, run go install golang.org/x/perf/cmd/...@latest. You can also git clone https://go.googlesource.com/perf and run go install ./cmd/... in the checkout.

Packages

Underlying the above tools are several packages for working with benchmark data. These are designed to work together, but can also be used independently.

benchfmt reads and writes the Go benchmark format.

benchunit manipulates benchmark units and formats numbers in those units.

benchproc provides tools for filtering, grouping, and sorting benchmark results.

benchmath provides tools for computing statistics over distributions of benchmark measurements.

Deprecated packages

The following packages are deprecated and no longer supported:

storage contains a deprecated version of the https://perfdata.golang.org/ benchmark result storage system. These packages have moved to https://golang.org/x/build.

analysis contains a deprecated version of the https://perf.golang.org/ benchmark result analysis system. These packages have moved to https://golang.org/x/build.

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://go.dev/doc/contribute.

The git repository is https://go.googlesource.com/perf.

The main issue tracker for the perf repository is located at https://go.dev/issues. Prefix your issue with “x/perf:” in the subject line, so it is easy to find.