Skip to content

Commit 19f6298

Browse files
committed
Add benchmark results
1 parent 825ade8 commit 19f6298

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,60 @@ Options:
8989
-t, --test <value>: Test argument
9090
```
9191
92+
## Benchmarks
93+
94+
Some benchmarks comparing `slic` with other popular C++ command line parsers:
95+
96+
- [**CLI11**](https://github.com/CLIUtils/CLI11) (v2.6.1)
97+
- [**cxxopts**](https://github.com/jarro2783/cxxopts) (v3.3.1)
98+
- [**argparse**](https://github.com/p-ranav/argparse) (v3.2)
99+
100+
Benchmarks were run on an AMD Ryzen 7 7730U using Google Benchmark library in Release mode with `-O3` optimizations.
101+
102+
### 1. Simple case
103+
104+
`program -v --count 42 myfile.txt`
105+
106+
| Library | Time (ns) | CPU (ns) | Iterations |
107+
|----------|-----------|----------|------------|
108+
| slic | 51.8 | 51.6 | 13126669 |
109+
| CLI11 | 5752 | 5749 | 117156 |
110+
| cxxopts | 7951 | 7951 | 71121 |
111+
| argparse | 3531 | 3531 | 200750 |
112+
113+
### 2. Medium case
114+
115+
`program -v --count 42 --name test --level 3 --output out.txt input.txt`
116+
117+
| Library | Time (ns) | CPU (ns) | Iterations |
118+
|----------|-----------|----------|------------|
119+
| slic | 135 | 135 | 5237956 |
120+
| CLI11 | 12998 | 12995 | 54427 |
121+
| cxxopts | 15516 | 15510 | 43210 |
122+
| argparse | 6582 | 6577 | 114666 |
123+
124+
### 3. Complex case
125+
126+
`program -v --count 42 --name test --level 3 --output out.txt --debug --threads 8 --timeout 1000 --retry 3 input1.txt input2.txt`
127+
128+
| Library | Time (ns) | CPU (ns) | Iterations |
129+
|----------|-----------|----------|------------|
130+
| slic | 412 | 412 | 2178409 |
131+
| CLI11 | 28640 | 28623 | 25571 |
132+
| cxxopts | 36981 | 36940 | 22162 |
133+
| argparse | 11283 | 11278 | 59623 |
134+
135+
### 4. Flags only
136+
137+
`program -a -b -c -d -e -f -g -h`
138+
139+
| Library | Time (ns) | CPU (ns) | Iterations |
140+
|----------|-----------|----------|------------|
141+
| slic | 358 | 358 | 2089557 |
142+
| CLI11 | 12266 | 12259 | 57548 |
143+
| cxxopts | 17721 | 17711 | 55006 |
144+
| argparse | 5063 | 5061 | 135891 |
145+
92146
## License
93147
94148
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)