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

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

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 :)

src/irmin/store.ml Outdated Show resolved Hide resolved
src/irmin/store_intf.ml Show resolved Hide resolved
src/irmin/store.ml Outdated Show resolved Hide resolved
@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