benchmark 0.8.0

Nanosecond-precision benchmarking for dev, testing, and production. Zero-overhead core timing when disabled; optional std-powered collectors and zero-dependency metrics (Watch/Timer) for real service observability.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Internal trace hooks for debugging overhead.
//! Compiles to no-ops unless the `trace` feature is enabled.
#![cfg_attr(all(feature = "trace", not(feature = "metrics")), allow(dead_code))]

#[inline]
#[cfg(feature = "trace")]
pub(crate) fn record_event(name: &str, duration_ns: u64) {
    // Lightweight hook: use eprintln! to avoid external deps.
    // Users can redirect stderr if desired.
    eprintln!("benchmark::trace name={name} ns={duration_ns}");
}

#[inline]
#[cfg(not(feature = "trace"))]
pub(crate) fn record_event(_name: &str, _duration_ns: u64) {
    // Compiles to nothing in release builds.
}