Skip to content

Speed up Store.last-modified by comparing hashes instead of file contents#2335

Open
zazedd wants to merge 3 commits intomirage:mainfrom
zazedd:last-modified-perf
Open

Speed up Store.last-modified by comparing hashes instead of file contents#2335
zazedd wants to merge 3 commits intomirage:mainfrom
zazedd:last-modified-perf

Conversation

@zazedd
Copy link
Contributor

@zazedd zazedd commented Sep 13, 2024

This commit changes the Store.last_modified function to compare the precomputed file hashes instead of their contents, as the latter is significantly (~10 to 20x) slower. :)
(More specifically, Tree.find is way slower than Tree.find_tree)


It also changes the documentation of the function where variable n is wrongly referred to as number.

@art-w art-w force-pushed the last-modified-perf branch from 3239903 to b908da8 Compare September 19, 2024 07:20
Copy link
Contributor

@art-w art-w left a comment

Choose a reason for hiding this comment

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

Thanks, this provides a huge speedup for large values!

Looking at the overall algorithm used by last_modified, I believe there could be complexity explosion with fork/merge: it doesn't detect that a commit was already checked when reached from another path? I wonder if you have some ideas on how to fix this also :)

@art-w art-w force-pushed the last-modified-perf branch from b908da8 to e61a347 Compare September 30, 2024 12:52
Copy link
Contributor

@clecat clecat left a comment

Choose a reason for hiding this comment

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

LGTM, thx a lot for the work
There might be a small issue however, when a commit is older than it's parent, the function might missbehave.

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.

3 participants