MCPcopy Create free account
hub / github.com/argumentcomputer/ix / insert_muts_entries

Function insert_muts_entries

crates/kernel/src/ingress.rs:3620–3658  ·  view source on GitHub ↗
(
  zenv: &mut KEnv<M>,
  entries: Vec<(KId<M>, KConst<M>)>,
)

Source from the content-addressed store, hash-verified

3618
3619fn elapsed_ns(start: Instant) -> u64 {
3620 duration_ns(start.elapsed())
3621}
3622
3623#[cfg(not(target_arch = "riscv64"))]
3624#[allow(clippy::cast_precision_loss)]
3625fn 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)]
3631fn 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"))]
3636fn 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"))]
3655fn timed_drop_dashmap_par<K, V, S>(map: DashMap<K, V, S>) -> u64
3656where
3657 K: Eq + Hash + Send,
3658 V: Send,
3659 S: BuildHasher + Clone + Send,
3660{
3661 let start = Instant::now();

Callers 3

ixon_ingress_innerFunction · 0.85
ingress_anon_blockFunction · 0.85

Calls 4

elapsed_nsFunction · 0.85
cloneMethod · 0.45
iterMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected