Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 27 additions & 1 deletion Benchmarks/Benchmarks/Essentials/BenchmarkEssentials.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,38 @@ let benchmarks = {
Benchmark.defaultConfiguration.metrics = [.cpuTotal, .wallClock, .throughput]

// MARK: UUID

Benchmark("UUIDEqual", configuration: .init(scalingFactor: .mega)) { benchmark in
let u1 = UUID()
let u2 = UUID()
for _ in benchmark.scaledIterations {
assert(u1 != u2)
}
}

Benchmark("UUIDCreate") { benchmark in
for _ in benchmark.scaledIterations {
blackHole(UUID())
}
}

Benchmark("UUIDCreateTimeOrdered") { benchmark in
for _ in benchmark.scaledIterations {
blackHole(UUID.version7())
}
}

Benchmark("UUIDString") { benchmark in
let uuid = UUID()
for _ in benchmark.scaledIterations {
blackHole(uuid.uuidString)
}
}

Benchmark("UUIDStringLower") { benchmark in
let uuid = UUID()
for _ in benchmark.scaledIterations {
blackHole(uuid.lowercasedUUIDString)
}
}
}
270 changes: 270 additions & 0 deletions Proposals/NNNN-uuid-versions.md

Large diffs are not rendered by default.

Loading
Loading