forked from realm/SwiftLint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve performance of collecting files to lint and lint cache lookups (
realm#2465) Performance has gotten pretty bad for complex SwiftLint configurations like the one used for Lyft's iOS code base involving lots of files in the directories being linted, large configuration files and many nested configuration files. Two main areas were particularly ripe for improvement were: 1. Collecting which files to lint 2. Lint cache lookups ### Collecting which files to lint Improve this by: * using an NSOrderedSet to remove excluded paths instead of `Array.filter` * parallelizing calls to `filesToLint` for all paths to lint and exclude * using `FileManager.subpaths(atPath:)` instead of `enumerator(atPath:)` |Change|Before|After|Speed up| |-|-|-|-| |NSOrderedSet|2.438s|0.917s|2.659x| |Parallel Flat Map|2.438s|2.248s|1.085x| |Subpaths|0.939s|0.867s|1.083x| |**Total**|**2.438s**|**0.720s**|**3.386x**| ### Lint cache lookups By using an MD5 hash of the Configuration description from CryptoSwift as the cache key instead of instead the full description, we can drastically speed up cache lookups for projects with complex SwiftLint configurations. I think the dictionary lookup for very large string keys doesn't perform very well. --- * Speed up Configuration.lintablePaths * Improve cache lookup performance by up to 10x By using an MD5 hash of the Configuration description from CryptoSwift as the cache key instead of instead the full description. * Add changelog entries * Swift 4.0 & Linux compatibility * os(Darwin) isn't a thing * Allow warnings in pod lib lint SwiftLint supports building with Swift 4.0 to 4.2. There is no version of CryptoSwift to support both Swift 4.0 and Swift 4.2. So allow warnings for now. We'll make one more Swift 4.0 compatible release, then we'll bump the build requirements to Swift 4.2 and remove the `--allow-warnings` flag.
- Loading branch information
Showing
16 changed files
with
75 additions
and
19 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
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,3 +1,4 @@ | ||
github "Carthage/Commandant" ~> 0.15.0 | ||
github "jspahrsummers/xcconfigs" ~> 0.12.0 | ||
github "jpsim/Yams" ~> 1.0.1 | ||
github "jspahrsummers/xcconfigs" ~> 0.12.0 | ||
github "krzyzanowskim/CryptoSwift" == 0.8.3 |
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,7 +1,8 @@ | ||
github "Carthage/Commandant" "0.15.0" | ||
github "antitypical/Result" "4.0.0" | ||
github "drmohundro/SWXMLHash" "4.7.1" | ||
github "drmohundro/SWXMLHash" "4.7.4" | ||
github "jpsim/SourceKitten" "0.21.2" | ||
github "jpsim/Yams" "1.0.1" | ||
github "jspahrsummers/xcconfigs" "0.12" | ||
github "krzyzanowskim/CryptoSwift" "0.8.3" | ||
github "scottrhoyt/SwiftyTextTable" "0.8.2" |
Submodule CryptoSwift
added at
f2ca9c
Submodule SWXMLHash
updated
5 files
+1 −1 | .swift-version | |
+115 −103 | CHANGELOG.md | |
+1 −1 | README.md | |
+2 −1 | SWXMLHash.podspec | |
+2 −2 | SWXMLHash.xcodeproj/project.pbxproj |
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
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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