Skip to content

Commit df2eff5

Browse files
committed
Generate SVG for benchmarking results and display in README
1 parent 5cd74de commit df2eff5

File tree

7 files changed

+8331
-278
lines changed

7 files changed

+8331
-278
lines changed

spdlog/benches/README.md

Lines changed: 10 additions & 278 deletions
Original file line numberDiff line numberDiff line change
@@ -28,291 +28,23 @@ The following results are generated on `Windows 10 64 bit` and `Intel i9-10900KF
2828
test bench_5_level_off ... bench: 1.43 ns/iter (+/- 0.02)
2929
```
3030

31-
<details><summary><b>Compared with other Rust crates</b></summary>
31+
### Compared with other Rust crates
3232

33-
#### Disclaimer
33+
> [!NOTE]
34+
> Disclaimer: I'm not entirely familiar with using the other Rust crates below, so if you find a bug or something worth improving in the benchmark code, feel free to open an issue to let me know.
3435
35-
I'm not entirely familiar with using the other Rust crates below, so if you find a bug or something worth improving in the benchmark code, feel free to open an issue to let me know.
36+
For the full benchmarking results data, see file [./results/data.toml](./results/data.toml).
3637

37-
### `tracing` (0.1.41), `tracing-subscriber` (0.3.20), `tracing-appender` (0.2.3)
38+
![](./results/chart-rust-sync.svg)
3839

39-
```
40-
test bench_1_file ... bench: 2,479.67 ns/iter (+/- 224.87)
41-
test bench_2_file_async ... bench: 699.95 ns/iter (+/- 47.68)
42-
test bench_3_rotating_file_size ... unavailable
43-
test bench_4_rotating_daily ... bench: 2,473.01 ns/iter (+/- 244.29)
44-
test bench_5_level_off ... bench: 0.39 ns/iter (+/- 0.03)
45-
```
40+
![](./results/chart-rust-async.svg)
4641

47-
### `slog` (2.7.0), `sloggers` (2.2.0)
42+
### Compared with C++ spdlog
4843

49-
```
50-
test bench_1_file ... unavailable
51-
test bench_2_file_async ... bench: 446.12 ns/iter (+/- 28.20)
52-
test bench_3_rotating_file_size_async ... bench: 447.39 ns/iter (+/- 30.20)
53-
test bench_4_rotating_daily ... unavailable
54-
test bench_5_level_off ... bench: 1.76 ns/iter (+/- 0.10)
55-
```
44+
Compiler for C++ spdlog is `MSVC 19.44.35217.0`.
5645

57-
### `flexi_logger` (0.31.4)
46+
![](./results/chart-cpp-sync.svg)
5847

59-
```
60-
test bench_1_file ... bench: 1,172.30 ns/iter (+/- 73.46)
61-
test bench_2_file_async ... unavailable
62-
test bench_3_rotating_file_size ... bench: 1,206.46 ns/iter (+/- 109.38)
63-
test bench_4_rotating_daily ... bench: 1,510.36 ns/iter (+/- 101.03)
64-
test bench_5_level_off ... bench: 0.20 ns/iter (+/- 0.02)
65-
```
66-
67-
### `log4rs` (1.4.0)
68-
69-
```
70-
test bench_1_file ... bench: 2,931.94 ns/iter (+/- 201.13)
71-
test bench_2_file_async ... unavailable
72-
test bench_3_rotating_file_size ... bench: 2,968.21 ns/iter (+/- 141.19)
73-
test bench_4_rotating_daily ... unavailable
74-
test bench_5_level_off ... bench: 0.20 ns/iter (+/- 0.01)
75-
```
76-
77-
### `fern` (0.7.1)
78-
79-
```
80-
test bench_1_file ... bench: 2,927.74 ns/iter (+/- 180.88)
81-
test bench_2_file_async ... unavailable
82-
test bench_3_rotating_file_size ... unavailable
83-
test bench_4_rotating_daily ... unavailable
84-
test bench_5_level_off ... bench: 0.20 ns/iter (+/- 0.02)
85-
```
86-
87-
### `ftlog` (0.2.15)
88-
89-
```
90-
test bench_1_file ... unavailable
91-
test bench_2_file_async ... bench: 233.98 ns/iter (+/- 22.20)
92-
test bench_3_rotating_file_size ... unavailable
93-
test bench_4_rotating_daily ... bench: 239.08 ns/iter (+/- 20.10)
94-
test bench_5_level_off ... bench: 0.20 ns/iter (+/- 0.01)
95-
```
96-
97-
### `fast_log` (1.7.7)
98-
99-
```
100-
test bench_1_file ... unavailable
101-
test bench_2_file_async ... bench: 246.59 ns/iter (+/- 3,179.82)
102-
test bench_3_rotating_file_size_async ... bench: 255.32 ns/iter (+/- 631.78)
103-
test bench_4_rotating_daily_async ... bench: 206.69 ns/iter (+/- 653.65)
104-
test bench_5_level_off ... bench: 0.20 ns/iter (+/- 0.02)
105-
```
106-
107-
### `logforth` (0.27.0)
108-
109-
```
110-
test bench_1_file ... unavailable
111-
test bench_2_file_async ... bench: 780.12 ns/iter (+/- 44.93)
112-
test bench_3_rotating_file_size_async ... bench: 918.14 ns/iter (+/- 47.00)
113-
test bench_4_rotating_daily_async ... bench: 907.25 ns/iter (+/- 71.37)
114-
test bench_5_level_off ... bench: 5.88 ns/iter (+/- 0.43)
115-
```
116-
</details>
117-
118-
<details><summary><b>Compared with C++ spdlog</b></summary>
119-
120-
### `spdlog-rs` (0.5.0)
121-
122-
- Default features (corresponds to C++ `spdlog` using standard `<format>`)
123-
124-
- Sync
125-
126-
```
127-
[info] **********************************************************************
128-
[info] Multi threaded: 1 threads, 250000 messages
129-
[info] **********************************************************************
130-
[info] basic_mt Elapsed: 0.08 secs 3092991/sec
131-
[info] rotating_mt Elapsed: 0.08 secs 3096838/sec
132-
[info] daily_mt Elapsed: 0.08 secs 3181888/sec
133-
[info] level-off Elapsed: 0.00 secs 567150635/sec
134-
[info] **********************************************************************
135-
[info] Multi threaded: 4 threads, 250000 messages
136-
[info] **********************************************************************
137-
[info] basic_mt Elapsed: 0.07 secs 3605209/sec
138-
[info] rotating_mt Elapsed: 0.07 secs 3519391/sec
139-
[info] daily_mt Elapsed: 0.08 secs 3332786/sec
140-
[info] level-off Elapsed: 0.00 secs 687947165/sec
141-
```
142-
143-
- Async
144-
145-
```
146-
[info] --------------------------------------------
147-
[info] Messages : 1000000
148-
[info] Threads : 10
149-
[info] Queue : 8192 slots
150-
[info] Queue memory : 8192 x 136 = 1088 KB
151-
[info] Total iters : 3
152-
[info] --------------------------------------------
153-
[info]
154-
[info] ********************************************
155-
[info] Queue Overflow Policy: Block
156-
[info] ********************************************
157-
[info] Elapsed: 0.4880718 secs 2048878/sec
158-
[info] Elapsed: 0.4717359 secs 2119830/sec
159-
[info] Elapsed: 0.4589705 secs 2178789/sec
160-
[info]
161-
[info] ********************************************
162-
[info] Queue Overflow Policy: DropIncoming
163-
[info] ********************************************
164-
[info] Elapsed: 0.1043783 secs 9580535/sec
165-
[info] Elapsed: 0.1039465 secs 9620333/sec
166-
[info] Elapsed: 0.104625 secs 9557945/sec
167-
```
168-
169-
- Enable `flexible-string` feature (corresponds to C++ `spdlog` using `fmt` library)
170-
171-
- Sync
172-
173-
```
174-
[info] **********************************************************************
175-
[info] Multi threaded: 1 threads, 250000 messages
176-
[info] **********************************************************************
177-
[info] basic_mt Elapsed: 0.07 secs 3660086/sec
178-
[info] rotating_mt Elapsed: 0.07 secs 3666522/sec
179-
[info] daily_mt Elapsed: 0.07 secs 3597096/sec
180-
[info] level-off Elapsed: 0.00 secs 508957654/sec
181-
[info] **********************************************************************
182-
[info] Multi threaded: 4 threads, 250000 messages
183-
[info] **********************************************************************
184-
[info] basic_mt Elapsed: 0.07 secs 3572576/sec
185-
[info] rotating_mt Elapsed: 0.07 secs 3410138/sec
186-
[info] daily_mt Elapsed: 0.07 secs 3552902/sec
187-
[info] level-off Elapsed: 0.00 secs 724427702/sec
188-
```
189-
190-
- Async
191-
192-
```
193-
[info] --------------------------------------------
194-
[info] Messages : 1000000
195-
[info] Threads : 10
196-
[info] Queue : 8192 slots
197-
[info] Queue memory : 8192 x 136 = 1088 KB
198-
[info] Total iters : 3
199-
[info] --------------------------------------------
200-
[info]
201-
[info] ********************************************
202-
[info] Queue Overflow Policy: Block
203-
[info] ********************************************
204-
[info] Elapsed: 0.4305708 secs 2322498/sec
205-
[info] Elapsed: 0.4584145 secs 2181431/sec
206-
[info] Elapsed: 0.4509432 secs 2217574/sec
207-
[info]
208-
[info] ********************************************
209-
[info] Queue Overflow Policy: DropIncoming
210-
[info] ********************************************
211-
[info] Elapsed: 0.1058637 secs 9446108/sec
212-
[info] Elapsed: 0.1072791 secs 9321480/sec
213-
[info] Elapsed: 0.1063269 secs 9404957/sec
214-
```
215-
216-
### C++ `spdlog` (1.15.3)
217-
218-
Compiler `MSVC 19.44.35217.0`.
219-
220-
- Using standard `<format>`
221-
(compiled with `cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DSPDLOG_BUILD_BENCH=ON -DSPDLOG_BUILD_EXAMPLE=OFF -DSPDLOG_USE_STD_FORMAT=ON`)
222-
223-
- Sync
224-
225-
```
226-
[info] **************************************************************
227-
[info] Multi threaded: 1 threads, 250,000 messages
228-
[info] **************************************************************
229-
[info] basic_mt Elapsed: 0.12 secs 2,118,970/sec
230-
[info] rotating_mt Elapsed: 0.13 secs 1,890,720/sec
231-
[info] daily_mt Elapsed: 0.12 secs 2,089,322/sec
232-
[info] level-off Elapsed: 0.00 secs 139,977,603/sec
233-
[info] **************************************************************
234-
[info] Multi threaded: 4 threads, 250,000 messages
235-
[info] **************************************************************
236-
[info] basic_mt Elapsed: 0.18 secs 1,424,666/sec
237-
[info] rotating_mt Elapsed: 0.19 secs 1,329,264/sec
238-
[info] daily_mt Elapsed: 0.18 secs 1,364,071/sec
239-
[info] level-off Elapsed: 0.00 secs 139,899,272/sec
240-
```
241-
242-
- Async
243-
244-
```
245-
[info] -------------------------------------------------
246-
[info] Messages : 1000000
247-
[info] Threads : 10
248-
[info] Queue : 8192 slots
249-
[info] Queue memory : 8192 x 152 = 1216 KB
250-
[info] Total iters : 3
251-
[info] -------------------------------------------------
252-
[info]
253-
[info] *********************************
254-
[info] Queue Overflow Policy: block
255-
[info] *********************************
256-
[info] Elapsed: 2.132892 secs 468846/sec
257-
[info] Elapsed: 2.1042392 secs 475231/sec
258-
[info] Elapsed: 2.1130006 secs 473260/sec
259-
[info]
260-
[info] *********************************
261-
[info] Queue Overflow Policy: overrun
262-
[info] *********************************
263-
[info] Elapsed: 0.4682991 secs 2135387/sec
264-
[info] Elapsed: 0.4668421 secs 2142051/sec
265-
[info] Elapsed: 0.4589271 secs 2178995/sec
266-
```
267-
268-
- Using `fmt` library
269-
(compiled with `cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DSPDLOG_BUILD_BENCH=ON -DSPDLOG_BUILD_EXAMPLE=OFF`)
270-
271-
- Sync
272-
273-
```
274-
[info] **************************************************************
275-
[info] Multi threaded: 1 threads, 250,000 messages
276-
[info] **************************************************************
277-
[info] basic_mt Elapsed: 0.06 secs 3,945,408/sec
278-
[info] rotating_mt Elapsed: 0.06 secs 4,016,483/sec
279-
[info] daily_mt Elapsed: 0.06 secs 3,872,792/sec
280-
[info] level-off Elapsed: 0.00 secs 136,061,826/sec
281-
[info] **************************************************************
282-
[info] Multi threaded: 4 threads, 250,000 messages
283-
[info] **************************************************************
284-
[info] basic_mt Elapsed: 0.10 secs 2,497,243/sec
285-
[info] rotating_mt Elapsed: 0.10 secs 2,421,563/sec
286-
[info] daily_mt Elapsed: 0.10 secs 2,390,189/sec
287-
[info] level-off Elapsed: 0.00 secs 136,054,421/sec
288-
```
289-
290-
- Async
291-
292-
```
293-
[info] -------------------------------------------------
294-
[info] Messages : 1000000
295-
[info] Threads : 10
296-
[info] Queue : 8192 slots
297-
[info] Queue memory : 8192 x 408 = 3264 KB
298-
[info] Total iters : 3
299-
[info] -------------------------------------------------
300-
[info]
301-
[info] *********************************
302-
[info] Queue Overflow Policy: block
303-
[info] *********************************
304-
[info] Elapsed: 1.7362919 secs 575940/sec
305-
[info] Elapsed: 1.7509939 secs 571104/sec
306-
[info] Elapsed: 1.7574208 secs 569015/sec
307-
[info]
308-
[info] *********************************
309-
[info] Queue Overflow Policy: overrun
310-
[info] *********************************
311-
[info] Elapsed: 0.3349014 secs 2985953/sec
312-
[info] Elapsed: 0.3340692 secs 2993391/sec
313-
[info] Elapsed: 0.3259194 secs 3068243/sec
314-
```
315-
316-
</details>
48+
![](./results/chart-cpp-async.svg)
31749

31850
[The tracking page]: https://spriteovo.github.io/spdlog-rs/dev/benchmarks/

0 commit comments

Comments
 (0)