-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Speedup] [Proof Of Concept] Use unique file Id for each SiwftLintFile for caching #2929
Conversation
@@ -0,0 +1,56 @@ | |||
import Foundation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is mostly what this suggestion about
@@ -1,9 +1,10 @@ | |||
import Foundation | |||
import SourceKittenFramework | |||
|
|||
private typealias FileCacheKey = Int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this one
The main question here whether it is appropriate or allowable to make changes like this one :) |
Generated by 🚫 Danger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we introduce a new type called SwiftLintFile
, SwiftLintFile
should have them as lazy properties rather than using File.cacheKey
to retrieve data from the caches. 🤔
49f2a39
to
f4f6945
Compare
While this is true, it's really hard to clear all caches if we go that direction. |
8087127
to
4e8fa64
Compare
This one is probably, the most we can take out in terms of speed from SwiftLint not touching regular expressions. @jpsim @marcelofabri Please, review |
f46a6fd
to
0955124
Compare
4daac6e
to
b16f8a8
Compare
@jpsim ping? |
6497350
to
b1cdc11
Compare
b16f8a8
to
2e8e80f
Compare
2e8e80f
to
d771d22
Compare
d5a16c3
to
a8d90eb
Compare
In short
How about having unique key per file?
This can be done in a lot of ways, one of these. is below.
A suggested solution is to have own wrapper over
File
which will allow storing additional data per file.What
Change the way how files information is cached in Swiftlint
Why
Speedup mostly
Note
In general, swiftlint is using
contents
orpath
as cacheKey. Unfortunately using keys so big is slow.Using simple, fast, unique cacheKey, allows speed up running time.
On the Image. Most of the time spent in
Dictionary.getter
is actually callingCache.get(file.cacheKey)
The worst-case scenario for this one is to have multiple files with identical contents. which is not-really li
Alternatives