mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-26 09:54:19 +00:00
@@ -4,7 +4,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/tendermint/tendermint/libs/pubsub/query"
|
||||
oldquery "github.com/tendermint/tendermint/libs/pubsub/query/oldquery"
|
||||
)
|
||||
|
||||
const testQuery = `tm.events.type='NewBlock' AND abci.account.name='Igor'`
|
||||
@@ -21,15 +20,6 @@ var testEvents = map[string][]string{
|
||||
},
|
||||
}
|
||||
|
||||
func BenchmarkParsePEG(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err := oldquery.New(testQuery)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkParseCustom(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err := query.New(testQuery)
|
||||
@@ -39,22 +29,6 @@ func BenchmarkParseCustom(b *testing.B) {
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkMatchPEG(b *testing.B) {
|
||||
q, err := oldquery.New(testQuery)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
ok, err := q.Matches(testEvents)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
} else if !ok {
|
||||
b.Error("no match")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkMatchCustom(b *testing.B) {
|
||||
q, err := query.New(testQuery)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user