Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logging with interest cache #2165

Open
wants to merge 19 commits into
base: v0.1.x
Choose a base branch
from

Conversation

bkchr
Copy link
Contributor

@bkchr bkchr commented Jun 17, 2022

Motivation

When the interest cache is configured as part of initing the LogTracer before
the global dispatcher is set, the main thread fails to log. The problem
is that the interests cache registers a dummy callsite. With
#2083 the callsite registration
changed to use dispatcher::get_default. This call internally sets the
thread local default dispatcher to Dispatch::none when there isn't
yet any dispatcher set. This default dispatcher isn't overwritten when
setting the global dispatcher.

Solution

The solution is to not store the
Dispatch::none as default dispatcher.

@bkchr bkchr requested review from hawkw and a team as code owners June 17, 2022 13:39
@@ -0,0 +1,101 @@
#![cfg(feature = "interest-cache")]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test isn't run as part of the CI. Should I add it to the CI config?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there should be a CI job that runs with --all-features for every crate.

@bkchr
Copy link
Contributor Author

bkchr commented Jun 17, 2022

This should also be released directly in a new tracing-core release.

@davidbarsky
Copy link
Member

I haven't reviewed this yet, but can you make this PR target the master branch? We generally handle backports; it's easier for us if this targets master.

@bkchr
Copy link
Contributor Author

bkchr commented Jun 17, 2022

I haven't reviewed this yet, but can you make this PR target the master branch? We generally handle backports; it's easier for us if this targets master.

On master the interests cache doesn't exist, so this is not an issue there?

@bkchr
Copy link
Contributor Author

bkchr commented Jun 17, 2022

@koute is there any reason your pr #1636 wasn't made against master?

@davidbarsky
Copy link
Member

On master the interests cache doesn't exist, so this is not an issue there?

Ugh, that's an oversight. That should be on master.

@koute
Copy link

koute commented Jun 18, 2022

@koute is there any reason your pr #1636 wasn't made against master?

I saw the big fat warning in the readme that the v0.1.x is what's released on crates.io, I saw a bunch of other PRs made on v0.1.x too and for testing purposes it was easier to initially base it on v0.1.x, so I just made the PR for v0.1.x, and then no one complained/told me to make it on master... (:

Sorry about that!

Can we merge this PR as-is, and then as a followup PR I'll take this and my previous PR and port it to master?

@hawkw
Copy link
Member

hawkw commented Jun 19, 2022

so I just made the PR for v0.1.x, and then no one complained/told me to make it on master... (:

i wasn't paying attention, sorry. :)

i'm fine with merging this change against v0.1.x. fwiw, the code that this PR changes is quite different on master anyway, so i'm not sure if it even would make sense to make this change there and backport it? we can forward-port the appropriate code once this has landed.

i haven't had time to actually review this change yet, but hopefully i'll have time to get to it tomorrow or monday!

@bkchr
Copy link
Contributor Author

bkchr commented Jun 19, 2022

Then I'm waiting for your feedback @hawkw. Ty you already! :)

Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I've finally had time to take a look at this PR (sorry it took me a big longer than expected!). I understand the issue this resolves and I think the fix makes sense --- we should not be setting the local default to Dispatch::none in the case where a global default has not been set yet.

However, running the benchmarks on this branch, I notice that this change has a rather significant performance impact in the subscriber.rs benchmarks, in comparison to v0.1.x (). In particular, the benchmarks that measure the overhead of get_default have regressed significantly:


dispatch/no_dispatch_get_ref
                        time:   [20.388 ns 20.458 ns 20.533 ns]
                        change: [+783.82% +788.94% +792.85%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 6 outliers among 100 measurements (6.00%)
  2 (2.00%) low mild
  4 (4.00%) high mild
dispatch/no_dispatch_get_clone
                        time:   [26.754 ns 26.762 ns 26.769 ns]
                        change: [+141.86% +141.94% +142.04%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) low mild
dispatch/get_ref        time:   [5.2403 ns 5.2463 ns 5.2552 ns]
                        change: [+122.87% +123.72% +124.57%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 8 outliers among 100 measurements (8.00%)
  6 (6.00%) high mild
  2 (2.00%) high severe
dispatch/get_clone      time:   [12.155 ns 12.156 ns 12.157 ns]
                        change: [+10.745% +10.878% +11.031%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 5 outliers among 100 measurements (5.00%)
  3 (3.00%) low severe
  2 (2.00%) high mild

which effects the performance of recording an event or creating a new span.

Full `tracing` benchmark results
     Running unittests (target/release/deps/no_subscriber-dc9048f119b3e39d)
Gnuplot not found, disabling plotting
no_subscriber/span      time:   [329.58 ps 331.20 ps 332.77 ps]
                        change: [-0.0178% +0.2168% +0.4588%] (p = 0.11 > 0.05)
                        No change in performance detected.
Found 14 outliers among 100 measurements (14.00%)
  10 (10.00%) low severe
  1 (1.00%) low mild
  3 (3.00%) high mild
no_subscriber/span_enter
                        time:   [235.25 ps 235.32 ps 235.43 ps]
                        change: [+0.6917% +0.7828% +0.8696%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 7 outliers among 100 measurements (7.00%)
  2 (2.00%) low mild
  2 (2.00%) high mild
  3 (3.00%) high severe
no_subscriber/empty_span
                        time:   [233.82 ps 234.29 ps 234.64 ps]
                        change: [-0.5106% -0.1015% +0.3728%] (p = 0.66 > 0.05)
                        No change in performance detected.
no_subscriber/empty_struct
                        time:   [676.61 ps 677.40 ps 678.50 ps]
                        change: [-2.5811% -2.2355% -1.8730%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 20 outliers among 100 measurements (20.00%)
  2 (2.00%) low mild
  1 (1.00%) high mild
  17 (17.00%) high severe
no_subscriber/event     time:   [227.36 ps 230.21 ps 235.99 ps]
                        change: [-1.8480% +0.2089% +3.2513%] (p = 0.89 > 0.05)
                        No change in performance detected.
Found 16 outliers among 100 measurements (16.00%)
  3 (3.00%) low mild
  6 (6.00%) high mild
  7 (7.00%) high severe
no_subscriber/relaxed_load
                        time:   [466.51 ps 467.00 ps 467.58 ps]
                        change: [-0.0715% +0.0541% +0.1849%] (p = 0.43 > 0.05)
                        No change in performance detected.
Found 12 outliers among 100 measurements (12.00%)
  5 (5.00%) high mild
  7 (7.00%) high severe
no_subscriber/acquire_load
                        time:   [464.25 ps 466.81 ps 469.31 ps]
                        change: [-0.7907% -0.4652% -0.1568%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 14 outliers among 100 measurements (14.00%)
  13 (13.00%) low mild
  1 (1.00%) high mild
no_subscriber/log       time:   [235.08 ps 235.14 ps 235.23 ps]
                        change: [-0.0774% -0.0457% -0.0177%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 7 outliers among 100 measurements (7.00%)
  1 (1.00%) low severe
  3 (3.00%) low mild
  2 (2.00%) high mild
  1 (1.00%) high severe

no_subscriber_field/span
                        time:   [1.4180 ns 1.4193 ns 1.4217 ns]
                        change: [+1.8668% +2.1892% +2.5196%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 6 outliers among 100 measurements (6.00%)
  1 (1.00%) low severe
  5 (5.00%) high severe
no_subscriber_field/event
                        time:   [468.34 ps 469.12 ps 469.75 ps]
                        change: [-0.3684% +0.0417% +0.2853%] (p = 0.86 > 0.05)
                        No change in performance detected.
Found 4 outliers among 100 measurements (4.00%)
  2 (2.00%) low severe
  1 (1.00%) low mild
  1 (1.00%) high mild
no_subscriber_field/log time:   [235.18 ps 235.23 ps 235.30 ps]
                        change: [+0.3970% +0.5570% +0.6734%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 7 outliers among 100 measurements (7.00%)
  1 (1.00%) low mild
  6 (6.00%) high severe

Gnuplot not found, disabling plotting
     Running unittests (target/release/deps/subscriber-b3c6395267c4f6e6)
Gnuplot not found, disabling plotting
span_no_fields          time:   [21.978 ns 22.031 ns 22.100 ns]
                        change: [+17.484% +18.044% +18.607%] (p = 0.00 < 0.05)
                        Performance has regressed.

enter_span              time:   [2.6206 ns 2.6273 ns 2.6358 ns]
                        change: [-1.3274% -0.4722% +0.3517%] (p = 0.27 > 0.05)
                        No change in performance detected.
Found 20 outliers among 100 measurements (20.00%)
  1 (1.00%) low mild
  2 (2.00%) high mild
  17 (17.00%) high severe

span_repeatedly         time:   [3.8106 us 3.8113 us 3.8119 us]
                        change: [+6.8139% +6.8656% +6.9101%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 5 outliers among 100 measurements (5.00%)
  3 (3.00%) low mild
  2 (2.00%) high mild

span_with_fields        time:   [58.965 ns 58.972 ns 58.979 ns]
                        change: [+3.8399% +3.8606% +3.8813%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 6 outliers among 100 measurements (6.00%)
  1 (1.00%) low severe
  3 (3.00%) low mild
  2 (2.00%) high mild

span_with_fields_record time:   [307.05 ns 307.61 ns 308.15 ns]
                        change: [+0.1574% +0.3189% +0.4827%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

dispatch/no_dispatch_get_ref
                        time:   [20.388 ns 20.458 ns 20.533 ns]
                        change: [+783.82% +788.94% +792.85%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 6 outliers among 100 measurements (6.00%)
  2 (2.00%) low mild
  4 (4.00%) high mild
dispatch/no_dispatch_get_clone
                        time:   [26.754 ns 26.762 ns 26.769 ns]
                        change: [+141.86% +141.94% +142.04%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) low mild
dispatch/get_ref        time:   [5.2403 ns 5.2463 ns 5.2552 ns]
                        change: [+122.87% +123.72% +124.57%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 8 outliers among 100 measurements (8.00%)
  6 (6.00%) high mild
  2 (2.00%) high severe
dispatch/get_clone      time:   [12.155 ns 12.156 ns 12.157 ns]
                        change: [+10.745% +10.878% +11.031%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 5 outliers among 100 measurements (5.00%)
  3 (3.00%) low severe
  2 (2.00%) high mild

Gnuplot not found, disabling plotting

I think it may be possible to resolve the issue that this branch fixes with less overhead. I'm going to look into some potential changes to this PR to see if they decrease the performance regression --- in particular, I think we can avoid generating unwinding code in Entered. I'll get back to you once I've had the time to look into potential changes.

@@ -235,7 +235,7 @@ mod tests {

fn lock_for_test() -> impl Drop {
// We need to make sure only one test runs at a time.
static LOCK: Lazy<Mutex<()>> = Lazy::new(Mutex::new);
static LOCK: Lazy<Mutex<()>> = Lazy::new(|| Mutex::new(()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this change necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For whatever reason, my rustc version didn't liked it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I revert this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@hawkw
Copy link
Member

hawkw commented Jun 22, 2022

Okay, I've made some additional changes to this branch and the performance regression is now...less severe:

Switched to branch 'fix-logging-with-interest-cache'
Your branch is up to date with 'origin/fix-logging-with-interest-cache'.
   Compiling tracing-core v0.1.27 (/home/eliza/Code/tracing/tracing-core)
   Compiling tracing v0.1.35 (/home/eliza/Code/tracing/tracing)
   Compiling tracing-mock v0.1.0 (/home/eliza/Code/tracing/tracing-mock)
    Finished bench [optimized] target(s) in 2.11s
     Running unittests (target/release/deps/subscriber-a8de284071f6d103)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

WARNING: In Criterion.rs 0.4.0, running criterion benchmarks outside of cargo-criterion will become a default optional feature.
The statistical analysis and reporting is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'cargo_bench_support' feature in your Cargo.toml.

Gnuplot not found, using plotters backend
span_no_fields          time:   [19.109 ns 19.116 ns 19.122 ns]
                        change: [+2.9907% +3.3168% +3.6217%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 13 outliers among 100 measurements (13.00%)
  10 (10.00%) low mild
  2 (2.00%) high mild
  1 (1.00%) high severe

enter_span              time:   [2.5205 ns 2.5253 ns 2.5312 ns]
                        change: [-21.382% -21.090% -20.715%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 12 outliers among 100 measurements (12.00%)
  4 (4.00%) high mild
  8 (8.00%) high severe

span_repeatedly         time:   [3.5777 us 3.5945 us 3.6095 us]
                        change: [-0.8840% -0.5869% -0.2808%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 10 outliers among 100 measurements (10.00%)
  10 (10.00%) high mild

span_with_fields        time:   [56.338 ns 56.349 ns 56.360 ns]
                        change: [+2.8501% +2.9670% +3.0708%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 7 outliers among 100 measurements (7.00%)
  1 (1.00%) low severe
  3 (3.00%) high mild
  3 (3.00%) high severe

span_with_fields_record time:   [312.58 ns 313.63 ns 314.68 ns]
                        change: [+5.5953% +5.9239% +6.2564%] (p = 0.00 < 0.05)
                        Performance has regressed.

dispatch/no_dispatch_get_ref
                        time:   [4.2078 ns 4.2100 ns 4.2125 ns]
                        change: [+80.742% +81.441% +82.141%] (p = 0.00 < 0.05)
                        Performance has regressed.
dispatch/no_dispatch_get_clone
                        time:   [11.523 ns 11.526 ns 11.529 ns]
                        change: [+4.2474% +4.2869% +4.3256%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 7 outliers among 100 measurements (7.00%)
  4 (4.00%) low severe
  2 (2.00%) low mild
  1 (1.00%) high mild
dispatch/get_ref        time:   [3.8258 ns 3.8307 ns 3.8368 ns]
                        change: [+63.105% +63.605% +64.147%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 21 outliers among 100 measurements (21.00%)
  2 (2.00%) low mild
  3 (3.00%) high mild
  16 (16.00%) high severe
dispatch/get_clone      time:   [10.777 ns 10.784 ns 10.791 ns]
                        change: [+0.8256% +0.9724% +1.1180%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 11 outliers among 100 measurements (11.00%)
  5 (5.00%) low mild
  4 (4.00%) high mild
  2 (2.00%) high severe

@bkchr
Copy link
Contributor Author

bkchr commented Jun 23, 2022

@hawkw ty! :)

@bkchr bkchr force-pushed the fix-logging-with-interest-cache branch from 9d1a308 to 78f3b01 Compare June 23, 2022 10:23
@bkchr
Copy link
Contributor Author

bkchr commented Jun 23, 2022

@hawkw how do we want to move forward?

@hawkw
Copy link
Member

hawkw commented Jun 24, 2022

@hawkw how do we want to move forward?

I would like to reduce the performance regression in the dispatch/get_ref benchmark a bit more (+63% is not as bad as +123%, but still kind of a shame), but if we can't figure out an obvious way to do that, I'll move forward with the current state of this branch. I'll take another look at it today.

@hawkw
Copy link
Member

hawkw commented Jun 24, 2022

Whoops, we were actually not running the benchmarks with a global default subscriber (:upside_down_face:). After fixing that (in 181bdbe), we see that the perf diff in that case is more severe:

global/subscriber/span_no_fields
                        time:   [18.035 ns 18.062 ns 18.092 ns]
                        change: [-3.6554% -3.4919% -3.3260%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  5 (5.00%) high mild
  2 (2.00%) high severe
global/subscriber/event time:   [19.187 ns 19.225 ns 19.265 ns]
                        change: [+23.950% +24.444% +24.923%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 14 outliers among 100 measurements (14.00%)
  10 (10.00%) high mild
  4 (4.00%) high severe
global/subscriber/enter_span
                        time:   [2.6766 ns 2.6861 ns 2.6962 ns]
                        change: [-4.4797% -4.0041% -3.3692%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 20 outliers among 100 measurements (20.00%)
  15 (15.00%) high mild
  5 (5.00%) high severe
global/subscriber/span_repeatedly
                        time:   [3.5330 us 3.5357 us 3.5387 us]
                        change: [-0.5417% -0.4691% -0.3983%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 9 outliers among 100 measurements (9.00%)
  7 (7.00%) high mild
  2 (2.00%) high severe
global/subscriber/span_with_fields
                        time:   [51.230 ns 51.342 ns 51.462 ns]
                        change: [-8.0253% -7.8695% -7.7025%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  1 (1.00%) low mild
  4 (4.00%) high mild
  4 (4.00%) high severe

global/dispatch/get_ref time:   [3.9436 ns 3.9471 ns 3.9504 ns]
                        change: [+210.18% +210.64% +211.07%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) low mild
  2 (2.00%) high mild
global/dispatch/get_clone
                        time:   [10.774 ns 10.785 ns 10.796 ns]
                        change: [+2.1395% +2.2401% +2.3376%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 12 outliers among 100 measurements (12.00%)
  10 (10.00%) high mild
  2 (2.00%) high severe

Note that recording an event is about 25% slower on 20d9695 than on v0.1.x.

Going to keep seeing what I can do to reduce the overhead of this change.

@bkchr
Copy link
Contributor Author

bkchr commented Jun 25, 2022

Okay, yeah that is a lot of overhead. Looking at the code, it is not really that much different. It could be probably the FnOnce that kills us here?

bkchr and others added 7 commits August 29, 2022 11:24
When the interest cache is configured as part of initing the `LogTracer` before
the global dispatcher is set, the main thread fails to log. The problem
is that the interests cache registers a dummy callsite. With
tokio-rs#2083 the callsite registration
changed to use `dispatcher::get_default`. This call internally sets the
thread local `default` dispatcher to `Dispatch::none` when there isn't
yet any dispatcher set. This `default` dispatcher isn't overwritten when
setting the global dispatcher. The solution is to not store the
`Dispatch::none` as `default` dispatcher.
this brings performance of most of the `subscriber.rs` benchmarks closer
to where they were on `v0.1.x` prior to this change (commit
cf98b73):

```
     Running unittests (target/release/deps/subscriber-b3c6395267c4f6e6)
Gnuplot not found, disabling plotting
span_no_fields          time:   [18.814 ns 18.900 ns 18.967 ns]
                        change: [-17.562% -17.045% -16.552%] (p = 0.00 < 0.05)
                        Performance has improved.

enter_span              time:   [2.8471 ns 2.8620 ns 2.8799 ns]
                        change: [+7.5923% +8.2941% +8.9390%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 20 outliers among 100 measurements (20.00%)
  2 (2.00%) low severe
  2 (2.00%) high mild
  16 (16.00%) high severe

span_repeatedly         time:   [3.6959 us 3.6988 us 3.7017 us]
                        change: [-3.0008% -2.9276% -2.8528%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

span_with_fields        time:   [56.854 ns 56.911 ns 56.975 ns]
                        change: [-3.5756% -3.4955% -3.3997%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 20 outliers among 100 measurements (20.00%)
  1 (1.00%) low mild
  3 (3.00%) high mild
  16 (16.00%) high severe

span_with_fields_record time:   [317.15 ns 318.02 ns 318.94 ns]
                        change: [+3.1700% +3.3617% +3.5555%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 9 outliers among 100 measurements (9.00%)
  4 (4.00%) high mild
  5 (5.00%) high severe

dispatch/no_dispatch_get_ref
                        time:   [17.823 ns 17.966 ns 18.134 ns]
                        change: [-10.826% -10.144% -9.4796%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild
dispatch/no_dispatch_get_clone
                        time:   [24.984 ns 25.013 ns 25.041 ns]
                        change: [-6.7511% -6.6349% -6.5020%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  1 (1.00%) low severe
  2 (2.00%) low mild
  1 (1.00%) high mild
  4 (4.00%) high severe
dispatch/get_ref        time:   [3.8508 ns 3.8532 ns 3.8555 ns]
                        change: [-26.641% -26.518% -26.404%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  1 (1.00%) low mild
  2 (2.00%) high mild
  3 (3.00%) high severe
dispatch/get_clone      time:   [10.737 ns 10.750 ns 10.765 ns]
                        change: [-11.632% -11.429% -11.219%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 17 outliers among 100 measurements (17.00%)
  3 (3.00%) low mild
  2 (2.00%) high mild
  12 (12.00%) high severe

Gnuplot not found, disabling plotting
```

performance of `get_default` where there is no current subscriber is
still significantly regressed vs `v0.1.x`, due to `Arc` allocations for
`Dispatch::none` occurring every time. i think this can be solved as well.
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
@bkchr bkchr force-pushed the fix-logging-with-interest-cache branch from 20d9695 to 45c477e Compare August 30, 2022 09:15
@bkchr
Copy link
Contributor Author

bkchr commented Aug 30, 2022

Hey @hawkw, sorry for the long delay. I pushed some commits. Could you take a look please. I also run the benchmarks. Besides the event::none it looks good to me. Events::none is maybe some random outlier? I will run the benchmark later again:

comparison/relaxed_load time:   [466.50 ps 466.86 ps 467.29 ps]                                    
                        change: [+1.2663% +1.4584% +1.6461%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 4 outliers among 100 measurements (4.00%)
  3 (3.00%) high mild
  1 (1.00%) high severe
comparison/acquire_load time:   [463.99 ps 464.50 ps 464.97 ps]                                    
                        change: [-7.9152% -6.5864% -5.3795%] (p = 0.00 < 0.05)
                        Performance has improved.
comparison/log          time:   [230.91 ps 231.19 ps 231.52 ps]                           
                        change: [-2.5522% -2.0091% -1.6224%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

     Running benches/dispatch_get_clone.rs (target/release/deps/dispatch_get_clone-a4b9fba0a00acde6)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

WARNING: In Criterion.rs 0.4.0, running criterion benchmarks outside of cargo-criterion will become a default optional feature.
The statistical analysis and reporting is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'cargo_bench_support' feature in your Cargo.toml.

Dispatch::get_clone/none                                                                             
                        time:   [11.179 ns 11.205 ns 11.229 ns]
                        change: [+2.8256% +3.0879% +3.3400%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 4 outliers among 100 measurements (4.00%)
  4 (4.00%) low mild
Dispatch::get_clone/scoped                                                                             
                        time:   [10.592 ns 10.607 ns 10.624 ns]
                        change: [-5.2820% -5.0956% -4.8926%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
  5 (5.00%) high mild
Dispatch::get_clone/global                                                                             
                        time:   [10.855 ns 10.874 ns 10.896 ns]
                        change: [-1.2013% -0.7446% -0.2570%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 13 outliers among 100 measurements (13.00%)
  13 (13.00%) high mild

     Running benches/dispatch_get_ref.rs (target/release/deps/dispatch_get_ref-c7a01f8f4a1380fc)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

WARNING: In Criterion.rs 0.4.0, running criterion benchmarks outside of cargo-criterion will become a default optional feature.
The statistical analysis and reporting is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'cargo_bench_support' feature in your Cargo.toml.

Dispatch::get_ref/none  time:   [5.0173 ns 5.0313 ns 5.0445 ns]                                    
                        change: [+4.6369% +4.9740% +5.2991%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 17 outliers among 100 measurements (17.00%)
  17 (17.00%) low mild
Dispatch::get_ref/scoped                                                                             
                        time:   [4.1519 ns 4.1660 ns 4.1790 ns]
                        change: [-10.755% -6.8081% -3.2491%] (p = 0.00 < 0.05)
                        Performance has improved.
Dispatch::get_ref/global                                                                             
                        time:   [4.9459 ns 4.9525 ns 4.9598 ns]
                        change: [+2.7118% +3.0429% +3.3783%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 6 outliers among 100 measurements (6.00%)
  4 (4.00%) high mild
  2 (2.00%) high severe

     Running benches/empty_span.rs (target/release/deps/empty_span-739a1ad4702d35ab)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

WARNING: In Criterion.rs 0.4.0, running criterion benchmarks outside of cargo-criterion will become a default optional feature.
The statistical analysis and reporting is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'cargo_bench_support' feature in your Cargo.toml.

empty_span/none         time:   [233.97 ps 234.39 ps 234.82 ps]                            
                        change: [+0.2577% +0.4522% +0.6537%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
empty_span/scoped       time:   [226.14 ps 226.75 ps 227.41 ps]                              
                        change: [-3.0192% -2.8141% -2.6170%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  2 (2.00%) low mild
  5 (5.00%) high mild
  2 (2.00%) high severe
empty_span/global       time:   [232.92 ps 233.08 ps 233.21 ps]                              
                        change: [-0.7442% -0.6614% -0.5851%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 11 outliers among 100 measurements (11.00%)
  3 (3.00%) low severe
  3 (3.00%) low mild
  2 (2.00%) high mild
  3 (3.00%) high severe
empty_span/baseline_struct                                                                             
                        time:   [698.85 ps 699.10 ps 699.33 ps]
                        change: [-0.3951% -0.3338% -0.2743%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 16 outliers among 100 measurements (16.00%)
  5 (5.00%) low severe
  9 (9.00%) low mild
  2 (2.00%) high mild

     Running benches/enter_span.rs (target/release/deps/enter_span-3880ef403566fd6c)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

WARNING: In Criterion.rs 0.4.0, running criterion benchmarks outside of cargo-criterion will become a default optional feature.
The statistical analysis and reporting is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'cargo_bench_support' feature in your Cargo.toml.

enter_span/none         time:   [0.0000 ps 0.0000 ps 0.0000 ps]                                     
                        change: [-54.178% -3.0207% +101.95%] (p = 0.94 > 0.05)
                        No change in performance detected.
Found 13 outliers among 100 measurements (13.00%)
  6 (6.00%) high mild
  7 (7.00%) high severe
enter_span/scoped       time:   [2.5069 ns 2.5117 ns 2.5170 ns]                               
                        change: [-9.2260% -8.9143% -8.6078%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 5 outliers among 100 measurements (5.00%)
  3 (3.00%) high mild
  2 (2.00%) high severe
enter_span/global       time:   [2.5055 ns 2.5103 ns 2.5157 ns]                               
                        change: [-10.052% -9.8533% -9.6624%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  1 (1.00%) low mild
  5 (5.00%) high mild
  1 (1.00%) high severe

     Running benches/event.rs (target/release/deps/event-a4d04d9bf2c6ad28)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

WARNING: In Criterion.rs 0.4.0, running criterion benchmarks outside of cargo-criterion will become a default optional feature.
The statistical analysis and reporting is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'cargo_bench_support' feature in your Cargo.toml.

event/none              time:   [466.89 ps 468.18 ps 470.18 ps]                       
                        change: [+97.480% +98.890% +100.71%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 4 outliers among 100 measurements (4.00%)
  1 (1.00%) high mild
  3 (3.00%) high severe
event/scoped            time:   [15.831 ns 15.904 ns 15.972 ns]                          
                        change: [-24.912% -24.563% -24.225%] (p = 0.00 < 0.05)
                        Performance has improved.
event/scoped_recording  time:   [40.926 ns 41.035 ns 41.167 ns]                                    
                        change: [-13.169% -5.1812% +3.2606%] (p = 0.24 > 0.05)
                        No change in performance detected.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high severe
event/global            time:   [16.248 ns 16.257 ns 16.266 ns]                          
                        change: [-24.498% -24.431% -24.363%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) high mild
  2 (2.00%) high severe

     Running benches/span_fields.rs (target/release/deps/span_fields-0796a7d3506bb4eb)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

WARNING: In Criterion.rs 0.4.0, running criterion benchmarks outside of cargo-criterion will become a default optional feature.
The statistical analysis and reporting is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'cargo_bench_support' feature in your Cargo.toml.

span_fields/none        time:   [3.2079 ns 3.2216 ns 3.2364 ns]                              
                        change: [+0.9077% +1.2460% +1.5367%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 26 outliers among 100 measurements (26.00%)
  21 (21.00%) low severe
  4 (4.00%) high mild
  1 (1.00%) high severe
span_fields/scoped      time:   [57.759 ns 57.768 ns 57.777 ns]                               
                        change: [+0.9335% +1.2719% +1.6128%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 14 outliers among 100 measurements (14.00%)
  2 (2.00%) low severe
  4 (4.00%) low mild
  2 (2.00%) high mild
  6 (6.00%) high severe
span_fields/scoped_recording                                                                            
                        time:   [313.15 ns 313.98 ns 315.23 ns]
                        change: [+0.8909% +1.1739% +1.4703%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 2 outliers among 100 measurements (2.00%)
  1 (1.00%) high mild
  1 (1.00%) high severe
span_fields/global      time:   [56.030 ns 56.221 ns 56.422 ns]                               
                        change: [-1.7129% -1.4061% -1.0887%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 29 outliers among 100 measurements (29.00%)
  14 (14.00%) low severe
  15 (15.00%) high severe

     Running benches/span_no_fields.rs (target/release/deps/span_no_fields-0af1a55ba41d3b1d)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

WARNING: In Criterion.rs 0.4.0, running criterion benchmarks outside of cargo-criterion will become a default optional feature.
The statistical analysis and reporting is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'cargo_bench_support' feature in your Cargo.toml.

span_no_fields/none     time:   [1.3679 ns 1.3716 ns 1.3757 ns]                                 
                        change: [-2.0496% -1.8010% -1.5648%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  9 (9.00%) high mild
span_no_fields/scoped   time:   [18.518 ns 18.555 ns 18.597 ns]                                   
                        change: [+4.2898% +4.6713% +5.0787%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 13 outliers among 100 measurements (13.00%)
  5 (5.00%) high mild
  8 (8.00%) high severe
span_no_fields/scoped_recording                                                                             
                        time:   [31.516 ns 31.558 ns 31.609 ns]
                        change: [-3.9680% -3.6972% -3.4157%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 14 outliers among 100 measurements (14.00%)
  6 (6.00%) high mild
  8 (8.00%) high severe
span_no_fields/global   time:   [18.713 ns 18.775 ns 18.842 ns]                                   
                        change: [+7.0271% +7.3968% +7.7540%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 27 outliers among 100 measurements (27.00%)
  5 (5.00%) low severe
  10 (10.00%) low mild
  11 (11.00%) high mild
  1 (1.00%) high severe

     Running benches/span_repeated.rs (target/release/deps/span_repeated-6dfbf19ee48ad98d)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

WARNING: In Criterion.rs 0.4.0, running criterion benchmarks outside of cargo-criterion will become a default optional feature.
The statistical analysis and reporting is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'cargo_bench_support' feature in your Cargo.toml.

span_repeated/none      time:   [692.96 ns 695.41 ns 697.37 ns]                                
                        change: [-1.0408% -0.5428% -0.0167%] (p = 0.04 < 0.05)
                        Change within noise threshold.
span_repeated/scoped    time:   [3.3568 µs 3.3696 µs 3.3815 µs]                                  
                        change: [-8.7357% -8.4350% -8.1639%] (p = 0.00 < 0.05)
                        Performance has improved.
span_repeated/scoped_recording                                                                             
                        time:   [6.7256 µs 6.7427 µs 6.7602 µs]
                        change: [+10.103% +10.310% +10.560%] (p = 0.00 < 0.05)
                        Performance has regressed.
span_repeated/global    time:   [3.5486 µs 3.5586 µs 3.5665 µs]                                  
                        change: [-3.2379% -2.7979% -2.3661%] (p = 0.00 < 0.05)
                        Performance has improved.

@hawkw
Copy link
Member

hawkw commented Sep 2, 2022

@bkchr thanks for continuing to work on this, I'm excited to take a look at your recent changes.

@hawkw
Copy link
Member

hawkw commented Sep 2, 2022

@bkchr just to clarify, are change percentages in the benchmark results you posted in #2165 (comment) relative to v0.1.x, or to a previous state of this branch?

@bkchr
Copy link
Contributor Author

bkchr commented Sep 2, 2022

@bkchr just to clarify, are change percentages in the benchmark results you posted in #2165 (comment) relative to v0.1.x, or to a previous state of this branch?

They are relative to v0.1.x

@hawkw
Copy link
Member

hawkw commented Sep 2, 2022

Fantastic, thanks!

Comment on lines 293 to 296
GLOBAL_DEFAULT_DISPATCH.store(
GLOBAL_DISPATCH.as_mut().unwrap() as *mut _,
Ordering::SeqCst,
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally, i think this would be a compare_exchange so that it fails if the global dispatch value was something other than the initial default NO_DISPATCH value. we could panic if the CAS fails (at least in debug mode)

fn with_current<T>(&self, f: impl FnOnce(&Dispatch) -> T) -> T {
match &*self.0.default.borrow() {
Some(default) => f(default),
None => unsafe { f(&*GLOBAL_DEFAULT_DISPATCH.load(Ordering::SeqCst)) },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we sure this load needs to be sequentially consistent, or can it just be an Acquire load? what other atomic value does this need to synchronize with?

Comment on lines 174 to 187
// The global default dispatch that should be used by [`Enter::with_current`]
// when there is no explicit local dispatch set.
//
// By default this is initialized to [`NO_DISPATCH`] and will be set to
// [`GLOBAL_DISPATCH`] when this is being set.
static GLOBAL_DEFAULT_DISPATCH: Lazy<AtomicPtr<Dispatch>> =
Lazy::new(|| AtomicPtr::new(unsafe { &mut *NO_DISPATCH as *mut _ }));

// This is only `mut` to make it work as default value of [`GLOBAL_DEFAULT_DISPATCH`].
//
// We can not use `new` as we don't want this to be registered at the callsites.
static mut NO_DISPATCH: Lazy<Dispatch> = Lazy::new(|| Dispatch {
subscriber: Arc::new(NoSubscriber::default()),
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it occurs to me that we could potentially avoid the need to have two Lazy cells and a static mut if we made a way for a "no dispatcher" Dispatch to be constructed in a const fn. we could investigate changing Dispatch to:

pub struct Dispatch {
    subscriber: Option<Arc<dyn Subscriber + ...>>,
}

and having the None variant always nop. Of course, we'd want to ensure that doesn't have a worse performance impact, but it might be worth considering.

It would also make cloning the NO_DISPATCH dispatcher cheaper, as it wouldn't have to do an Arc refcount bump...

It also rewrites the logic on how the `current` dispatcher is determined.
@bkchr
Copy link
Contributor Author

bkchr commented Sep 3, 2022

Back, with your comments included @hawkw :) Now it also looks cleaner IMO.

comparison/relaxed_load time:   [493.59 ps 494.46 ps 495.27 ps]                                    
                        change: [-0.3906% -0.1201% +0.1655%] (p = 0.40 > 0.05)
                        No change in performance detected.
Found 11 outliers among 100 measurements (11.00%)
  1 (1.00%) low severe
  9 (9.00%) low mild
  1 (1.00%) high mild
comparison/acquire_load time:   [884.43 ps 886.11 ps 887.95 ps]                                     
                        change: [-0.4193% -0.1441% +0.1173%] (p = 0.30 > 0.05)
                        No change in performance detected.
Found 6 outliers among 100 measurements (6.00%)
  2 (2.00%) low mild
  3 (3.00%) high mild
  1 (1.00%) high severe
comparison/log          time:   [336.07 ps 336.87 ps 337.70 ps]                           
                        change: [+0.2617% +0.6892% +1.1727%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 4 outliers among 100 measurements (4.00%)
  3 (3.00%) high mild
  1 (1.00%) high severe

     Running benches/dispatch_get_clone.rs (target/release/deps/dispatch_get_clone-9ff6123e60d7d630)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

WARNING: In Criterion.rs 0.4.0, running criterion benchmarks outside of cargo-criterion will become a default optional feature.
The statistical analysis and reporting is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'cargo_bench_support' feature in your Cargo.toml.

Dispatch::get_clone/none                                                                             
                        time:   [2.9998 ns 3.0038 ns 3.0076 ns]
                        change: [-70.189% -70.129% -70.069%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 8 outliers among 100 measurements (8.00%)
  3 (3.00%) low mild
  4 (4.00%) high mild
  1 (1.00%) high severe
Dispatch::get_clone/scoped                                                                             
                        time:   [10.057 ns 10.068 ns 10.076 ns]
                        change: [-0.1177% +0.0344% +0.1933%] (p = 0.67 > 0.05)
                        No change in performance detected.
Found 8 outliers among 100 measurements (8.00%)
  5 (5.00%) low severe
  1 (1.00%) low mild
  2 (2.00%) high mild
Dispatch::get_clone/global                                                                             
                        time:   [10.061 ns 10.070 ns 10.077 ns]
                        change: [-0.0585% +0.0367% +0.1314%] (p = 0.48 > 0.05)
                        No change in performance detected.
Found 14 outliers among 100 measurements (14.00%)
  6 (6.00%) low severe
  7 (7.00%) low mild
  1 (1.00%) high mild

     Running benches/dispatch_get_ref.rs (target/release/deps/dispatch_get_ref-49aafb6847fa7ae9)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

WARNING: In Criterion.rs 0.4.0, running criterion benchmarks outside of cargo-criterion will become a default optional feature.
The statistical analysis and reporting is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'cargo_bench_support' feature in your Cargo.toml.

Dispatch::get_ref/none  time:   [2.9968 ns 2.9990 ns 3.0011 ns]                                    
                        change: [+0.9851% +1.1207% +1.2379%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 5 outliers among 100 measurements (5.00%)
  1 (1.00%) low mild
  3 (3.00%) high mild
  1 (1.00%) high severe
Dispatch::get_ref/scoped                                                                             
                        time:   [2.9301 ns 2.9376 ns 2.9513 ns]
                        change: [-1.2333% -1.0199% -0.6845%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 5 outliers among 100 measurements (5.00%)
  2 (2.00%) low severe
  2 (2.00%) low mild
  1 (1.00%) high severe
Dispatch::get_ref/global                                                                             
                        time:   [2.9884 ns 2.9902 ns 2.9919 ns]
                        change: [+0.7310% +0.8665% +1.0203%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 7 outliers among 100 measurements (7.00%)
  3 (3.00%) low severe
  4 (4.00%) low mild

     Running benches/empty_span.rs (target/release/deps/empty_span-751fffc7e9048d32)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

WARNING: In Criterion.rs 0.4.0, running criterion benchmarks outside of cargo-criterion will become a default optional feature.
The statistical analysis and reporting is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'cargo_bench_support' feature in your Cargo.toml.

empty_span/none         time:   [329.82 ps 330.12 ps 330.41 ps]                            
                        change: [-0.1032% -0.0057% +0.0941%] (p = 0.91 > 0.05)
                        No change in performance detected.
Found 10 outliers among 100 measurements (10.00%)
  3 (3.00%) low severe
  3 (3.00%) low mild
  3 (3.00%) high mild
  1 (1.00%) high severe
empty_span/scoped       time:   [330.09 ps 330.74 ps 331.58 ps]                              
                        change: [-0.0160% +0.1406% +0.3070%] (p = 0.10 > 0.05)
                        No change in performance detected.
Found 7 outliers among 100 measurements (7.00%)
  1 (1.00%) low severe
  2 (2.00%) low mild
  2 (2.00%) high mild
  2 (2.00%) high severe
empty_span/global       time:   [329.97 ps 330.26 ps 330.55 ps]                              
                        change: [+0.0591% +0.1913% +0.3266%] (p = 0.01 < 0.05)
                        Change within noise threshold.
Found 24 outliers among 100 measurements (24.00%)
  10 (10.00%) low severe
  5 (5.00%) low mild
  5 (5.00%) high mild
  4 (4.00%) high severe
empty_span/baseline_struct                                                                            
                        time:   [494.73 ps 495.26 ps 495.74 ps]
                        change: [+0.2412% +0.4528% +0.6706%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 20 outliers among 100 measurements (20.00%)
  5 (5.00%) low severe
  6 (6.00%) low mild
  6 (6.00%) high mild
  3 (3.00%) high severe

     Running benches/event.rs (target/release/deps/event-e592a707b8901b23)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

WARNING: In Criterion.rs 0.4.0, running criterion benchmarks outside of cargo-criterion will become a default optional feature.
The statistical analysis and reporting is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'cargo_bench_support' feature in your Cargo.toml.

event/none              time:   [329.13 ps 329.50 ps 329.86 ps]                       
                        change: [+0.1032% +0.3358% +0.5666%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 12 outliers among 100 measurements (12.00%)
  6 (6.00%) low severe
  5 (5.00%) low mild
  1 (1.00%) high mild
event/scoped            time:   [7.5733 ns 7.5864 ns 7.5997 ns]                          
                        change: [-8.2795% -8.1311% -7.9694%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
  5 (5.00%) low mild
  5 (5.00%) high mild
event/scoped_recording  time:   [23.587 ns 23.724 ns 23.854 ns]                                    
                        change: [-11.905% -6.1036% +1.0146%] (p = 0.04 < 0.05)
                        Change within noise threshold.
Found 22 outliers among 100 measurements (22.00%)
  1 (1.00%) low severe
  5 (5.00%) low mild
  5 (5.00%) high mild
  11 (11.00%) high severe
event/global            time:   [7.5800 ns 7.5942 ns 7.6108 ns]                          
                        change: [-8.0365% -7.8568% -7.6707%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 17 outliers among 100 measurements (17.00%)
  4 (4.00%) low severe
  9 (9.00%) low mild
  2 (2.00%) high mild
  2 (2.00%) high severe

     Running benches/span_fields.rs (target/release/deps/span_fields-9282b50420408f52)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

WARNING: In Criterion.rs 0.4.0, running criterion benchmarks outside of cargo-criterion will become a default optional feature.
The statistical analysis and reporting is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'cargo_bench_support' feature in your Cargo.toml.

span_fields/none        time:   [2.3021 ns 2.3063 ns 2.3102 ns]                              
                        change: [-1.6842% -1.3918% -1.1428%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) low severe
  1 (1.00%) low mild
  1 (1.00%) high mild
span_fields/scoped      time:   [19.884 ns 19.916 ns 19.946 ns]                                
                        change: [+0.7307% +0.9715% +1.1714%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 9 outliers among 100 measurements (9.00%)
  1 (1.00%) low severe
  3 (3.00%) low mild
  4 (4.00%) high mild
  1 (1.00%) high severe
span_fields/scoped_recording                                                                            
                        time:   [189.58 ns 189.73 ns 189.88 ns]
                        change: [+0.3089% +0.5872% +0.8489%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 10 outliers among 100 measurements (10.00%)
  6 (6.00%) low severe
  2 (2.00%) low mild
  2 (2.00%) high severe
span_fields/global      time:   [19.877 ns 19.919 ns 19.958 ns]                                
                        change: [+0.7109% +0.8928% +1.0739%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) low severe

     Running benches/span_no_fields.rs (target/release/deps/span_no_fields-69fd96f2d7a19ce6)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

WARNING: In Criterion.rs 0.4.0, running criterion benchmarks outside of cargo-criterion will become a default optional feature.
The statistical analysis and reporting is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'cargo_bench_support' feature in your Cargo.toml.

span_no_fields/none     time:   [841.20 ps 842.43 ps 843.63 ps]                                 
                        change: [-0.1330% +0.0280% +0.1930%] (p = 0.75 > 0.05)
                        No change in performance detected.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) low severe
  1 (1.00%) low mild
  1 (1.00%) high mild
span_no_fields/scoped   time:   [10.090 ns 10.104 ns 10.119 ns]                                   
                        change: [+0.2439% +0.5109% +0.7906%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 5 outliers among 100 measurements (5.00%)
  2 (2.00%) low mild
  1 (1.00%) high mild
  2 (2.00%) high severe
span_no_fields/scoped_recording                                                                             
                        time:   [13.881 ns 13.897 ns 13.912 ns]
                        change: [-7.0297% -6.7802% -6.5629%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  2 (2.00%) low severe
  5 (5.00%) low mild
span_no_fields/global   time:   [10.127 ns 10.156 ns 10.186 ns]                                   
                        change: [+0.3537% +0.6154% +0.9268%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 8 outliers among 100 measurements (8.00%)
  1 (1.00%) low mild
  4 (4.00%) high mild
  3 (3.00%) high severe

     Running benches/span_repeated.rs (target/release/deps/span_repeated-fe2214b2c905bfc4)
WARNING: HTML report generation will become a non-default optional feature in Criterion.rs 0.4.0.
This feature is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'html_reports' feature in your Cargo.toml.

WARNING: In Criterion.rs 0.4.0, running criterion benchmarks outside of cargo-criterion will become a default optional feature.
The statistical analysis and reporting is being moved to cargo-criterion (https://github.com/bheisler/cargo-criterion) and will be optional in a future version of Criterion.rs. To silence this warning, either switch to cargo-criterion or enable the 'cargo_bench_support' feature in your Cargo.toml.

span_repeated/none      time:   [192.21 ns 192.47 ns 192.73 ns]                               
                        change: [+0.4719% +0.7047% +0.9263%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) low mild
  1 (1.00%) high mild
  1 (1.00%) high severe
span_repeated/scoped    time:   [1.2395 µs 1.2413 µs 1.2430 µs]                                  
                        change: [+2.3241% +2.5283% +2.7397%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 11 outliers among 100 measurements (11.00%)
  1 (1.00%) low severe
  8 (8.00%) low mild
  1 (1.00%) high mild
  1 (1.00%) high severe
span_repeated/scoped_recording                                                                             
                        time:   [3.1020 µs 3.1070 µs 3.1124 µs]
                        change: [+2.0387% +2.2613% +2.4831%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) low mild
  1 (1.00%) high mild
span_repeated/global    time:   [1.2360 µs 1.2373 µs 1.2387 µs]                                  
                        change: [+2.2105% +2.3841% +2.5537%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 11 outliers among 100 measurements (11.00%)
  4 (4.00%) low severe
  6 (6.00%) low mild
  1 (1.00%) high severe

@bkchr bkchr requested a review from yaahc as a code owner September 13, 2022 09:28
@bkchr
Copy link
Contributor Author

bkchr commented Sep 14, 2022

@hawkw would be nice if you could take a look when you have time

@bkchr
Copy link
Contributor Author

bkchr commented Dec 9, 2022

@hawkw could I get some new review? 🙈

@bkchr
Copy link
Contributor Author

bkchr commented Jan 10, 2023

Sorry @hawkw for pinging you again 🙈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants