Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e69f399
WIP — runtime vs compiletime
kukushechkin Nov 27, 2025
70b30d5
this makes much more sense
kukushechkin Nov 27, 2025
93f1e61
This is an abomination, and it doesn’t work :(
kukushechkin Nov 27, 2025
fe25866
rearrange files
kukushechkin Nov 27, 2025
314eff1
fixup! rearrange files
kukushechkin Nov 27, 2025
62a55a7
aha, there is a mistake actually
kukushechkin Nov 27, 2025
db5e7eb
try running this in CI
kukushechkin Nov 27, 2025
8375393
per-benchmark target thresholds
kukushechkin Nov 28, 2025
681f84b
traits description
kukushechkin Nov 28, 2025
05bc5dc
simplify implementation
kukushechkin Nov 28, 2025
3f8f40e
add generic log method traits benchmarks
kukushechkin Nov 28, 2025
e4cd20f
fixup! add generic log method traits benchmarks
kukushechkin Nov 28, 2025
85d9fd6
fixup! add generic log method traits benchmarks
kukushechkin Nov 28, 2025
5039408
updated thresholds values
kukushechkin Nov 28, 2025
dc685ba
fixup! updated thresholds values
kukushechkin Dec 1, 2025
381c68a
fixup! simplify implementation
kukushechkin Dec 1, 2025
50ad7b3
switch from DisableXXXLogs to MaxLogLevelXXX traits
kukushechkin Dec 1, 2025
c33a907
add traits to the docs
kukushechkin Dec 1, 2025
cdc8454
enable traits benchmarks in the CI
kukushechkin Dec 1, 2025
7cb72ac
fixup! enable traits benchmarks in the CI
kukushechkin Dec 1, 2025
3419667
remove MaxLogLevelTrace as it is the same as no tratis
kukushechkin Dec 1, 2025
0e49987
exclude versioned manifest files from license header check
kukushechkin Dec 1, 2025
be83de3
no need to test an exclusion trait on different platforms
kukushechkin Dec 1, 2025
9491301
fixup! no need to test an exclusion trait on different platforms
kukushechkin Dec 1, 2025
efceeba
fixup! switch from DisableXXXLogs to MaxLogLevelXXX traits
kukushechkin Dec 1, 2025
831717b
move traits docs to the docs
kukushechkin Dec 1, 2025
4bdf279
fixup! move traits docs to the docs
kukushechkin Dec 1, 2025
b772d65
fixup formatting
kukushechkin Dec 1, 2025
1352767
I cannot explain this
kukushechkin Dec 1, 2025
4c617af
benchmarks are using the same reusable workflow
kukushechkin Dec 10, 2025
3c2421c
fixup! benchmarks are using the same reusable workflow
kukushechkin Dec 10, 2025
1ba56d3
fixup! benchmarks are using the same reusable workflow
kukushechkin Dec 10, 2025
21a068c
split macOS and Linux benchmarks
kukushechkin Dec 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,34 @@ jobs:
windows_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"

benchmarks:
name: Benchmarks
name: Benchmarks (NoTraits)
uses: apple/swift-nio/.github/workflows/benchmarks.yml@main
with:
benchmark_package_path: "Benchmarks"
benchmark_package_path: "Benchmarks/NoTraits"

macos-benchmarks:
name: macOS benchmarks
name: macOS benchmarks (NoTraits)
uses: apple/swift-nio/.github/workflows/macos_benchmarks.yml@main
with:
benchmark_package_path: "Benchmarks"
benchmark_package_path: "Benchmarks/NoTraits"
macos_xcode_16_4_enabled: true
macos_xcode_26_1_enabled: true

benchmarks-MaxLogLevelWarningBenchmarks-trait:
name: Benchmarks (MaxLogLevelWarning)
needs: benchmarks
uses: apple/swift-nio/.github/workflows/benchmarks.yml@main
with:
benchmark_package_path: "Benchmarks/MaxLogLevelWarning"

macos-benchmarks-MaxLogLevelWarningBenchmarks-trait:
name: macOS benchmarks (MaxLogLevelWarning)
needs: macos-benchmarks
uses: apple/swift-nio/.github/workflows/macos_benchmarks.yml@main
with:
benchmark_package_path: "Benchmarks/MaxLogLevelWarning"
macos_xcode_26_1_enabled: true

cxx-interop:
name: Cxx interop
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
Expand Down
26 changes: 22 additions & 4 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,38 @@ jobs:
windows_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"

benchmarks:
name: Benchmarks
name: Benchmarks (NoTraits)
uses: apple/swift-nio/.github/workflows/benchmarks.yml@main
with:
benchmark_package_path: "Benchmarks"
benchmark_package_path: "Benchmarks/NoTraits"

macos-benchmarks:
name: macOS benchmarks
name: macOS benchmarks (NoTraits)
uses: apple/swift-nio/.github/workflows/macos_benchmarks.yml@main
with:
benchmark_package_path: "Benchmarks"
benchmark_package_path: "Benchmarks/NoTraits"
macos_runner_pool: general
macos_xcode_16_4_enabled: true
macos_xcode_26_1_enabled: true

benchmarks-MaxLogLevelWarningBenchmarks-trait:
name: Benchmarks (MaxLogLevelWarning)
# Workaround for reusing the same benchmarks.yml workflow
needs: benchmarks
uses: apple/swift-nio/.github/workflows/benchmarks.yml@main
with:
benchmark_package_path: "Benchmarks/MaxLogLevelWarning"

macos-benchmarks-MaxLogLevelWarningBenchmarks-trait:
name: macOS benchmarks (MaxLogLevelWarning)
# Workaround for reusing the same benchmarks.yml workflow
needs: macos-benchmarks
uses: apple/swift-nio/.github/workflows/macos_benchmarks.yml@main
with:
benchmark_package_path: "Benchmarks/MaxLogLevelWarning"
macos_runner_pool: general
macos_xcode_26_1_enabled: true

cxx-interop:
name: Cxx interop
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
Expand Down
2 changes: 2 additions & 0 deletions .licenseignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Package.swift
**/Package.swift
Package@-*.swift
**/Package@-*.swift
Package@swift-*.swift
**/Package@swift-*.swift
Package.resolved
**/Package.resolved
Makefile
Expand Down
57 changes: 0 additions & 57 deletions Benchmarks/Benchmarks/SwiftLogBenchmarks/SwiftLogBenchmarks.swift

This file was deleted.

8 changes: 8 additions & 0 deletions Benchmarks/MaxLogLevelWarning/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Logging API open source project
//
// Copyright (c) 2025 Apple Inc. and the Swift Logging API project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

import Benchmark
import BenchmarksFactory
import Foundation
import Logging

public let benchmarks: @Sendable () -> Void = {
makeBenchmark(loggerLevel: .notice, logLevel: .notice) { logger in
logger.notice("hello, benchmarking world")
}
makeBenchmark(loggerLevel: .notice, logLevel: .notice, "_generic") { logger in
logger.log(level: .notice, "hello, benchmarking world")
}
makeBenchmark(loggerLevel: .warning, logLevel: .warning) { logger in
logger.warning("hello, benchmarking world")
}
makeBenchmark(loggerLevel: .warning, logLevel: .warning, "_generic") { logger in
logger.log(level: .warning, "hello, benchmarking world")
}
}
38 changes: 38 additions & 0 deletions Benchmarks/MaxLogLevelWarning/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// swift-tools-version: 6.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "MaxLogLevelWarning",
platforms: [
.macOS(.v13)
],
products: [
.executable(name: "MaxLogLevelWarning", targets: ["MaxLogLevelWarning"])
],
dependencies: [
// swift-log
.package(
path: "../../",
traits: ["MaxLogLevelWarning"]
),
// Parent Benchmarks
.package(name: "Benchmarks", path: "../"),
.package(url: "https://github.com/ordo-one/package-benchmark.git", from: "1.29.6"),
],
targets: [
.executableTarget(
name: "MaxLogLevelWarning",
dependencies: [
.product(name: "BenchmarksFactory", package: "Benchmarks"),
.product(name: "Benchmark", package: "package-benchmark"),
.product(name: "Logging", package: "swift-log"),
],
path: "Benchmarks/MaxLogLevelWarningBenchmarks",
plugins: [
.plugin(name: "BenchmarkPlugin", package: "package-benchmark")
]
)
]
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 1045,
"instructions" : 589,
"objectAllocCount" : 0
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 1126,
"instructions" : 589,
"objectAllocCount" : 0
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 3279,
"instructions" : 3009,
"objectAllocCount" : 1
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 3279,
"instructions" : 3009,
"objectAllocCount" : 1
}
8 changes: 8 additions & 0 deletions Benchmarks/NoTraits/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
27 changes: 27 additions & 0 deletions Benchmarks/NoTraits/Benchmarks/NoTraitsBenchmarks/NoTraits.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Logging API open source project
//
// Copyright (c) 2025 Apple Inc. and the Swift Logging API project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Swift Logging API project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

import Benchmark
import BenchmarksFactory
import Foundation
import Logging

public let benchmarks: @Sendable () -> Void = {
makeBenchmark(loggerLevel: .error, logLevel: .error, "_generic") { logger in
logger.log(level: .error, "hello, benchmarking world")
}
makeBenchmark(loggerLevel: .error, logLevel: .debug, "_generic") { logger in
logger.log(level: .debug, "hello, benchmarking world")
}
}
37 changes: 37 additions & 0 deletions Benchmarks/NoTraits/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "NoTraits",
platforms: [
.macOS(.v13)
],
products: [
.executable(name: "NoTraits", targets: ["NoTraits"])
],
dependencies: [
// swift-log
.package(
path: "../../"
),
// Parent Benchmarks
.package(name: "Benchmarks", path: "../"),
.package(url: "https://github.com/ordo-one/package-benchmark.git", from: "1.29.6"),
],
targets: [
.executableTarget(
name: "NoTraits",
dependencies: [
.product(name: "BenchmarksFactory", package: "Benchmarks"),
.product(name: "Benchmark", package: "package-benchmark"),
.product(name: "Logging", package: "swift-log"),
],
path: "Benchmarks/NoTraitsBenchmarks",
plugins: [
.plugin(name: "BenchmarkPlugin", package: "package-benchmark")
]
)
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"instructions" : 937,
"objectAllocCount" : 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"instructions" : 1718,
"objectAllocCount" : 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"instructions" : 855,
"objectAllocCount" : 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"instructions" : 1636,
"objectAllocCount" : 0
}
Loading