Skip to content
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

Cache #124

Merged
merged 5 commits into from Sep 23, 2019
Merged

Cache #124

merged 5 commits into from Sep 23, 2019

Conversation

kateinoigakukun
Copy link
Collaborator

@kateinoigakukun kateinoigakukun commented Sep 21, 2019

IBLinter checks whole files every time but there are many unnecessary processes when most of them are not changed.

This PR adds lint cache for each IB file.
In my project, IBLinter took 7 sec every time but this change reduced it to 2 sec when there is cache.

@@ -74,6 +79,7 @@ public struct Config: Codable {
viewAsDeviceRule = try container.decodeIfPresent(Optional<ViewAsDeviceConfig>.self, forKey: .viewAsDeviceRule) ?? nil
reporter = try container.decodeIfPresent(String.self, forKey: .reporter) ?? "xcode"
disableWhileBuildingForIB = try container.decodeIfPresent(Bool.self, forKey: .disableWhileBuildingForIB) ?? true
ignoreCache = try container.decodeIfPresent(Bool.self, forKey: .ignoreCache) ?? false
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about default value? Should we enable cache by default?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes enabled by default is the good choice if there is no way to forgot some issues

Copy link
Member

@phimage phimage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand you use the modification date to re-check files
Is there is also a total re-check if iblinter version change? because of new rules added by iblinter

@kateinoigakukun
Copy link
Collaborator Author

@phimage Your understanding is almost correct. As you said, we should re-check if IBLinter version changed.
So I use the following values to re-check files.

If the top two are changed, IBLinter ignore existing cache files and re-check all files again.

@kateinoigakukun
Copy link
Collaborator Author

@phimage Thank you for reviewing 🦄

@kateinoigakukun kateinoigakukun merged commit 20a95e1 into master Sep 23, 2019
@kateinoigakukun kateinoigakukun deleted the performance-cache branch November 21, 2019 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants