Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
891aec2
SLG-0006: task-local logger proposal
kukushechkin May 18, 2026
0ed85c1
SLG-0006: task-local logger implementation
kukushechkin May 18, 2026
a4f45ab
[implementation] Create root task-local logger on first .current usage
kukushechkin May 28, 2026
5767644
[proposal] Create root task-local logger on first .current usage
kukushechkin May 28, 2026
302b19c
Merge branch 'main' into SLG-0006-task-local-logger-implementation
kukushechkin May 29, 2026
de192c4
fixup! [implementation] Create root task-local logger on first .curre…
kukushechkin May 29, 2026
c4e28e1
fixup! [implementation] Create root task-local logger on first .curre…
kukushechkin Jun 4, 2026
accf3af
[proposal] typed throws + metadata autoclosure
kukushechkin Jun 4, 2026
38dad4f
[implementation] typed throws + metadata autoclosure
kukushechkin Jun 4, 2026
eb974cb
[implementation] nonisolated(nonsending) formatting
kukushechkin Jun 4, 2026
d825a7a
[proposal] nonisolated(nonsending) formatting
kukushechkin Jun 4, 2026
378b7ce
[proposal] add 3rd party dependency mechanisms to the alternatives
kukushechkin Jun 5, 2026
6274dfa
Ready for Implementation
kukushechkin Jun 11, 2026
a237876
Merge branch 'main' into SLG-0006-task-local-logger-implementation
kukushechkin Jun 11, 2026
87c618f
fixup! [implementation] typed throws + metadata autoclosure
kukushechkin Jun 11, 2026
87e88e0
Merge branch 'SLG-0006-task-local-logger-implementation' of https://g…
kukushechkin Jun 11, 2026
9c4e977
add missing benchmark thresholds
kukushechkin Jun 11, 2026
1cfb2f7
Merge branch 'main' into SLG-0006-task-local-logger-implementation
kukushechkin Jun 11, 2026
fe4d4c8
make withLogger @inlinable
kukushechkin Jun 11, 2026
af561ae
reword AcceptingLoggers best practice
kukushechkin Jun 11, 2026
b221b81
methods should’ve been inlinable, ABI is not important
kukushechkin Jun 11, 2026
ebbc525
explain when to pair bootstrap with task-local
kukushechkin Jun 11, 2026
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 658,
"instructions" : 734,
"objectAllocCount" : 0
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 658,
"instructions" : 734,
"objectAllocCount" : 0
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 658,
"instructions" : 734,
"objectAllocCount" : 0
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 658,
"instructions" : 759,
"objectAllocCount" : 0
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 662,
"instructions" : 734,
"objectAllocCount" : 0
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 662,
"instructions" : 734,
"objectAllocCount" : 0
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 658,
"instructions" : 734,
"objectAllocCount" : 0
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 1892,
"instructions" : 1993,
"objectAllocCount" : 0
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 1892,
"instructions" : 1968,
"objectAllocCount" : 0
}
}
26 changes: 26 additions & 0 deletions Benchmarks/NoTraits/Benchmarks/NoTraitsBenchmarks/NoTraits.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,38 @@ 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")
}

// MARK: - Task-local logger benchmarks

makeBenchmark(loggerLevel: .error, logLevel: .error, "_current_read_fallback") { _ in
blackHole(Logger.current)
}

makeBenchmark(loggerLevel: .error, logLevel: .error, setScopedLogger: true, "_current_read_inside_scope") {
logger in
blackHole(Logger.current)
}

makeBenchmark(loggerLevel: .error, logLevel: .error, setScopedLogger: true, "_withLogger_mergingMetadata") {
logger in
withLogger(mergingMetadata: ["key": "value"]) { inner in
blackHole(inner)
}
}

makeBenchmark(loggerLevel: .error, logLevel: .error, setScopedLogger: true, "_withLogger_handler") { logger in
withLogger(handler: logger.handler) { inner in
blackHole(inner)
}
}

makeBenchmark(loggerLevel: .error, logLevel: .error, "_1_attribute") { logger in
logger.log(
level: .error,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 985,
"instructions" : 1050,
"objectAllocCount" : 0
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 985,
"instructions" : 1050,
"objectAllocCount" : 0
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 970,
"instructions" : 1046,
"objectAllocCount" : 0
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 5855,
"instructions" : 5935,
"objectAllocCount" : 2
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 7075,
"instructions" : 7151,
"objectAllocCount" : 3
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 970,
"instructions" : 1005,
"objectAllocCount" : 0
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 970,
"instructions" : 1017,
"objectAllocCount" : 0
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"instructions" : 1890,
"instructions" : 1966,
"objectAllocCount" : 0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"instructions" : 4551,
"objectAllocCount" : 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"instructions" : 9623,
"objectAllocCount" : 4
}
15 changes: 13 additions & 2 deletions Benchmarks/Sources/BenchmarksFactory/MakeBenchmark.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Logging
public func makeBenchmark(
loggerLevel: Logger.Level,
logLevel: Logger.Level,
setScopedLogger: Bool = false,
_ suffix: String = "",
_ body: @escaping (Logger) -> Void
) {
Expand Down Expand Up @@ -49,7 +50,17 @@ public func makeBenchmark(
),
]
)
) { _ in
body(logger)
) { benchmark in
if setScopedLogger {
withLogger(logger) { logger in
benchmark.startMeasurement()
body(logger)
benchmark.stopMeasurement()
}
} else {
benchmark.startMeasurement()
body(logger)
benchmark.stopMeasurement()
}
}
}
Loading
Loading