slashmo / gsoc-swift-baggage-context

BaggageContext library, extracted from slashmo/gsoc-swift-tracing
https://github.com/slashmo/gsoc-swift-tracing
Apache License 2.0
4 stars 2 forks source link

+simple benchmarks to have a gut feeling how mutating and the CoW cos… #14

Closed ktoso closed 3 years ago

ktoso commented 3 years ago

+simple benchmarks to have a gut feeling how mutating and the CoW costs for small contexts


Just wanted to have a small bench in place to have a gut feeling how much the CoW costs in reality...

We could add benchmarks like "what if 10% of the passes actually mutate the context", kind of aiming to get a gut feeling how much the passing around costs in reality with spans -- i.e. not all spans are recording, so not all spans are mutating the context; so in reality the overhead should be lower since most context mutations come from tracing operations and those only are applied if a trace is recording...

Anyway, just wanted to get the bench infra in here from swift-tracing as well, so if we have open questions it's easier to drop in a small benchmark.

The current ones not super interesting but I always like having benches in such repos, results on a mac (2.9 GHz 6-Core Intel Core i9):

swift run -c release Benchmarks --num-samples=10
#,TEST,SAMPLES,MIN(ns),MAX(ns),MEAN(ns),SD(ns),MEDIAN(ns)
1,BaggagePassingBenchmarks.pass_async_empty_100_000         ,10,96761075,226742023,163859302,46777462,172248685
2,BaggagePassingBenchmarks.pass_async_small_nonconst_100_000,10,259236007,459839255,360516577,69993366,358092070
3,BaggagePassingBenchmarks.pass_async_smol_100_000          ,10,510405018,729591377,615266033,80337961,604507953
4,BaggagePassingBenchmarks.pass_mut_async_small_100_000     ,10,949655948,1438292385,1193634086,174148469,1170067338

Total performance tests executed: 4
ktoso commented 3 years ago

Thx, let's have it in, we can poke around some more if we ever need to.