Skip to content

Commit

Permalink
Add initial benchmark support
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye committed Jan 4, 2024
1 parent aefaa95 commit f559d02
Show file tree
Hide file tree
Showing 8 changed files with 206 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
/.build-*
/.build-*
/Benchmarks/.build

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions Benchmarks/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"configurations": [
{
"type": "lldb",
"request": "launch",
"sourceLanguages": [
"swift"
],
"args": [],
"cwd": "${workspaceFolder:Benchmarks}",
"name": "Debug OpenSwiftUIBenchmark",
"program": "${workspaceFolder:Benchmarks}/.build/debug/OpenSwiftUIBenchmark",
"preLaunchTask": "swift: Build Debug OpenSwiftUIBenchmark"
},
{
"type": "lldb",
"request": "launch",
"sourceLanguages": [
"swift"
],
"args": [],
"cwd": "${workspaceFolder:Benchmarks}",
"name": "Release OpenSwiftUIBenchmark",
"program": "${workspaceFolder:Benchmarks}/.build/release/OpenSwiftUIBenchmark",
"preLaunchTask": "swift: Build Release OpenSwiftUIBenchmark"
}
]
}
1 change: 1 addition & 0 deletions Benchmarks/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
14 changes: 14 additions & 0 deletions Benchmarks/OpenSwiftUIBenchmark/Sample.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// Sample.swift
//
//
// Created by Kyle on 2024/1/4.
//

import Benchmark

let benchmarks = {
Benchmark("Minimal benchmark") { _ in
// measure something here
}
}
122 changes: 122 additions & 0 deletions Benchmarks/Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"pins" : [
{
"identity" : "openfoundation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/OpenSwiftUIProject/OpenFoundation",
"state" : {
"revision" : "cd2cdb300d53e3e68fda8b690a703a7c5096d9d0",
"version" : "0.0.2"
}
},
{
"identity" : "opengraph",
"kind" : "remoteSourceControl",
"location" : "https://github.com/OpenSwiftUIProject/OpenGraph",
"state" : {
"branch" : "main",
"revision" : "6835ce0972f40ef76f1214dc0efc75ec19082631"
}
},
{
"identity" : "package-benchmark",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ordo-one/package-benchmark",
"state" : {
"revision" : "2e724bf526c980699ae0c4b7a470b51816a89e72",
"version" : "1.20.0"
}
},
{
"identity" : "package-datetime",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ordo-one/package-datetime",
"state" : {
"revision" : "d1242188c9f48aad297e6ca9b717776f8660bc31",
"version" : "1.0.2"
}
},
{
"identity" : "package-histogram",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ordo-one/package-histogram",
"state" : {
"revision" : "a69fa24d7b70421870cafa86340ece900489e17e",
"version" : "0.1.2"
}
},
{
"identity" : "package-jemalloc",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ordo-one/package-jemalloc",
"state" : {
"revision" : "e8a5db026963f5bfeac842d9d3f2cc8cde323b49",
"version" : "1.0.0"
}
},
{
"identity" : "progress.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ordo-one/Progress.swift",
"state" : {
"revision" : "29dc5dc29d8408f42878b832c7aae38a35ff26ee",
"version" : "1.0.3"
}
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser",
"state" : {
"revision" : "c8ed701b513cf5177118a175d85fbbbcd707ab41",
"version" : "1.3.0"
}
},
{
"identity" : "swift-atomics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-atomics",
"state" : {
"revision" : "cd142fd2f64be2100422d658e7411e39489da985",
"version" : "1.2.0"
}
},
{
"identity" : "swift-extras-json",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swift-extras/swift-extras-json",
"state" : {
"revision" : "122b9454ef01bf89a4c190b8fd3717ddd0a2fbd0",
"version" : "0.6.0"
}
},
{
"identity" : "swift-numerics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-numerics",
"state" : {
"revision" : "0a5bc04095a675662cf24757cc0640aa2204253b",
"version" : "1.0.2"
}
},
{
"identity" : "swift-system",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system",
"state" : {
"revision" : "025bcb1165deab2e20d4eaba79967ce73013f496",
"version" : "1.2.1"
}
},
{
"identity" : "texttable",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ordo-one/TextTable",
"state" : {
"revision" : "a27a07300cf4ae322e0079ca0a475c5583dd575f",
"version" : "0.0.2"
}
}
],
"version" : 2
}
31 changes: 31 additions & 0 deletions Benchmarks/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import Foundation
import PackageDescription

let package = Package(
name: "OpenSwiftUIBenchmark",
platforms: [
.macOS(.v13),
],
products: [
.executable(name: "OpenSwiftUIBenchmark", targets: ["OpenSwiftUIBenchmark"]),
],
dependencies: [
.package(url: "https://github.com/ordo-one/package-benchmark", from: "1.20.0"),
.package(path: "../"),
],
targets: [
.executableTarget(
name: "OpenSwiftUIBenchmark",
dependencies: [
.product(name: "Benchmark", package: "package-benchmark"),
],
path: "OpenSwiftUIBenchmark",
plugins: [
.plugin(name: "BenchmarkPlugin", package: "package-benchmark"),
]
)
]
)
1 change: 1 addition & 0 deletions Benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BENCHMARK_DISABLE_JEMALLOC=1 swift run

0 comments on commit f559d02

Please sign in to comment.