Skip to content

Commit

Permalink
Updates some benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
ziflex committed Nov 8, 2024
1 parent 7526bab commit fff3c6e
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 14 deletions.
50 changes: 40 additions & 10 deletions pkg/compiler/compiler_array_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,11 @@ func BenchmarkArrayOperatorALL(b *testing.B) {
RETURN [1,2,3] ALL IN [1,2,3]
`)

ctx := context.Background()
b.ResetTimer()

for n := 0; n < b.N; n++ {
p.Run(context.Background())
p.Run(ctx)
}
}

Expand All @@ -347,8 +350,11 @@ func BenchmarkArrayOperatorALL2(b *testing.B) {
RETURN [1,2,4] ALL IN [1,2,3]
`)

ctx := context.Background()
b.ResetTimer()

for n := 0; n < b.N; n++ {
p.Run(context.Background())
p.Run(ctx)
}
}

Expand All @@ -357,8 +363,11 @@ func BenchmarkArrayOperatorANY(b *testing.B) {
RETURN [1,2,3] ANY IN [1,2,3]
`)

ctx := context.Background()
b.ResetTimer()

for n := 0; n < b.N; n++ {
p.Run(context.Background())
p.Run(ctx)
}
}

Expand All @@ -367,8 +376,11 @@ func BenchmarkArrayOperatorANY2(b *testing.B) {
RETURN [4,5,6] ANY IN [1,2,3]
`)

ctx := context.Background()
b.ResetTimer()

for n := 0; n < b.N; n++ {
p.Run(context.Background())
p.Run(ctx)
}
}

Expand All @@ -377,8 +389,11 @@ func BenchmarkArrayOperatorANY3(b *testing.B) {
RETURN [4,5,6] ANY NOT IN [1,2,3]
`)

ctx := context.Background()
b.ResetTimer()

for n := 0; n < b.N; n++ {
p.Run(context.Background())
p.Run(ctx)
}
}

Expand All @@ -387,8 +402,11 @@ func BenchmarkArrayOperatorANY4(b *testing.B) {
RETURN [1,2,3 ] ANY == 2
`)

ctx := context.Background()
b.ResetTimer()

for n := 0; n < b.N; n++ {
p.Run(context.Background())
p.Run(ctx)
}
}

Expand All @@ -397,8 +415,11 @@ func BenchmarkArrayOperatorNONE(b *testing.B) {
RETURN [1,2,3] NONE IN [1,2,3]
`)

ctx := context.Background()
b.ResetTimer()

for n := 0; n < b.N; n++ {
p.Run(context.Background())
p.Run(ctx)
}
}

Expand All @@ -407,8 +428,11 @@ func BenchmarkArrayOperatorNONE2(b *testing.B) {
RETURN [4,5,6] NONE IN [1,2,3]
`)

ctx := context.Background()
b.ResetTimer()

for n := 0; n < b.N; n++ {
p.Run(context.Background())
p.Run(ctx)
}
}

Expand All @@ -417,8 +441,11 @@ func BenchmarkArrayOperatorNONE3(b *testing.B) {
RETURN [4,5,6] NONE NOT IN [1,2,3]
`)

ctx := context.Background()
b.ResetTimer()

for n := 0; n < b.N; n++ {
p.Run(context.Background())
p.Run(ctx)
}
}

Expand All @@ -427,7 +454,10 @@ func BenchmarkArrayOperatorNONE4(b *testing.B) {
RETURN [1,2,3] NONE < 99
`)

ctx := context.Background()
b.ResetTimer()

for n := 0; n < b.N; n++ {
p.Run(context.Background())
p.Run(ctx)
}
}
15 changes: 12 additions & 3 deletions pkg/compiler/compiler_collect_aggregate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,11 @@ func BenchmarkAggregate(b *testing.B) {
}
`)

ctx := context.Background()
b.ResetTimer()

for n := 0; n < b.N; n++ {
p.Run(context.Background())
p.Run(ctx)
}
}

Expand Down Expand Up @@ -256,8 +259,11 @@ func BenchmarkAggregate2(b *testing.B) {
RETURN ages
`)

ctx := context.Background()
b.ResetTimer()

for n := 0; n < b.N; n++ {
p.Run(context.Background())
p.Run(ctx)
}
}

Expand Down Expand Up @@ -305,7 +311,10 @@ func BenchmarkAggregate3(b *testing.B) {
}
`)

ctx := context.Background()
b.ResetTimer()

for n := 0; n < b.N; n++ {
p.Run(context.Background())
p.Run(ctx)
}
}
5 changes: 4 additions & 1 deletion pkg/compiler/compiler_collect_count_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ func BenchmarkCollectCount(b *testing.B) {
RETURN c
`)

ctx := context.Background()
b.ResetTimer()

for n := 0; n < b.N; n++ {
p.Run(context.Background())
p.Run(ctx)
}
}
2 changes: 2 additions & 0 deletions pkg/compiler/compiler_for_ternary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ func BenchmarkForTernary(b *testing.B) {
RETURN foo ? TRUE : (FOR i IN 1..5 RETURN i*2)
`)

b.ResetTimer()

for n := 0; n < b.N; n++ {
p.Run(context.Background())
}
Expand Down

0 comments on commit fff3c6e

Please sign in to comment.