Skip to content

Logging instructions and allocations benchmarks#386

Merged
kukushechkin merged 42 commits intoapple:mainfrom
kukushechkin:logging-benchmarks
Nov 24, 2025
Merged

Logging instructions and allocations benchmarks#386
kukushechkin merged 42 commits intoapple:mainfrom
kukushechkin:logging-benchmarks

Conversation

@kukushechkin
Copy link
Copy Markdown
Contributor

@kukushechkin kukushechkin commented Nov 6, 2025

Add simple benchmarks measuring instructions count and allocations when logging with various log levels.

Motivation:

Establish the baseline and have automated checks before approaching performance improvements.

Modifications:

Result:

  • CI workflows are running benchmarks on Linux and macOS
  • Thresholds are verified only on macOS

An example of a benchmark failing with a better results than expected: https://github.com/apple/swift-log/actions/runs/19540944353/job/55950355442

An example of a benchmark failing with a worse results than expected: https://github.com/apple/swift-log/actions/runs/19569105729/job/56038101552

@kukushechkin kukushechkin added the semver/none No version bump required. label Nov 6, 2025
@kukushechkin kukushechkin force-pushed the logging-benchmarks branch 2 times, most recently from 8811d1f to 62cf62d Compare November 11, 2025 12:42
@kukushechkin kukushechkin changed the title [WIP] Logging benchmarks Logging instructions and allocations benchmarks Nov 20, 2025
@kukushechkin kukushechkin marked this pull request as ready for review November 21, 2025 12:04
@kukushechkin kukushechkin requested review from FranzBusch, czechboy0 and rnro and removed request for czechboy0 and rnro November 21, 2025 12:07
Copy link
Copy Markdown
Contributor

@rnro rnro left a comment

Choose a reason for hiding this comment

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

The implementation of this looks good but my main thought is - woah that's a lot of files. I suspect this would be painful to maintain. Do you actually want to explore the full parameter space? It seems you'd get most of the value from for example:

  • Each log level when enabled
  • Each log level when disabled (or even a log level when disabled)

@kukushechkin
Copy link
Copy Markdown
Contributor Author

Yeah, I've been thinking about this as well. It is not painful, as they are all the same, but added value in having all of them is basically none. Yeah, let's go with 4 cases to keep the implementation, just a permutation of [.debug, .error].

@kukushechkin kukushechkin enabled auto-merge (squash) November 24, 2025 10:36
@kukushechkin kukushechkin merged commit 95a70b9 into apple:main Nov 24, 2025
56 checks passed
@kukushechkin kukushechkin deleted the logging-benchmarks branch November 24, 2025 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/none No version bump required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants