Skip to content

Imberflur/instrument-bench

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

instrument-bench

instrument-bench is a set of benchmarks comparing the overhead of various logging and instrumentation crates. These include:

Backends

Frontends

Direct instrumentation

The backends/frontends listed here are benchmarked in all possible combinations since they are all compatible.

How to use

cargo bench

Benchmark results

Note: I did not obtain these in a controlled environment and they can vary wildly (-50/+100 percent). However, the general relationships that are more than a factor of 2 apart should hold.

Benchmarks with instrumentation suppressed by a global or module specific filter.

instrumentation env_logger tracing-subscriber tracing-tracy
Level::Info
log::debug!("") 1.6 ns 1.6 ns 1.9 ns
tracing::debug!("") 2.6 ns 3.8 ns 3.4 ns
tracing::debug_span!("") 39.4 ns 13.9 ns 14.4 ns
tracing::debug_span!("", "extra info") 48.3 ns 18.7 ns 15.0 ns
"mycrate::foo=error"*
log::info!("") 24.0 ns 81.7 ns 44.3 ns
tracing::info!("") 12.5 ns 3.0 ns 2.7 ns
tracing::info_span!("") 76.9 ns 19.4 ns 13.9 ns
tracing::info_span!("", "extra info") 86.32 ns 19.7 ns 14.5 ns

*For the info_span!("") "tracing::span=error" is needed to suppres it rather than using the module path because tracing spans report this as their module name to log frontends for spans that have no extra fields attached.

Benchmarks with an active span.

tracing-subscriber is using the fmt subscriber layer with a tracing span

tracy-tracing allows timing tracing spans with the Tracy profiler

tracy-client directly interfaces with the Tracy profiler

crate time (ns)
tracing-subscriber 600
tracy-tracing 1062
tracy-client 205

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages