Releases: coenttb/swift-testing-performance
Releases · coenttb/swift-testing-performance
0.1.2
Bug Fixes
- Fix error location reporting: Performance failures now report at the
@Testdeclaration site instead of inside the library code. UsesIssue.recordwithSourceLocationcaptured via#_sourceLocationat the.timed(),.detectLeaks(), and.trackPeakMemory()call sites.
This makes it much easier to identify which test failed when a performance threshold is exceeded.
0.1.0 - Initial Release
swift-testing-performance 0.1.0
Performance testing infrastructure for Swift Testing framework with statistical analysis, performance budgets, and comprehensive memory tracking.
Features
Core Performance Testing
- Declarative
.timed()trait for seamless Swift Testing integration - Statistical metrics: min, median, mean, p95, p99, max, standard deviation
- Performance budgets with automatic threshold enforcement
- Flexible measurement API for both trait-based and manual testing
- Cross-platform support: macOS, iOS, watchOS, tvOS, and Linux
Memory Observability
- Memory allocation tracking with platform-specific implementations
- Memory leak detection powered by swift-memory-allocation 0.1.0
- Peak memory tracking with budget enforcement
- Trait composition for comprehensive performance testing
Developer Experience
- Zero dependencies beyond Swift standard library and platform APIs
- Swift 6.2 with strict concurrency enabled
- Comprehensive documentation with DocC guides and examples
- 115 tests ensuring reliability across platforms
Installation
Swift Package Manager
dependencies: [
.package(url: "https://github.com/coenttb/swift-testing-performance", from: "0.1.0")
]Requirements
- Swift 6.1+
- macOS 15.0+, iOS 18.0+, watchOS 11.0+, tvOS 18.0+
- Swift Testing framework
Quick Start
import Testing
import TestingPerformance
@Test(.timed(threshold: .milliseconds(30)))
func `array reduce performance`() {
let numbers = Array(1...100_000)
_ = numbers.reduce(0, +)
}What's Included
Core APIs
@Test(.timed())- Declarative performance traitTestingPerformance.measure()- Manual measurement APIPerformanceSuite- Comparative benchmarkingTestingPerformance.expectPerformance()- Performance assertionsTestingPerformance.expectNoRegression()- Regression detection
Memory Traits
.detectLeaks()- Automatic memory leak detection.trackPeakMemory(limit:)- Peak memory profiling- Trait composition support
Documentation
- Comprehensive README with examples
- DocC documentation with guides
- Best practices for performance testing
- Platform-specific considerations
Testing
All 115 tests passing across:
- macOS (Swift 6.2, debug)
- Linux (Swift 6.2, release)
- Linux (Swift 6.1, compatibility)
CI/CD
Three GitHub Actions workflows:
- ✅ CI (macOS and Linux builds)
- ✅ SwiftLint (strict mode, zero warnings)
- ✅ Swift Format (automatic formatting)
Related Projects
Built on swift-memory-allocation for comprehensive memory observability.
Complements swift-benchmark - use swift-testing-performance for CI regression gates, Benchmark for detailed performance profiling.
License
Apache 2.0