This is an archive of the discontinued Mercurial Phabricator instance.

match: skip walking up the directory hierarchy if the number of pats are small
ClosedPublic

Authored by spectral on Dec 1 2020, 6:06 PM.

Details

Summary

Previously, we would receive a path like abc/def/ghi and "walk up" the directory
hierarchy, checking abc/def, abc, and b'' to see if they were in the set of
prefixes that this matcher covered. We did this indiscriminately - we generated
all of these paths even if the set of prefixes the matcher covered was
completely empty, which is the case for a lot of repos at my company (the narrow
matcher we use is usually non-recursive).

This brings the time for a rebase in one of my repos from 12.20s to 10.87s. In
this particular repo, this is entirely due to the len(prefix_set) == 0 check,
as I do not have any recursive patterns in the narrowspec.

Diff Detail

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

Event Timeline

spectral created this revision.Dec 1 2020, 6:06 PM
pulkit accepted this revision.Dec 2 2020, 2:09 AM
This revision is now accepted and ready to land.Dec 2 2020, 2:09 AM