Skip to content

Commit a44c95a

Browse files
authored
revise readme (#94)
* revise readme * remove duplicated benchmark function info, formatting of compatibility section
1 parent 0d5417d commit a44c95a

File tree

1 file changed

+27
-32
lines changed

1 file changed

+27
-32
lines changed

README.md

+27-32
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,26 @@
77

88
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.
99

10-
## Content
11-
* [Installation](docs/install.md)
12-
* [Usage](#usage)
13-
* [Configuration](#configuration)
14-
+ [Compatibility Notes](#compatibility-notes)
15-
+ [Benchmark Functions](#benchmark-functions)
16-
+ [Reporting Benchmarks](#reporting-benchmarks)
17-
+ [Running zBench Examples](#running-zbench-examples)
18-
+ [Troubleshooting](#troubleshooting)
19-
* [Contributing](#contributing)
20-
* [License](#license)
10+
## Content
11+
12+
* [Installation](docs/install.md)
13+
* [Usage](#usage)
14+
* [Configuration](#configuration)
15+
* [Compatibility Notes](#compatibility-notes)
16+
* [Benchmark Functions](#benchmark-functions)
17+
* [Reporting Benchmarks](#reporting-benchmarks)
18+
* [Running zBench Examples](#running-zbench-examples)
19+
* [Troubleshooting](#troubleshooting)
20+
* [Contributing](#contributing)
21+
* [License](#license)
2122

2223
## Installation
2324

2425
For installation instructions, please refer to the [documentation](docs/install.md).
2526

2627
## Usage
2728

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.
2930

3031
```zig
3132
fn benchmarkMyFunction(allocator: std.mem.Allocator) void {
@@ -58,29 +59,21 @@ pub const Config = struct {
5859
};
5960
```
6061

61-
- `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.
6667

6768
### Compatibility Notes
6869

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
7071

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_**.
7273

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
7475

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.
8477

8578
### Reporting Benchmarks
8679

@@ -97,16 +90,18 @@ The minimum and maximum execution times were 100 ms and 2000 ms, respectively. T
9790

9891
### Running zBench Examples
9992

100-
You can run all example tests with the following command:
93+
You can build all examples with the following command:
10194

10295
```shell
10396
zig build examples
10497
```
10598

99+
Executables can then be found in `./zig-out/bin` by default.
100+
106101
### Troubleshooting
107102

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)
110105

111106
## Contributing
112107

0 commit comments

Comments
 (0)