From 7b4d83660ad564f76a32a7135eb7a0e827a8c567 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 21 Dec 2021 23:43:13 +0200 Subject: [PATCH] examples: reduce progress update rate for path_tracing.v (less string interpolations/mallocs) --- examples/path_tracing.v | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/path_tracing.v b/examples/path_tracing.v index 59d5149631..8b17d10a1e 100644 --- a/examples/path_tracing.v +++ b/examples/path_tracing.v @@ -532,8 +532,10 @@ fn ray_trace(w int, h int, samps int, file_name string, scene_id int) Image { // OpenMP injection point! #pragma omp parallel for schedule(dynamic, 1) shared(c) for y := 0; y < h; y++ { - term.cursor_up(1) - eprintln('Rendering (${samps * 4} spp) ${(100.0 * f64(y)) / (f64(h) - 1.0):5.2f}%') + if y & 7 == 0 || y + 1 == h { + term.cursor_up(1) + eprintln('Rendering (${samps * 4} spp) ${(100.0 * f64(y)) / (f64(h) - 1.0):5.2f}%') + } for x in 0 .. w { i := (h - y - 1) * w + x mut ivec := unsafe { &image.data[i] }