prometheus / common

Go libraries shared across Prometheus components and libraries.
Apache License 2.0
259 stars 306 forks source link

LabelSet.String: restore faster sort call #619

Closed bboreham closed 2 months ago

bboreham commented 2 months ago

This was changed without explanation at #617; let's put it back.

goos: darwin
goarch: arm64
pkg: github.com/prometheus/common/model
                       │ before.txt  │             after.txt              │
                       │   sec/op    │   sec/op     vs base               │
LabelSetStringMethod-8   500.4n ± 0%   434.4n ± 0%  -13.19% (p=0.002 n=6)

                       │ before.txt  │             after.txt             │
                       │    B/op     │    B/op     vs base               │
LabelSetStringMethod-8   616.00 ± 0%   80.00 ± 0%  -87.01% (p=0.002 n=6)

                       │ before.txt │             after.txt             │
                       │ allocs/op  │ allocs/op   vs base               │
LabelSetStringMethod-8   3.000 ± 0%   1.000 ± 0%  -66.67% (p=0.002 n=6)