tracing icon indicating copy to clipboard operation
tracing copied to clipboard

Fix logging with interest cache

Open bkchr opened this issue 2 years ago • 21 comments

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 https://github.com/tokio-rs/tracing/pull/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 avatar Jun 17 '22 13:06 bkchr

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

bkchr avatar Jun 17 '22 13:06 bkchr

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.

davidbarsky avatar Jun 17 '22 15:06 davidbarsky

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 avatar Jun 17 '22 15:06 bkchr

@koute is there any reason your pr https://github.com/tokio-rs/tracing/pull/1636 wasn't made against master?

bkchr avatar Jun 17 '22 15:06 bkchr

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.

davidbarsky avatar Jun 17 '22 20:06 davidbarsky

@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?

koute avatar Jun 18 '22 04:06 koute

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!

hawkw avatar Jun 19 '22 00:06 hawkw

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

bkchr avatar Jun 19 '22 17:06 bkchr

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

hawkw avatar Jun 22 '22 23:06 hawkw

@hawkw ty! :)

bkchr avatar Jun 23 '22 10:06 bkchr

@hawkw how do we want to move forward?

bkchr avatar Jun 23 '22 10:06 bkchr

@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 avatar Jun 24 '22 16:06 hawkw

Whoops, we were actually not running the benchmarks with a global default subscriber (:upside_down_face:). After fixing that (in 181bdbe1d8f6222aaff6dea17267d0779d07caf3), 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 20d96955088be325fbc3fc319d8f89144c1fe202 than on v0.1.x.

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

hawkw avatar Jun 24 '22 17:06 hawkw

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 avatar Jun 25 '22 06:06 bkchr

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.

bkchr avatar Aug 30 '22 09:08 bkchr

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

hawkw avatar Sep 02 '22 20:09 hawkw

@bkchr just to clarify, are change percentages in the benchmark results you posted in https://github.com/tokio-rs/tracing/pull/2165#issuecomment-1231420625 relative to v0.1.x, or to a previous state of this branch?

hawkw avatar Sep 02 '22 20:09 hawkw

@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

bkchr avatar Sep 02 '22 20:09 bkchr

Fantastic, thanks!

hawkw avatar Sep 02 '22 20:09 hawkw

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 avatar Sep 03 '22 20:09 bkchr

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

bkchr avatar Sep 14 '22 09:09 bkchr

@hawkw could I get some new review? :see_no_evil:

bkchr avatar Dec 09 '22 09:12 bkchr

Sorry @hawkw for pinging you again :see_no_evil:

bkchr avatar Jan 10 '23 15:01 bkchr