-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
120 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/pint | ||
/.cover | ||
/memprofile.out | ||
/dist/ | ||
/.vscode/ | ||
/cmd/pint/bench/rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
REVISION := 31a27fb9e0e778bd8fe6097aa58c8ea598fe9cec | ||
|
||
.PHONE: fetch | ||
fetch: | ||
curl -sL -o archive.tar.gz https://github.com/samber/awesome-prometheus-alerts/archive/$(REVISION).tar.gz | ||
tar -xf archive.tar.gz | ||
rm -fr rules | ||
mv awesome-prometheus-alerts-$(REVISION)/dist/rules rules | ||
rm -fr awesome-prometheus-alerts-$(REVISION) archive.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Benchmark data | ||
|
||
A collection of Prometheus rules copied from | ||
[samber/awesome-prometheus-alerts](https://github.com/samber/awesome-prometheus-alerts) | ||
and used to benchmark pint. | ||
|
||
Run `make fetch` first to download and unpack rules into `rules` folder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"log/slog" | ||
"testing" | ||
|
||
"github.com/prometheus/client_golang/prometheus" | ||
|
||
"github.com/cloudflare/pint/internal/config" | ||
"github.com/cloudflare/pint/internal/discovery" | ||
"github.com/cloudflare/pint/internal/git" | ||
"github.com/cloudflare/pint/internal/log" | ||
) | ||
|
||
func BenchmarkFindEntries(b *testing.B) { | ||
log.Setup(slog.LevelError, true) | ||
|
||
finder := discovery.NewGlobFinder( | ||
[]string{"bench/rules"}, | ||
git.NewPathFilter(nil, nil, nil), | ||
) | ||
for n := 0; n < b.N; n++ { | ||
_, _ = finder.Find() | ||
} | ||
} | ||
|
||
func BenchmarkCheckRules(b *testing.B) { | ||
log.Setup(slog.LevelError, true) | ||
|
||
finder := discovery.NewGlobFinder( | ||
[]string{"bench/rules"}, | ||
git.NewPathFilter(nil, nil, nil), | ||
) | ||
entries, err := finder.Find() | ||
if err != nil { | ||
b.Errorf("Find() error: %s", err) | ||
b.FailNow() | ||
} | ||
|
||
ctx := context.Background() | ||
cfg, _ := config.Load("", false) | ||
gen := config.NewPrometheusGenerator(cfg, prometheus.NewRegistry()) | ||
for n := 0; n < b.N; n++ { | ||
_, _ = checkRules(ctx, 10, true, gen, cfg, entries) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module _ | ||
|
||
go 1.21.4 | ||
|
||
require golang.org/x/perf v0.0.0-20231127181059-b53752263861 | ||
|
||
require github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794 // indirect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794 h1:xlwdaKcTNVW4PtpQb8aKA4Pjy0CdJHEqvFbAnvR5m2g= | ||
github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794/go.mod h1:7e+I0LQFUI9AXWxOfsQROs9xPhoJtbsyWcjJqDd4KPY= | ||
golang.org/x/perf v0.0.0-20231127181059-b53752263861 h1:oWUgm6RG0ZUKQeX7wxjnX+TFCrXDSheBtpiy5vpUdZg= | ||
golang.org/x/perf v0.0.0-20231127181059-b53752263861/go.mod h1:sKqUfjZtdM78wIFCYFnmu2FhhanvRUbp67Zgmj3TZPM= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//go:build tools | ||
|
||
package tools | ||
|
||
import ( | ||
_ "golang.org/x/perf/cmd/benchstat" | ||
) |
36e77a3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
1
.BenchmarkFindEntries - ns/op
107649694
ns/op105918741
ns/op1.02
BenchmarkFindEntries - B/op
72722530
B/op72700400
B/op1.00
BenchmarkFindEntries - allocs/op
540043
allocs/op539957
allocs/op1.00
BenchmarkFindEntries - ns/op
113862750
ns/op105918741
ns/op1.08
BenchmarkFindEntries - B/op
72713478
B/op72700400
B/op1.00
BenchmarkFindEntries - allocs/op
540028
allocs/op539957
allocs/op1.00
BenchmarkFindEntries - ns/op
107934465
ns/op105918741
ns/op1.02
BenchmarkFindEntries - B/op
72717778
B/op72700400
B/op1.00
BenchmarkFindEntries - allocs/op
540056
allocs/op539957
allocs/op1.00
BenchmarkFindEntries - ns/op
107229985
ns/op105918741
ns/op1.01
BenchmarkFindEntries - B/op
72716580
B/op72700400
B/op1.00
BenchmarkFindEntries - allocs/op
540038
allocs/op539957
allocs/op1.00
BenchmarkFindEntries - ns/op
108577451
ns/op105918741
ns/op1.03
BenchmarkFindEntries - B/op
72733831
B/op72700400
B/op1.00
BenchmarkFindEntries - allocs/op
540060
allocs/op539957
allocs/op1.00
BenchmarkFindEntries - ns/op
108884478
ns/op105918741
ns/op1.03
BenchmarkFindEntries - B/op
72723761
B/op72700400
B/op1.00
BenchmarkFindEntries - allocs/op
540047
allocs/op539957
allocs/op1.00
BenchmarkFindEntries - ns/op
107979912
ns/op105918741
ns/op1.02
BenchmarkFindEntries - B/op
72726291
B/op72700400
B/op1.00
BenchmarkFindEntries - allocs/op
540049
allocs/op539957
allocs/op1.00
BenchmarkFindEntries - ns/op
108059454
ns/op105918741
ns/op1.02
BenchmarkFindEntries - B/op
72716228
B/op72700400
B/op1.00
BenchmarkFindEntries - allocs/op
540018
allocs/op539957
allocs/op1.00
BenchmarkFindEntries - ns/op
108098278
ns/op105918741
ns/op1.02
BenchmarkFindEntries - B/op
72725500
B/op72700400
B/op1.00
BenchmarkFindEntries - allocs/op
540056
allocs/op539957
allocs/op1.00
BenchmarkFindEntries - ns/op
109500115
ns/op105918741
ns/op1.03
BenchmarkFindEntries - B/op
72725580
B/op72700400
B/op1.00
BenchmarkFindEntries - allocs/op
540041
allocs/op539957
allocs/op1.00
BenchmarkCheckRules - B/op
133239487
B/op133233465
B/op1.00
BenchmarkCheckRules - allocs/op
959661
allocs/op959608
allocs/op1.00
BenchmarkCheckRules - ns/op
108450728
ns/op107024323
ns/op1.01
BenchmarkCheckRules - allocs/op
959620
allocs/op959608
allocs/op1.00
BenchmarkCheckRules - ns/op
107360030
ns/op107024323
ns/op1.00
BenchmarkCheckRules - allocs/op
959615
allocs/op959608
allocs/op1.00
BenchmarkCheckRules - ns/op
109200169
ns/op107024323
ns/op1.02
BenchmarkCheckRules - B/op
133234136
B/op133233465
B/op1.00
BenchmarkCheckRules - allocs/op
959636
allocs/op959608
allocs/op1.00
BenchmarkCheckRules - ns/op
107863341
ns/op107024323
ns/op1.01
BenchmarkCheckRules - ns/op
107738005
ns/op107024323
ns/op1.01
BenchmarkCheckRules - ns/op
107360051
ns/op107024323
ns/op1.00
BenchmarkCheckRules - allocs/op
959610
allocs/op959608
allocs/op1.00
BenchmarkCheckRules - ns/op
107250315
ns/op107024323
ns/op1.00
BenchmarkCheckRules - ns/op
107872018
ns/op107024323
ns/op1.01
BenchmarkCheckRules - allocs/op
959613
allocs/op959608
allocs/op1.00
BenchmarkCheckRules - ns/op
107223347
ns/op107024323
ns/op1.00
BenchmarkCheckRules - allocs/op
959616
allocs/op959608
allocs/op1.00
This comment was automatically generated by workflow using github-action-benchmark.