mirror of
https://github.com/apple/swift-log
synced 2026-11-22 03:40:39 +00:00
Make benchmarks more reliable by using the scale factor (#539)
### Motivation: Currently the benchmark machinery overhead is causing a lot of noise in benchmarks of very efficient/fast code. ### Modifications: Use the scaling factor to amortize the fixed overhead and let the actual tested code account for most of the measured metrics. ### Result: More reliable benchmarks that don't fail 20% of the time.
This commit is contained in:
1 parent
c7413d967b
commit
d05c8efdae
47 files changed
+92
-87
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 734,
|
||||
"instructions" : 6771,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 734,
|
||||
"instructions" : 6767,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 734,
|
||||
"instructions" : 6775,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 710,
|
||||
"instructions" : 6771,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 810,
|
||||
"instructions" : 6875,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 803,
|
||||
"instructions" : 6879,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 803,
|
||||
"instructions" : 6895,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 803,
|
||||
"instructions" : 6867,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 734,
|
||||
"instructions" : 6775,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 734,
|
||||
"instructions" : 6747,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 689,
|
||||
"instructions" : 6775,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 1993,
|
||||
"instructions" : 1251327,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 1968,
|
||||
"instructions" : 1251327,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 815,
|
||||
"instructions" : 6847,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 750,
|
||||
"instructions" : 6863,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 775,
|
||||
"instructions" : 6871,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 2008,
|
||||
"instructions" : 1189887,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 2002,
|
||||
"instructions" : 1189887,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 1050,
|
||||
"instructions" : 324863,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 1050,
|
||||
"instructions" : 324863,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 1046,
|
||||
"instructions" : 320767,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 5483,
|
||||
"objectAllocCount" : 1
|
||||
"instructions" : 4751359,
|
||||
"objectAllocCount" : 1000
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 4939775,
|
||||
"objectAllocCount" : 2016
|
||||
"instructions" : 5039157355,
|
||||
"objectAllocCount" : 2016000
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 82239,
|
||||
"objectAllocCount" : 37
|
||||
"instructions" : 81723391,
|
||||
"objectAllocCount" : 37000
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 18351,
|
||||
"objectAllocCount" : 6
|
||||
"instructions" : 17661951,
|
||||
"objectAllocCount" : 6000
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 6200,
|
||||
"objectAllocCount" : 2
|
||||
"instructions" : 5644287,
|
||||
"objectAllocCount" : 2000
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 7600,
|
||||
"objectAllocCount" : 3
|
||||
"instructions" : 7065599,
|
||||
"objectAllocCount" : 3000
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 1005,
|
||||
"instructions" : 272895,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 1017,
|
||||
"instructions" : 284927,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 1966,
|
||||
"instructions" : 1249279,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 4551,
|
||||
"objectAllocCount" : 1
|
||||
"instructions" : 3696639,
|
||||
"objectAllocCount" : 1000
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 9623,
|
||||
"objectAllocCount" : 4
|
||||
"instructions" : 9117695,
|
||||
"objectAllocCount" : 4000
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 1119,
|
||||
"instructions" : 324863,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 1119,
|
||||
"instructions" : 324863,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 1117,
|
||||
"instructions" : 323071,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 5327,
|
||||
"objectAllocCount" : 1
|
||||
}
|
||||
"instructions" : 4415487,
|
||||
"objectAllocCount" : 1000
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 4263935,
|
||||
"objectAllocCount" : 2016
|
||||
}
|
||||
"instructions" : 4322989256,
|
||||
"objectAllocCount" : 2016000
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 69119,
|
||||
"objectAllocCount" : 37
|
||||
}
|
||||
"instructions" : 68354047,
|
||||
"objectAllocCount" : 37000
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 15471,
|
||||
"objectAllocCount" : 6
|
||||
}
|
||||
"instructions" : 14581759,
|
||||
"objectAllocCount" : 6000
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 6851,
|
||||
"objectAllocCount" : 2
|
||||
}
|
||||
"instructions" : 5795839,
|
||||
"objectAllocCount" : 2000
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 8399,
|
||||
"objectAllocCount" : 3
|
||||
}
|
||||
"instructions" : 7192575,
|
||||
"objectAllocCount" : 3000
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 1095,
|
||||
"instructions" : 301055,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 1038,
|
||||
"instructions" : 243967,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 1972,
|
||||
"instructions" : 1189887,
|
||||
"objectAllocCount" : 0
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 4171,
|
||||
"objectAllocCount" : 1
|
||||
}
|
||||
"instructions" : 3264511,
|
||||
"objectAllocCount" : 1000
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"instructions" : 10231,
|
||||
"objectAllocCount" : 4
|
||||
}
|
||||
"instructions" : 8929279,
|
||||
"objectAllocCount" : 4000
|
||||
}
|
||||
@@ -36,6 +36,7 @@ public func makeBenchmark(
|
||||
"\(logLevel)_log_with_\(loggerLevel)_log_level\(suffix)",
|
||||
configuration: .init(
|
||||
metrics: metrics,
|
||||
scalingFactor: .kilo,
|
||||
maxIterations: iterations,
|
||||
thresholds: [
|
||||
.instructions: BenchmarkThresholds(
|
||||
@@ -54,12 +55,16 @@ public func makeBenchmark(
|
||||
if setScopedLogger {
|
||||
withLogger(logger) { logger in
|
||||
benchmark.startMeasurement()
|
||||
body(logger)
|
||||
for _ in benchmark.scaledIterations {
|
||||
body(logger)
|
||||
}
|
||||
benchmark.stopMeasurement()
|
||||
}
|
||||
} else {
|
||||
benchmark.startMeasurement()
|
||||
body(logger)
|
||||
for _ in benchmark.scaledIterations {
|
||||
body(logger)
|
||||
}
|
||||
benchmark.stopMeasurement()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user