From 6debc7623ee975b326cf9c886386653285542889 Mon Sep 17 00:00:00 2001 From: Suyash Kumar Date: Mon, 20 Feb 2023 17:38:37 -0500 Subject: [PATCH] Preset buffer size in benchmark setup. --- Makefile | 4 ++-- read_test.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 277a6904..c1950738 100644 --- a/Makefile +++ b/Makefile @@ -37,8 +37,8 @@ release: zip -r ${BINARY}-windows-amd64.exe.zip ${BINARY}-windows-amd64.exe; bench-diff: - go test -bench . -count 5 > bench_current.txt + go test -bench . -benchtime=50x -count 5 > bench_current.txt git checkout main - go test -bench . -count 5 > bench_main.txt + go test -bench . -benchtime=50x -count 5 > bench_main.txt benchstat bench_main.txt bench_current.txt git checkout - diff --git a/read_test.go b/read_test.go index 9b8b3a63..474c3ea6 100644 --- a/read_test.go +++ b/read_test.go @@ -792,6 +792,7 @@ func buildReadNativeFramesInput(rows, cols, numFrames, samplesPerPixel int, b *t }, } dcmdata := bytes.Buffer{} + dcmdata.Grow(2 * numFrames * rows * cols * samplesPerPixel) for fr := 0; fr < numFrames; fr++ { for r := 0; r < rows; r++ { for c := 0; c < cols; c++ {