From e5ae80119820428d88f931c7d0abdc24b456fa6e Mon Sep 17 00:00:00 2001 From: Tristan Morgan Date: Thu, 30 May 2024 10:22:40 +1000 Subject: [PATCH] Reset benchmark timer after setup. --- parser/execute_test.go | 1 + parser/tokenise_test.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/parser/execute_test.go b/parser/execute_test.go index b6a9dfb..0376591 100644 --- a/parser/execute_test.go +++ b/parser/execute_test.go @@ -70,6 +70,7 @@ func BenchmarkExecute(b *testing.B) { inputBuf := bufio.NewReader(strings.NewReader("80\n")) outputBuf := bufio.NewWriter(&bufferWriter{}) program, _ := Tokenise(buff) + b.ResetTimer() for i := 0; i < b.N; i++ { startdata := make([]int, 65536) Execute(startdata, program, inputBuf, outputBuf) diff --git a/parser/tokenise_test.go b/parser/tokenise_test.go index 7ae7c27..0c1f34d 100644 --- a/parser/tokenise_test.go +++ b/parser/tokenise_test.go @@ -172,8 +172,8 @@ func BenchmarkTokenise(b *testing.B) { b.Errorf("error opening program: err:") } buff := bufio.NewReader(sourceFile) + b.ResetTimer() for i := 0; i < b.N; i++ { Tokenise(buff) - } }