Skip to content

Conversation

@symwell
Copy link

@symwell symwell commented Aug 31, 2022

Closed. Superceded by #78

In extract_last_comment don't go over all lines of the file if the last comment is in the last 100 lines.

When used with a benchmark that called extract_last_comment 56411 times:

  • this improved performance by 3.42x (reduced execution time from 20.15s to 5.89s)
  • this improved performance by 65.4x (reduced execution time from 20.15s to 0.31s) when parsing comments backwards.
  • when the median number of lines in the opened files was 264 lines.

I tried to tune this with a different threshold, like 50-80 lines or 150-500 lines, and ~100 lines worked well for the benchmark used.

@symwell symwell changed the title Make extract_last_comment 3x faster Make extract_last_comment 65x faster Sep 1, 2022
@symwell symwell closed this Sep 1, 2022
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.

1 participant