Skip to content

Commit

Permalink
add singer var benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ringsaturn committed Aug 11, 2024
1 parent 109c87e commit 9000b95
Showing 1 changed file with 45 additions and 26 deletions.
71 changes: 45 additions & 26 deletions mep/mep_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,36 +171,41 @@ func BenchmarkAlgoCalc(b *testing.B) {
}
}

var largeData [][]*goaqi.Var
var (
largeData [][]*goaqi.Var
lessData [][]*goaqi.Var

Check failure on line 176 in mep/mep_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

var `lessData` is unused (unused)
)

func init() {
for i := 0; i < 384; i++ {
largeData = append(largeData, []*goaqi.Var{
{
P: goaqi.PM2_5_1H,
Value: 16,
},
{
P: goaqi.PM10_1H,
Value: 88,
},
{
P: goaqi.CO_1H,
Value: 0.2,
},
{
P: goaqi.SO2_1H,
Value: 3,
},
{
P: goaqi.NO2_1H,
Value: 11,
},
{
P: goaqi.O3_1H,
Value: 75,
largeData = append(
largeData,
[]*goaqi.Var{
{
P: goaqi.PM2_5_1H,
Value: 16,
},
{
P: goaqi.PM10_1H,
Value: 88,
},
{
P: goaqi.CO_1H,
Value: 0.2,
},
{
P: goaqi.SO2_1H,
Value: 3,
},
{
P: goaqi.NO2_1H,
Value: 11,
},
{
P: goaqi.O3_1H,
Value: 75,
},
},
},
)
}
}
Expand All @@ -215,3 +220,17 @@ func BenchmarkAlgoCalcOnLargeData(b *testing.B) {
}()
}
}

func BenchmarkAlgoCalcOnSingleDataset(b *testing.B) {
algo := &mep.Algo{}
for i := 0; i < b.N; i++ {
func() {
_, _, _ = algo.Calc(
&goaqi.Var{
P: goaqi.PM10_1H,
Value: 88,
},
)
}()
}
}

0 comments on commit 9000b95

Please sign in to comment.