mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
benchmark: update the example in the README.md
This commit is contained in:
parent
ab3c1f2a08
commit
3aeca70970
@ -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
|
||||
```text
|
||||
SPENT 1500.063 ms in code_1
|
||||
SPENT 500.061 ms in code_2
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user