Skip to content

golang benchmarks can't handle multiple metrics #118

@joe-kimmel-vmw

Description

@joe-kimmel-vmw

the extractGoResult function works great as long as there's only a single metric on the line.
However golang's benchmark tool supports including additional compiler and user defined metrics, which will appear on the same line.

The format is defined semi-formally in a proposal. Key description includes:

A benchmark result line has the general form
[ ...]
The fields are separated by runs of space characters (as defined by unicode.IsSpace), so the line can be parsed with > strings.Fields. The line must have an even number of fields, and at least four.

I've hacked a potential solution in this fork , happy to PR it into this repo or work on a different approach -- one issue I ran into is that there's some tests that fundamentally assert you're not adding new metrics to an existing test. Additionally there's been some changes to how the go toolchain wants to be invoked since the standardization of gomodules.

Based on that another approach could be making a separate "go 1.16+" test that includes multiple metrics and leave the existing go 1.10 as-is, but that comes with its own drawbacks.

Anyway if there's interest i'm happy to help by cleaning up what i've started in whatever way seems best to the maintainers.

thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions