-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Swift 4 + performance improvements (#8)
We ran into some serious performance improvements while using DoctorPretty for snapshot testing, so I wanted to see if there was anything I could do to fix it. I optimized a few small things (like using reduce(into:) with mutation instead of the pure version), but the real bottleneck is with the best and fits functions, which are recursive. I was able to rewrite fits as a plain loop, and that improved performance quite a bit, and we'd probably get huge improvements if we could rewrite best.
- Loading branch information
Showing
18 changed files
with
98 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.1 | ||
4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
os: | ||
- linux | ||
- osx | ||
env: | ||
env: | ||
language: generic | ||
sudo: required | ||
dist: trusty | ||
osx_image: xcode8.3 | ||
osx_image: xcode9.2 | ||
install: | ||
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" | ||
script: | ||
- swift build | ||
- SWIFTPM_TEST_DoctorPretty=YES swift test | ||
|
||
- swift test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
// swift-tools-version:3.1 | ||
// swift-tools-version:4.0 | ||
|
||
import PackageDescription | ||
import Foundation | ||
|
||
// HACK from https://github.com/ReactiveCocoa/ReactiveSwift/blob/master/Package.swift | ||
var isSwiftPMTest: Bool { | ||
return ProcessInfo.processInfo.environment["SWIFTPM_TEST_DoctorPretty"] == "YES" | ||
} | ||
|
||
let package = Package( | ||
name: "DoctorPretty", | ||
targets: [], | ||
dependencies: [ | ||
.Package(url: "https://github.com/typelift/Algebra.git", majorVersion: 0, minor: 2), | ||
.Package(url: "https://github.com/typelift/Swiftx.git", majorVersion: 0, minor: 5) | ||
] + (isSwiftPMTest ? | ||
[.Package(url: "https://github.com/typelift/SwiftCheck.git", versions: Version(0,6,0)..<Version(1,0,0))] : | ||
[]) | ||
|
||
.package(url: "https://github.com/typelift/Algebra.git", .exact("0.2.0")), | ||
.package(url: "https://github.com/typelift/Swiftx.git", .exact("0.6.0")), | ||
.package(url: "https://github.com/typelift/SwiftCheck.git", .exact("0.9.1")) | ||
], | ||
targets: [ | ||
.target(name: "DoctorPretty", dependencies: ["Algebra", "Swiftx"]), | ||
.testTarget(name: "DoctorPrettyTests", dependencies: ["DoctorPretty", "SwiftCheck"]), | ||
] | ||
) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters