Skip to content

Commit

Permalink
Implemented for-loop limit
Browse files Browse the repository at this point in the history
  • Loading branch information
ziflex committed Nov 8, 2024
1 parent 326db40 commit 866fb9d
Show file tree
Hide file tree
Showing 9 changed files with 349 additions and 124 deletions.
51 changes: 50 additions & 1 deletion pkg/compiler/compiler_bench_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
package compiler_test

import "testing"
import (
"testing"
)

func BenchmarkStringLiteral(b *testing.B) {
RunBenchmark(b, `
RETURN "
FOO
BAR
"
`)
}

func BenchmarkEmptyArray(b *testing.B) {
RunBenchmark(b, `RETURN []`)
Expand All @@ -14,6 +25,44 @@ func BenchmarkEmptyObject(b *testing.B) {
RunBenchmark(b, `RETURN {}`)
}

func BenchmarkUnaryOperatorExcl(b *testing.B) {
RunBenchmark(b, `RETURN !TRUE`)
}

func BenchmarkUnaryOperatorQ(b *testing.B) {
RunBenchmark(b, `
LET foo = TRUE
RETURN !foo ? TRUE : FALSE
`)
}

func BenchmarkUnaryOperatorN(b *testing.B) {
RunBenchmark(b, `
LET v = 1
RETURN -v
`)
}

func BenchmarkTernaryOperator(b *testing.B) {
RunBenchmark(b, `
LET a = "a"
LET b = "b"
LET c = FALSE
RETURN c ? a : b;
`)
}

func BenchmarkTernaryOperatorDef(b *testing.B) {
RunBenchmark(b, `
LET a = "a"
LET b = "b"
LET c = FALSE
RETURN c ? : a;
`)
}

func BenchmarkForEmpty(b *testing.B) {
RunBenchmark(b, `
FOR i IN []
Expand Down
Loading

0 comments on commit 866fb9d

Please sign in to comment.