You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+27-32
Original file line number
Diff line number
Diff line change
@@ -7,25 +7,26 @@
7
7
8
8
zBench is a benchmarking library for the Zig programming language. It is designed to provide easy-to-use functionality to measure and compare the performance of your code.
For installation instructions, please refer to the [documentation](docs/install.md).
25
26
26
27
## Usage
27
28
28
-
Create a new benchmark function in your Zig code. This function should take a single argument of type `std.mem.Allocator`. The function would run the code you wish to benchmark.
29
+
Create a new benchmark function in your Zig code. This function takes a single argument of type `std.mem.Allocator` and runs the code you wish to benchmark.
-`iterations`: The number of iterations the benchmark has been run. This field is usually managed by zBench itself.
62
-
-`max_iterations`: Set the maximum number of iterations for a benchmark. Useful for controlling long-running benchmarks.
63
-
-`time_budget_ns`: Define a time budget for the benchmark in nanoseconds. Helps in limiting the total execution time of the benchmark.
64
-
-`hooks`: Set `before_all`, `after_all`, `before_each`, and `after_each` hooks to function pointers.
65
-
-`track_allocations`: Boolean to enable or disable tracking memory allocations during the benchmark.
62
+
*`iterations`: The number of iterations the benchmark has been run. This field is usually managed by zBench itself.
63
+
*`max_iterations`: Set the maximum number of iterations for a benchmark. Useful for controlling long-running benchmarks.
64
+
*`time_budget_ns`: Define a time budget for the benchmark in nanoseconds. Helps in limiting the total execution time of the benchmark.
65
+
*`hooks`: Set `before_all`, `after_all`, `before_each`, and `after_each` hooks to function pointers.
66
+
*`track_allocations`: Boolean to enable or disable tracking memory allocations during the benchmark.
66
67
67
68
### Compatibility Notes
68
69
69
-
Zig is in active development and the APIs can change frequently, making it challenging to support every dev build. This project currently aims to be compatible with stable, non-development builds to provide a consistent experience for the users.
70
+
#### Zig version
70
71
71
-
**_Supported Version_**: As of now, zBench is tested and supported on Zig version **_0.13.0_**.
72
+
Zig is in active development and the APIs can change frequently, making it challenging to support every dev build. This project currently aims to be compatible with stable, non-development builds to provide a consistent experience for the users. As of now, zBench is tested and supported on Zig version **_0.13.0_**.
72
73
73
-
**_Performance Note:_** It's important to acknowledge that a no-op time of 15 ns (or more) is expected and is not an issue with zBench itself. This is a normal occurrence and does not reflect any inefficiency in the benchmarking process.
74
+
#### Performance Note
74
75
75
-
### Benchmark Functions
76
-
77
-
Benchmark functions have the following signature:
78
-
79
-
```zig
80
-
fn(allocator: std.mem.Allocator) void
81
-
```
82
-
83
-
The function body contains the code you wish to benchmark.
76
+
It's important to acknowledge that a no-op time of ca. 15 ns (or more) is expected and is not an issue with zBench itself (see also [#77](https://github.com/hendriknielaender/zBench/issues/77)). This does not reflect an inefficiency in the benchmarking process.
84
77
85
78
### Reporting Benchmarks
86
79
@@ -97,16 +90,18 @@ The minimum and maximum execution times were 100 ms and 2000 ms, respectively. T
97
90
98
91
### Running zBench Examples
99
92
100
-
You can run all example tests with the following command:
93
+
You can build all examples with the following command:
101
94
102
95
```shell
103
96
zig build examples
104
97
```
105
98
99
+
Executables can then be found in `./zig-out/bin` by default.
100
+
106
101
### Troubleshooting
107
102
108
-
- If Zig doesn't detect changes in a dependency, clear the project's `zig-cache` folder and `~/.cache/zig`.
109
-
-[Non-ASCII characters not printed correctly on Windows](docs/advanced.md)
103
+
* If Zig doesn't detect changes in a dependency, clear the project's `zig-cache` folder and `~/.cache/zig`.
104
+
*[Non-ASCII characters not printed correctly on Windows](docs/advanced.md)
0 commit comments