From 3aeca70970a606d72ce079d04024e5504b65c370 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sat, 11 Jul 2020 11:49:11 +0300 Subject: [PATCH] benchmark: update the example in the README.md --- vlib/benchmark/README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/vlib/benchmark/README.md b/vlib/benchmark/README.md index de1c8e4c52..8e059d248a 100644 --- a/vlib/benchmark/README.md +++ b/vlib/benchmark/README.md @@ -25,15 +25,20 @@ benchmarking of small snippets of code as *short*, easy to write, and then to read and analyze the results, as possible. Example: ```v +import time import benchmark -b := benchmark.start() +mut b := benchmark.start() -// your code 1 ... +// your code section 1 ... +time.sleep_ms(1500) b.measure('code_1') -// your code 2 ... +// your code section 2 ... +time.sleep_ms(500) b.measure('code_2') ``` ... which will produce on stdout something like this: -SPENT 17 ms in code_1 -SPENT 462 ms in code_2 \ No newline at end of file +```text +SPENT 1500.063 ms in code_1 +SPENT 500.061 ms in code_2 +```