Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1ba2245
WIP — runtime vs compiletime
kukushechkin Nov 27, 2025
4a7321d
this makes much more sense
kukushechkin Nov 27, 2025
c0a7bbc
This is an abomination, and it doesn’t work :(
kukushechkin Nov 27, 2025
b773da7
rearrange files
kukushechkin Nov 27, 2025
e883a28
fixup! rearrange files
kukushechkin Nov 27, 2025
98b1b1d
aha, there is a mistake actually
kukushechkin Nov 27, 2025
d4e3bf7
try running this in CI
kukushechkin Nov 27, 2025
ad17d3d
per-benchmark target thresholds
kukushechkin Nov 28, 2025
3a256cf
traits description
kukushechkin Nov 28, 2025
c4c0afc
simplify implementation
kukushechkin Nov 28, 2025
1da20af
add generic log method traits benchmarks
kukushechkin Nov 28, 2025
4e547cc
fixup! add generic log method traits benchmarks
kukushechkin Nov 28, 2025
45d4e41
fixup! add generic log method traits benchmarks
kukushechkin Nov 28, 2025
62c971f
updated thresholds values
kukushechkin Nov 28, 2025
3ea952a
fixup! updated thresholds values
kukushechkin Dec 1, 2025
1b9358f
fixup! simplify implementation
kukushechkin Dec 1, 2025
63eb1ab
switch from DisableXXXLogs to MaxLogLevelXXX traits
kukushechkin Dec 1, 2025
6482b70
add traits to the docs
kukushechkin Dec 1, 2025
2991333
enable traits benchmarks in the CI
kukushechkin Dec 1, 2025
cef7ebc
fixup! enable traits benchmarks in the CI
kukushechkin Dec 1, 2025
87d8412
remove MaxLogLevelTrace as it is the same as no tratis
kukushechkin Dec 1, 2025
4246386
exclude versioned manifest files from license header check
kukushechkin Dec 1, 2025
90afdc8
no need to test an exclusion trait on different platforms
kukushechkin Dec 1, 2025
0dbd4e2
fixup! no need to test an exclusion trait on different platforms
kukushechkin Dec 1, 2025
0174cf8
fixup! switch from DisableXXXLogs to MaxLogLevelXXX traits
kukushechkin Dec 1, 2025
8f80ad4
move traits docs to the docs
kukushechkin Dec 1, 2025
8adba90
fixup! move traits docs to the docs
kukushechkin Dec 1, 2025
4db8c2c
fixup formatting
kukushechkin Dec 1, 2025
3100360
I cannot explain this
kukushechkin Dec 1, 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
11 changes: 9 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,20 @@ 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_xcode_16_4_enabled: true
macos_xcode_26_1_enabled: true

benchmarks-MaxLogLevelWarningBenchmarks-trait:
name: Benchmarks (MaxLogLevelWarning)
uses: apple/swift-nio/.github/workflows/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
12 changes: 10 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,22 @@ 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_runner_pool: general
macos_xcode_16_4_enabled: true
macos_xcode_26_1_enabled: true

benchmarks-MaxLogLevelWarningBenchmarks-trait:
name: Benchmarks (MaxLogLevelWarning)
uses: apple/swift-nio/.github/workflows/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
}
33 changes: 15 additions & 18 deletions Benchmarks/Package.swift
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
// swift-tools-version: 6.0
// 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: "Benchmarks",
name: "BenchmarksFactory",
platforms: [
.macOS(.v13)
],
products: [
.library(name: "BenchmarksFactory", targets: ["BenchmarksFactory"])
],
dependencies: [
.package(path: "../"),
.package(url: "https://github.com/ordo-one/package-benchmark.git", from: "1.29.6"),
.package(path: "../"), // swift-log
],
targets: [
.target(
name: "BenchmarksFactory",
dependencies: [
.product(name: "Benchmark", package: "package-benchmark"),
.product(name: "Logging", package: "swift-log"),
]
)
]
)

// Benchmark of SwiftLogBenchmarks
package.targets += [
.executableTarget(
name: "SwiftLogBenchmarks",
dependencies: [
.product(name: "Benchmark", package: "package-benchmark"),
.product(name: "Logging", package: "swift-log"),
],
path: "Benchmarks/SwiftLogBenchmarks",
plugins: [
.plugin(name: "BenchmarkPlugin", package: "package-benchmark")
]
)
]
Loading
Loading