mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
docs: add more documentation to each of the modules in vlib (#13043)
This commit is contained in:
@ -1,9 +1,8 @@
|
||||
## Description:
|
||||
|
||||
`benchmark` provides an easy way to measure how fast a piece of code is,
|
||||
and produce a readable report about it.
|
||||
`benchmark` provides tools for measuring and reporting on the performance of code.
|
||||
|
||||
## Example usage of this module:
|
||||
## Example 1:
|
||||
|
||||
```v
|
||||
import benchmark
|
||||
@ -25,12 +24,13 @@ bmark.stop()
|
||||
println(bmark.total_message('remarks about the benchmark'))
|
||||
```
|
||||
|
||||
benchmark.start() and b.measure() are convenience methods,
|
||||
`.start()` and `.measure()` are convenience methods,
|
||||
intended to be used in combination. Their goal is to make
|
||||
benchmarking of small snippets of code as *short*, easy to
|
||||
write, and then to read and analyze the results, as possible.
|
||||
benchmarking of small snippets of code as _short_, easy to
|
||||
write, and easy to read and analyze as possible.
|
||||
|
||||
## Example 2:
|
||||
|
||||
Example:
|
||||
```v
|
||||
import time
|
||||
import benchmark
|
||||
@ -45,6 +45,7 @@ b.measure('code_2')
|
||||
```
|
||||
|
||||
... which will produce on stdout something like this:
|
||||
|
||||
```text
|
||||
SPENT 1500.063 ms in code_1
|
||||
SPENT 500.061 ms in code_2
|
||||
|
Reference in New Issue
Block a user