This is an archive of the discontinued Mercurial Phabricator instance.

repack: reuse deltas when possible
ClosedPublic

Authored by durham on Dec 14 2017, 5:39 PM.
Tags
None
Subscribers

Details

Reviewers
quark
Group Reviewers
Restricted Project
Commits
rFBHGX8cb19938d4a7: repack: reuse deltas when possible
Summary

Previously, hg repack would undelta every entry, then redelta it. If the delta
base node was the same before and after (which should be common), this resulted
in a lot of work and made repacking every entry in a chain an n^2 operation.
Let's use the new getdelta API to reuse the delta when possible.

Diff Detail

Repository
rFBHGX Facebook Mercurial Extensions
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

durham created this revision.Dec 14 2017, 5:39 PM
Herald added a reviewer: Restricted Project. · View Herald TranscriptDec 14 2017, 5:39 PM
quark accepted this revision.Dec 14 2017, 10:23 PM
quark added a subscriber: quark.
quark added inline comments.
remotefilelog/repack.py
625

Is the "deltabasename != filename" and "size is None" test necessary?

This revision is now accepted and ready to land.Dec 14 2017, 10:23 PM
durham added inline comments.Dec 15 2017, 2:09 PM
remotefilelog/repack.py
625

The pack format supports delta's against revision with a different name, but repack currently does not. So if the pack has a delta from a different name, we should not try to reuse it.

The size is None test is just because Phil made a change to use size to improve delta choice during repack, and it relies on the size metadata being filled in during a repack. So I'm assuming it is advantageous to do the onetime work here to get the size, so all future packs will be more compact.

This revision was automatically updated to reflect the committed changes.