( zenv: &mut KEnv<M>, entries: Vec<(KId<M>, KConst<M>)>, )
| 3618 | |
| 3619 | fn elapsed_ns(start: Instant) -> u64 { |
| 3620 | duration_ns(start.elapsed()) |
| 3621 | } |
| 3622 | |
| 3623 | #[cfg(not(target_arch = "riscv64"))] |
| 3624 | #[allow(clippy::cast_precision_loss)] |
| 3625 | fn seconds(ns: u64) -> f64 { |
| 3626 | ns as f64 / 1_000_000_000.0 |
| 3627 | } |
| 3628 | |
| 3629 | #[cfg(not(target_arch = "riscv64"))] |
| 3630 | #[allow(clippy::cast_precision_loss)] |
| 3631 | fn percent(part: u64, total: u64) -> f64 { |
| 3632 | if total == 0 { 0.0 } else { (part as f64 * 100.0) / total as f64 } |
| 3633 | } |
| 3634 | |
| 3635 | #[cfg(not(target_arch = "riscv64"))] |
| 3636 | fn timed_drop_ns<T>(value: T) -> u64 { |
| 3637 | let start = Instant::now(); |
| 3638 | drop(value); |
| 3639 | elapsed_ns(start) |
| 3640 | } |
| 3641 | |
| 3642 | /// Drop a `DashMap` in parallel across its shards. |
| 3643 | /// |
| 3644 | /// DashMap's `IntoParallelIterator` impl yields owned `(K, V)` pairs by |
| 3645 | /// processing shards as the parallel unit (one rayon task per shard, |
| 3646 | /// sequential within a shard). Default shard count is `4 * num_cpus()`, which |
| 3647 | /// gives rayon's work-stealing plenty to distribute. |
| 3648 | /// |
| 3649 | /// Used by `drop_ixon_env` to tear down the five `DashMap`s holding the |
| 3650 | /// post-ingress IxonEnv. Concurrent `Arc::drop` is safe by construction |
| 3651 | /// (atomic refcount; the last decrementer destroys exactly once), and none |
| 3652 | /// of the value types have custom `Drop` impls — so this is a pure |
| 3653 | /// parallelisation of the existing teardown. |
| 3654 | #[cfg(not(target_arch = "riscv64"))] |
| 3655 | fn timed_drop_dashmap_par<K, V, S>(map: DashMap<K, V, S>) -> u64 |
| 3656 | where |
| 3657 | K: Eq + Hash + Send, |
| 3658 | V: Send, |
| 3659 | S: BuildHasher + Clone + Send, |
| 3660 | { |
| 3661 | let start = Instant::now(); |
no test coverage detected