Skip to content
Merged
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
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main, next ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Swift
uses: swift-actions/setup-swift@v2
with:
swift-version: "6.1"

- name: Swift version
run: swift --version

- name: Build
run: swift build

- name: Run tests
run: |
if [ -d Tests ]; then
swift test --parallel
fi
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.DS_Store
/.build
/Packages
/Benchmarks/.build
/Benchmarks/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
Expand Down
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions Package.resolved → Benchmarks/Package.resolved

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

32 changes: 32 additions & 0 deletions Benchmarks/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// swift-tools-version: 6.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

// swift-tools-version: 6.1

import PackageDescription

let package = Package(
name: "benchmarks",
platforms: [
.macOS(.v13),
.iOS(.v16)
],
dependencies: [
.package(url: "https://github.com/ordo-one/package-benchmark.git", from: "1.29.3"),
.package(path: "../")
],
targets: [
.executableTarget(
name: "HyperLogLogBenchmarks",
dependencies: [
.product(name: "Benchmark", package: "package-benchmark"),
.product(name: "HyperLogLog", package: "swift-hyperloglog"),
],
path: "HyperLogLogBenchmarks/",
plugins: [
.plugin(name: "BenchmarkPlugin", package: "package-benchmark")
]
),
]
)

24 changes: 1 addition & 23 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,12 @@ import PackageDescription

let package = Package(
name: "swift-hyperloglog",
platforms: [
.macOS(.v13),
.iOS(.v16)
],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "HyperLogLog",
targets: ["HyperLogLog"]),
],
dependencies: [
.package(url: "https://github.com/ordo-one/package-benchmark.git", from: "1.29.3"),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
Expand All @@ -28,19 +21,4 @@ let package = Package(
dependencies: ["HyperLogLog"]
),
]
)

// Benchmark of HyperLogLogBenchmarks
package.targets += [
.executableTarget(
name: "HyperLogLogBenchmarks",
dependencies: [
.product(name: "Benchmark", package: "package-benchmark"),
"HyperLogLog",
],
path: "Benchmarks/HyperLogLogBenchmarks",
plugins: [
.plugin(name: "BenchmarkPlugin", package: "package-benchmark")
]
),
]
)
2 changes: 2 additions & 0 deletions Sources/HyperLogLog/HyperLogLog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import Glibc
#elseif canImport(Musl)
import Musl
#elseif canImport(WASILibc)
import WASILibc
#endif

/// A protocol for hashing values.
Expand Down
4 changes: 2 additions & 2 deletions Tests/HyperLogLogTests/HyperLogLogTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Testing
#endif

@Test func example() async throws {
var hll = HyperLogLog(precision: 10)
var hll = HyperLogLog(precision: .highest)
hll.insert("a")
hll.insert("b")
hll.insert("c")
Expand All @@ -21,7 +21,7 @@ import Testing
}

@Test func example2() async throws {
var hll = HyperLogLog(precision: 10)
var hll = HyperLogLog(precision: .highest)
hll.insert("a")
hll.insert("b")
hll.insert("b")
Expand Down