From 9eb91984dd3daddd47b69a396791b2947ccf9ade Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 13 Nov 2023 19:48:57 +0530 Subject: [PATCH] Cleanup benchmark warmup code --- tools/cmd/benchmark/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/cmd/benchmark/main.go b/tools/cmd/benchmark/main.go index 81d93c000..93436b06a 100644 --- a/tools/cmd/benchmark/main.go +++ b/tools/cmd/benchmark/main.go @@ -232,10 +232,14 @@ func main(args []string) (err error) { var results []result var r result // First warm up the terminal by getting it to render all chars so that font rendering - // time is not polluting out benchmarks. - if _, _, err = benchmark_data(ascii_printable+chinese_lorem_ipsum+misc_unicode, default_benchmark_options()); err != nil { + // time is not polluting the benchmarks. + opts := default_benchmark_options() + opts.repeat_count = 1 + if _, _, err = benchmark_data(ascii_printable+chinese_lorem_ipsum+misc_unicode, opts); err != nil { return err } + time.Sleep(time.Second / 2) + if slices.Index(args, "ascii") >= 0 { if r, err = simple_ascii(); err != nil { return err