Skip to content

Commit

Permalink
Avoid adding the jemalloc dependency to the main package
Browse files Browse the repository at this point in the history
  • Loading branch information
kkebo committed Jul 17, 2023
1 parent 884d32a commit 916f653
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 117 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ jobs:
- uses: actions/checkout@v3
- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_15.0.app
- name: Install dependencies
run: brew install jemalloc
- name: Build
run: swift build -v
- name: Run tests
Expand Down
File renamed without changes.
113 changes: 113 additions & 0 deletions Benchmarks/Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"pins" : [
{
"identity" : "package-benchmark",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ordo-one/package-benchmark",
"state" : {
"revision" : "9e010e286ac7f0f268d8c89a338ba6b0ecab0244",
"version" : "1.7.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" : "fee6933f37fde9a5e12a1e4aeaa93fe60116ff2a",
"version" : "1.2.2"
}
},
{
"identity" : "swift-atomics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-atomics",
"state" : {
"revision" : "6c89474e62719ddcc1e9614989fff2f68208fe10",
"version" : "1.1.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-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax",
"state" : {
"revision" : "67c5007099d9ffdd292f421f81f4efe5ee42963e",
"version" : "509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-07-09-a"
}
},
{
"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
}
25 changes: 25 additions & 0 deletions Benchmarks/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// swift-tools-version: 5.9

import PackageDescription

let package = Package(
name: "Benchmarks",
platforms: [.macOS(.v13), .iOS(.v16)],
dependencies: [
.package(name: "Browser", path: ".."),
.package(url: "https://github.com/ordo-one/package-benchmark", "1.7.0"..<"1.8.0"),
],
targets: [
.executableTarget(
name: "MyBenchmark",
dependencies: [
.product(name: "Benchmark", package: "package-benchmark"),
.product(name: "Tokenizer", package: "Browser"),
],
path: "Benchmarks/MyBenchmark",
plugins: [
.plugin(name: "BenchmarkPlugin", package: "package-benchmark")
]
)
]
)
99 changes: 0 additions & 99 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,86 +1,5 @@
{
"pins" : [
{
"identity" : "package-benchmark",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ordo-one/package-benchmark",
"state" : {
"revision" : "9e010e286ac7f0f268d8c89a338ba6b0ecab0244",
"version" : "1.7.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" : "fee6933f37fde9a5e12a1e4aeaa93fe60116ff2a",
"version" : "1.2.2"
}
},
{
"identity" : "swift-atomics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-atomics",
"state" : {
"revision" : "6c89474e62719ddcc1e9614989fff2f68208fe10",
"version" : "1.1.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-syntax",
"kind" : "remoteSourceControl",
Expand All @@ -89,24 +8,6 @@
"revision" : "67c5007099d9ffdd292f421f81f4efe5ee42963e",
"version" : "509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-07-09-a"
}
},
{
"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
Expand Down
17 changes: 4 additions & 13 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import PackageDescription

let package = Package(
name: "Browser",
platforms: [.macOS(.v13), .iOS(.v16)],
platforms: [.macOS(.v10_15), .iOS(.v13)],
products: [
.library(name: "Tokenizer", targets: ["Tokenizer"])
],
dependencies: [
.package(url: "https://github.com/ordo-one/package-benchmark", "1.7.0"..<"1.8.0"),
.package(url: "https://github.com/apple/swift-syntax", from: "509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-06-17-a"),
],
targets: [
Expand All @@ -33,17 +35,6 @@ let package = Package(
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
]
),
.executableTarget(
name: "MyBenchmark",
dependencies: [
.product(name: "Benchmark", package: "package-benchmark"),
"Tokenizer",
],
path: "Benchmarks/MyBenchmark",
plugins: [
.plugin(name: "BenchmarkPlugin", package: "package-benchmark")
]
),
.testTarget(
name: "TokenizerTests",
dependencies: [
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ TODO ([The main blocker is the lack of macros support in Linux.](https://forums.
You need:

- Xcode 15 or later
- jemalloc (for benchmarking)
- `brew install jemalloc`

And then, run the following command to build the source code.

Expand All @@ -30,8 +28,12 @@ swift test

## Benchmarking

You need:

- jemalloc

```shell
swift package benchmark
swift package --package-path Benchmarks benchmark
```

For more details, please see https://github.com/ordo-one/package-benchmark.

0 comments on commit 916f653

Please sign in to comment.