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

Performance issue with file.lastModified() #6096

Closed
Bananeweizen opened this issue Aug 30, 2018 · 3 comments
Closed

Performance issue with file.lastModified() #6096

Bananeweizen opened this issue Aug 30, 2018 · 3 comments

Comments

@Bananeweizen
Copy link
Contributor

Checkstyle checks the file time stamp to avoid checking an unmodified file again. At least on Windows, this can be quite costly. On a project with about 300.000 LOC Yourkit tells me that I spend almost a minute in File.lastModified().

This can be improved by not querying the timestamp as the first cancellation condition in the Checker at https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java#L277, but only as late as possible. First we should check cancellation by name.

Bananeweizen added a commit to Bananeweizen/checkstyle that referenced this issue Aug 30, 2018
First check whether this file shall be checked by file name extension,
only afterwards check the file timestamp. This can avoid the timestamp
access in some cases.
Bananeweizen added a commit to Bananeweizen/checkstyle that referenced this issue Aug 30, 2018
@rnveach
Copy link
Member

rnveach commented Aug 30, 2018

@romani I am fine with this. Please review.

@romani romani added the approved label Sep 9, 2018
@romani
Copy link
Member

romani commented Sep 9, 2018

issue is approved, it is reasonable to be lazy in calculations.

@romani
Copy link
Member

romani commented Nov 27, 2018

fix is merged.

@romani romani closed this as completed Nov 27, 2018
tsunghanjacktsai pushed a commit to tsunghanjacktsai/checkstyle that referenced this issue Dec 3, 2018
tsunghanjacktsai pushed a commit to tsunghanjacktsai/checkstyle that referenced this issue Dec 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants