1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-06-25 00:37:26 +02:00

Added some benchmarks (#139)

This commit is contained in:
Tim Voronov
2018-10-24 19:40:57 -04:00
committed by GitHub
parent ebea64da37
commit 19dbf12296
18 changed files with 932 additions and 230 deletions

View File

@ -329,3 +329,103 @@ func TestArrayOperator(t *testing.T) {
})
})
}
func BenchmarkArrayOperatorALL(b *testing.B) {
p := compiler.New().MustCompile(`
RETURN [1,2,3] ALL IN [1,2,3]
`)
for n := 0; n < b.N; n++ {
p.Run(context.Background())
}
}
func BenchmarkArrayOperatorALL2(b *testing.B) {
p := compiler.New().MustCompile(`
RETURN [1,2,4] ALL IN [1,2,3]
`)
for n := 0; n < b.N; n++ {
p.Run(context.Background())
}
}
func BenchmarkArrayOperatorANY(b *testing.B) {
p := compiler.New().MustCompile(`
RETURN [1,2,3] ANY IN [1,2,3]
`)
for n := 0; n < b.N; n++ {
p.Run(context.Background())
}
}
func BenchmarkArrayOperatorANY2(b *testing.B) {
p := compiler.New().MustCompile(`
RETURN [4,5,6] ANY IN [1,2,3]
`)
for n := 0; n < b.N; n++ {
p.Run(context.Background())
}
}
func BenchmarkArrayOperatorANY3(b *testing.B) {
p := compiler.New().MustCompile(`
RETURN [4,5,6] ANY NOT IN [1,2,3]
`)
for n := 0; n < b.N; n++ {
p.Run(context.Background())
}
}
func BenchmarkArrayOperatorANY4(b *testing.B) {
p := compiler.New().MustCompile(`
RETURN [1,2,3 ] ANY == 2
`)
for n := 0; n < b.N; n++ {
p.Run(context.Background())
}
}
func BenchmarkArrayOperatorNONE(b *testing.B) {
p := compiler.New().MustCompile(`
RETURN [1,2,3] NONE IN [1,2,3]
`)
for n := 0; n < b.N; n++ {
p.Run(context.Background())
}
}
func BenchmarkArrayOperatorNONE2(b *testing.B) {
p := compiler.New().MustCompile(`
RETURN [4,5,6] NONE IN [1,2,3]
`)
for n := 0; n < b.N; n++ {
p.Run(context.Background())
}
}
func BenchmarkArrayOperatorNONE3(b *testing.B) {
p := compiler.New().MustCompile(`
RETURN [4,5,6] NONE NOT IN [1,2,3]
`)
for n := 0; n < b.N; n++ {
p.Run(context.Background())
}
}
func BenchmarkArrayOperatorNONE4(b *testing.B) {
p := compiler.New().MustCompile(`
RETURN [1,2,3] NONE < 99
`)
for n := 0; n < b.N; n++ {
p.Run(context.Background())
}
}