From e1201dfffb61dd464d91f443301c9b3370765029 Mon Sep 17 00:00:00 2001 From: odino Date: Sun, 26 May 2019 16:49:34 +0400 Subject: [PATCH] Benchmark for @mingwho's #227 --- Makefile | 4 +++- evaluator/evaluator_test.go | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e2ba82c0..354daf30 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,9 @@ fmt: go fmt ./... build: docker build -t abs . -test: +bench: + go test ./... -bench=. +test: bench # The -vet=off is as YOLO as it gets go test ./... -vet=off test_verbose: diff --git a/evaluator/evaluator_test.go b/evaluator/evaluator_test.go index bf2af530..a44b8faa 100644 --- a/evaluator/evaluator_test.go +++ b/evaluator/evaluator_test.go @@ -4,6 +4,7 @@ import ( "flag" "fmt" "runtime" + "strconv" "strings" "testing" @@ -185,6 +186,12 @@ func TestLazyEvaluation(t *testing.T) { } } +func BenchmarkLazyEvaluation(b *testing.B) { + for i := 0; i < b.N; i++ { + testEval(`false && 1..` + strconv.Itoa(i)) + } +} + func TestBangOperator(t *testing.T) { tests := []struct { input string