Debian Codegraph @

debian/rust-vendor/codspeed-divan-compat-walltime/CHANGELOG.md

raw
1 # Changelog [![crates.io][crate-badge]][crate]
2
3 All notable changes to this project will be documented in this file.
4
5 The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6 and this project adheres to [Semantic
7 Versioning](http://semver.org/spec/v2.0.0.html).
8
9 ## [Unreleased]
10
11 ## [0.1.17] - 2024-12-04
12
13 ### Changed
14
15 - Set [MSRV] to 1.80 for [`LazyLock`] and new `size_of` prelude import.
16
17 - Reduced thread pool memory usage by many kilobytes by using rendezvous
18 channels instead of array-based channels.
19
20 ## [0.1.16] - 2024-11-25
21
22 ### Added
23
24 - Thread pool for reusing threads across multi-threaded benchmarks. The result
25 is that when running Divan benchmarks under a sampling profiler, the
26 profiler's output will be cleaner and easier to understand. ([#37])
27
28 - Track the maximum number of allocations during a benchmark.
29
30 ### Changed
31
32 - Make private `Arg::get` trait method not take `self`, so that text editors
33 don't recommend using it. ([#59])
34
35 - Cache `BenchOptions` using `LazyLock` instead of `OnceLock`, saving space and
36 simplifying the implementation.
37
38 ## [0.1.15] - 2024-10-31
39
40 ### Added
41
42 - [`CyclesCount`] counter to display cycle throughput as Hertz.
43
44 - Track the maximum number of bytes allocated during a benchmark.
45
46 ### Removed
47
48 - Remove `has_cpuid` polyfill due to it no longer being planned for Rust, since
49 CPUID is assumed to be available on all old x86 Rust targets.
50
51 ### Fixed
52
53 - List generic benchmark type parameter `A<4>` before `A<32>`. ([#64])
54
55 - Improve precision by using `f64` when calculating allocation count and sizes
56 for the median samples.
57
58 - Multi-thread allocation counting in `sum_alloc_tallies` on macOS was loading a
59 null pointer instead of the pointer initialized by `sync_threads`.
60
61 ### Changes
62
63 - Sort all output benchmark names
64 [naturally](https://en.wikipedia.org/wiki/Natural_sort_order) instead of
65 [lexicographically](https://en.wikipedia.org/wiki/Lexicographic_order).
66
67 - Internally reuse [`&[&str]` slice][slice] for [`args`] names.
68
69 - Subtract overhead of [`AllocProfiler`] from timings. Now that Divan also
70 tracks the maximum bytes allocated, the overhead was apparent in timings.
71
72 - Simplify `ThreadAllocInfo::clear`.
73
74 - Move measured loop overhead from `SharedContext` to global `OnceLock`.
75
76 - Macros no longer rely on `std` being re-exported by Divan. Instead they use
77 `::std` or `::core` to greatly simplify code. Although this is technically a
78 breaking change, it is extremely unlikely to do `extern crate std as x`.
79
80 ## [0.1.14] - 2024-02-17
81
82 ### Fixed
83
84 - Set correct field in [`Divan::max_time`]. ([#45](https://github.com/nvzqz/divan/pull/45))
85
86 ### Changes
87
88 - Improve [`args`] documentation by relating it to using [`Bencher`].
89
90 - Define [`BytesCount::of_iter`] in terms of [`BytesCount::of_many`].
91
92 ## [0.1.13] - 2024-02-09
93
94 ### Fixed
95
96 - Missing update to `divan-macros` dependency.
97
98 ## [0.1.12] - 2024-02-09
99
100 ### Added
101
102 - Display [`args`] option values with [`Debug`] instead if [`ToString`] is not
103 implemented.
104
105 This makes it simple to use enums with derived [`Debug`]:
106
107 ```rs
108 #[derive(Debug)]
109 enum Arg { A, B }
110
111 #[divan::bench(args = [Arg::A, Arg::B])]
112 fn bench_args(arg: &Arg) {
113 ...
114 }
115 ```
116
117 - Documentation of when to use [`black_box`] in benchmarks.
118
119 ## [0.1.11] - 2024-01-20
120
121 ### Fixed
122
123 - Sorting negative [`args`] numbers.
124
125 ## [0.1.10] - 2024-01-20
126
127 ### Fixed
128
129 - Sort [`args`] numbers like [`consts`].
130
131 ## [0.1.9] - 2024-01-20
132
133 ### Added
134
135 - [`args`] option for providing runtime arguments to benchmarks:
136
137 ```rs
138 #[divan::bench(args = [1, 2, 3])]
139 fn args_list(arg: usize) { ... }
140
141 #[divan::bench(args = 1..=3)]
142 fn args_range(arg: usize) { ... }
143
144 const ARGS: &[usize] = [1, 2, 3];
145
146 #[divan::bench(args = ARGS)]
147 fn args_const(arg: usize) { ... }
148 ```
149
150 This option may be preferred over the similar [`consts`] option because:
151 - It is compatible with more types, only requiring that the argument type
152 implements [`Any`], [`Copy`], [`Send`], [`Sync`], and [`ToString`]. [`Copy`]
153 is not needed if the argument is used through a reference.
154 - It does not increase compile times, unlike [`consts`] which needs to
155 generate new code for each constant used.
156
157 ## [0.1.8] - 2023-12-19
158
159 ### Changes
160
161 - Reduce [`AllocProfiler`] footprint from 6-10ns to 1-2ns:
162
163 - Thread-local values are now exclusively owned by their threads and are no
164 longer kept in a global list. This enables some optimizations:
165
166 - Performing faster unsynchronized arithmetic.
167
168 - Removing one level of pointer indirection by storing the thread-local
169 value entirely inline in [`thread_local!`], rather than storing a pointer
170 to a globally-shared instance.
171
172 - Compiler emits SIMD arithmetic for x86_64 using `paddq`.
173
174 - Improved thread-local lookup on x86_64 macOS by using a static lookup key
175 instead of a dynamic key from [`pthread_key_create`]. Key 11 is used because
176 it is reserved for Windows.
177
178 The `dyn_thread_local` crate feature disables this optimization. This is
179 recommended if your code or another dependency uses the same static key.
180
181 ### Fixed
182
183 - Remove unused allocations if [`AllocProfiler`] is not active as the global
184 allocator.
185
186 ## [0.1.7] - 2023-12-13
187
188 ### Changes
189
190 - Improve [`AllocProfiler`] implementation documentation.
191
192 - Limit [`AllocProfiler`] mean count outputs to 4 significant digits to not be
193 very wide and for consistency with other outputs.
194
195 ## [0.1.6] - 2023-12-13
196
197 ### Added
198
199 - [`AllocProfiler`] allocator that tracks allocation counts and sizes during
200 benchmarks.
201
202 ## [0.1.5] - 2023-12-05
203
204 ### Added
205
206 - [`black_box_drop`](https://docs.rs/divan/0.1.5/divan/fn.black_box_drop.html)
207 convenience function for [`black_box`] + [`drop`]. This is useful when
208 benchmarking a lazy [`Iterator`] to completion with `for_each`:
209
210 ```rust
211 #[divan::bench]
212 fn parse_iter() {
213 let input: &str = // ...
214
215 Parser::new(input)
216 .for_each(divan::black_box_drop);
217 }
218 ```
219
220 ## [0.1.4] - 2023-12-02
221
222 ### Added
223
224 - `From` implementations for counters on references to `u8`–`u64` and `usize`,
225 such as `From<&u64>` and `From<&&u64>`. This allows for doing:
226
227 ```rust
228 bencher
229 .with_inputs(|| { ... })
230 .input_counter(ItemsCount::from)
231 .bench_values(|n| { ... });
232 ```
233
234 - [`Bencher::count_inputs_as<C>`](https://docs.rs/divan/0.1.4/divan/struct.Bencher.html#method.count_inputs_as)
235 method to convert inputs to a `Counter`:
236
237 ```rust
238 bencher
239 .with_inputs(|| -> usize {
240 // ...
241 })
242 .count_inputs_as::<ItemsCount>()
243 .bench_values(|n| -> Vec<usize> {
244 (0..n).collect()
245 });
246 ```
247
248 ## [0.1.3] - 2023-11-21
249
250 ### Added
251
252 - Convenience shorthand options for `#[divan::bench]` and
253 `#[divan::bench_group]` counters:
254 - [`bytes_count`](https://docs.rs/divan/0.1.3/divan/attr.bench.html#bytes_count)
255 for `counter = BytesCount::from(n)`
256 - [`chars_count`](https://docs.rs/divan/0.1.3/divan/attr.bench.html#chars_count)
257 for `counter = CharsCount::from(n)`
258 - [`items_count`](https://docs.rs/divan/0.1.3/divan/attr.bench.html#items_count)
259 for `counter = ItemsCount::from(n)`
260
261 - Support for NetBSD, DragonFly BSD, and Haiku OS by using pre-`main`.
262
263 - Set global thread counts using:
264 - [`Divan::threads`](https://docs.rs/divan/0.1.3/divan/struct.Divan.html#method.threads)
265 - `--threads A B C...` CLI arg
266 - `DIVAN_THREADS=A,B,C` env var
267
268 The following example will benchmark across 2, 4, and [available parallelism]
269 thread counts:
270
271 ```sh
272 DIVAN_THREADS=0,2,4 cargo bench -q -p examples --bench atomic
273 ```
274
275 - Set global
276 [`Counter`s](https://docs.rs/divan/0.1.3/divan/counter/trait.Counter.html) at
277 runtime using:
278 - [`Divan::counter`](https://docs.rs/divan/0.1.3/divan/struct.Divan.html#method.counter)
279 - [`Divan::items_count`](https://docs.rs/divan/0.1.3/divan/struct.Divan.html#method.items_count)
280 - [`Divan::bytes_count`](https://docs.rs/divan/0.1.3/divan/struct.Divan.html#method.bytes_count)
281 - [`Divan::chars_count`](https://docs.rs/divan/0.1.3/divan/struct.Divan.html#method.chars_count)
282 - `--items-count N` CLI arg
283 - `--bytes-count N` CLI arg
284 - `--chars-count N` CLI arg
285 - `DIVAN_ITEMS_COUNT=N` env var
286 - `DIVAN_BYTES_COUNT=N` env var
287 - `DIVAN_CHARS_COUNT=N` env var
288
289 - `From<C>` for
290 [`ItemsCount`](https://docs.rs/divan/0.1.3/divan/counter/struct.ItemsCount.html),
291 [`BytesCount`](https://docs.rs/divan/0.1.3/divan/counter/struct.BytesCount.html),
292 and
293 [`CharsCount`](https://docs.rs/divan/0.1.3/divan/counter/struct.CharsCount.html)
294 where `C` is `u8`–`u64` or `usize` (via `CountUInt` internally). This provides
295 an alternative to the `new` constructor.
296
297 - [`BytesCount::of_many`](https://docs.rs/divan/0.1.3/divan/counter/struct.BytesCount.html#method.of_many)
298 method similar to [`BytesCount::of`](https://docs.rs/divan/0.1/divan/counter/struct.BytesCount.html#method.of),
299 but with a parameter by which to multiply the size of the type.
300
301 - [`BytesCount::u64`](https://docs.rs/divan/0.1.3/divan/counter/struct.BytesCount.html#method.u64),
302 [`BytesCount::f64`](https://docs.rs/divan/0.1.3/divan/counter/struct.BytesCount.html#method.f64),
303 and similar methods based on [`BytesCount::of_many`](https://docs.rs/divan/0.1.3/divan/counter/struct.BytesCount.html#method.of_many).
304
305 ### Removed
306
307 - [`black_box`] inside benchmark loop when deferring [`Drop`] of outputs. This
308 is now done after the loop.
309
310 - [`linkme`](https://docs.rs/linkme) dependency in favor of pre-`main` to
311 register benchmarks and benchmark groups. This is generally be more portable
312 and reliable.
313
314 ### Changed
315
316 - Now calling [`black_box`] at the end of the benchmark loop when deferring use
317 of inputs or [`Drop`] of outputs.
318
319 ## [0.1.2] - 2023-10-28
320
321 ### Fixed
322
323 - Multi-threaded benchmarks being spread across CPUs, instead of pinning the
324 main thread to CPU 0 and having all threads inherit the main thread's
325 affinity.
326
327 ## [0.1.1] - 2023-10-25
328
329 ### Fixed
330
331 - Fix using LLD as linker for Linux by using the same pre-`main` approach as
332 Windows.
333
334 ## 0.1.0 - 2023-10-04
335
336 Initial release. See [blog post](https://nikolaivazquez.com/blog/divan/).
337
338 [crate]: https://crates.io/crates/divan
339 [crate-badge]: https://img.shields.io/crates/v/divan.svg
340
341 [Unreleased]: https://github.com/nvzqz/divan/compare/v0.1.17...HEAD
342 [0.1.17]: https://github.com/nvzqz/divan/compare/v0.1.16...v0.1.17
343 [0.1.16]: https://github.com/nvzqz/divan/compare/v0.1.15...v0.1.16
344 [0.1.15]: https://github.com/nvzqz/divan/compare/v0.1.14...v0.1.15
345 [0.1.14]: https://github.com/nvzqz/divan/compare/v0.1.13...v0.1.14
346 [0.1.13]: https://github.com/nvzqz/divan/compare/v0.1.12...v0.1.13
347 [0.1.12]: https://github.com/nvzqz/divan/compare/v0.1.11...v0.1.12
348 [0.1.11]: https://github.com/nvzqz/divan/compare/v0.1.10...v0.1.11
349 [0.1.10]: https://github.com/nvzqz/divan/compare/v0.1.9...v0.1.10
350 [0.1.9]: https://github.com/nvzqz/divan/compare/v0.1.8...v0.1.9
351 [0.1.8]: https://github.com/nvzqz/divan/compare/v0.1.7...v0.1.8
352 [0.1.7]: https://github.com/nvzqz/divan/compare/v0.1.6...v0.1.7
353 [0.1.6]: https://github.com/nvzqz/divan/compare/v0.1.5...v0.1.6
354 [0.1.5]: https://github.com/nvzqz/divan/compare/v0.1.4...v0.1.5
355 [0.1.4]: https://github.com/nvzqz/divan/compare/v0.1.3...v0.1.4
356 [0.1.3]: https://github.com/nvzqz/divan/compare/v0.1.2...v0.1.3
357 [0.1.2]: https://github.com/nvzqz/divan/compare/v0.1.1...v0.1.2
358 [0.1.1]: https://github.com/nvzqz/divan/compare/v0.1.0...v0.1.1
359
360 [#37]: https://github.com/nvzqz/divan/issues/37
361 [#59]: https://github.com/nvzqz/divan/issues/59
362 [#64]: https://github.com/nvzqz/divan/issues/64
363
364 [`AllocProfiler`]: https://docs.rs/divan/0.1/divan/struct.AllocProfiler.html
365 [`args`]: https://docs.rs/divan/latest/divan/attr.bench.html#args
366 [`Bencher`]: https://docs.rs/divan/0.1/divan/struct.Bencher.html
367 [`black_box`]: https://docs.rs/divan/latest/divan/fn.black_box.html
368 [`BytesCount::of_iter`]: https://docs.rs/divan/0.1/divan/counter/struct.BytesCount.html#method.of_iter
369 [`BytesCount::of_many`]: https://docs.rs/divan/0.1/divan/counter/struct.BytesCount.html#method.of_many
370 [`consts`]: https://docs.rs/divan/latest/divan/attr.bench.html#consts
371 [`CyclesCount`]: https://docs.rs/divan/0.1/divan/counter/struct.CyclesCount.html
372 [`Divan::max_time`]: https://docs.rs/divan/0.1/divan/struct.Divan.html#method.max_time
373
374 [`Any`]: https://doc.rust-lang.org/std/any/trait.Any.html
375 [`Copy`]: https://doc.rust-lang.org/std/marker/trait.Copy.html
376 [`Debug`]: https://doc.rust-lang.org/std/fmt/trait.Debug.html
377 [`drop`]: https://doc.rust-lang.org/std/mem/fn.drop.html
378 [`Drop`]: https://doc.rust-lang.org/std/ops/trait.Drop.html
379 [`Iterator`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html
380 [`LazyLock`]: https://doc.rust-lang.org/std/sync/struct.LazyLock.html
381 [`Send`]: https://doc.rust-lang.org/std/marker/trait.Send.html
382 [`size_of`]: https://doc.rust-lang.org/std/mem/fn.size_of.html
383 [`Sync`]: https://doc.rust-lang.org/std/marker/trait.Sync.html
384 [`thread_local!`]: https://doc.rust-lang.org/std/macro.thread_local.html
385 [`ToString`]: https://doc.rust-lang.org/std/string/trait.ToString.html
386 [available parallelism]: https://doc.rust-lang.org/std/thread/fn.available_parallelism.html
387 [slice]: https://doc.rust-lang.org/std/primitive.slice.html
388
389 [MSRV]: https://doc.rust-lang.org/cargo/reference/rust-version.html
390
391 [`pthread_key_create`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_key_create.html