This is an archive of the discontinued Mercurial Phabricator instance.

clindex: wrapper for future changelog index overrides
ClosedPublic

Authored by quark on Nov 9 2017, 2:28 PM.
Tags
None
Subscribers

Details

Reviewers
durham
Group Reviewers
Restricted Project
Commits
rFBHGX7c74370081c0: clindex: wrapper for future changelog index overrides
Summary

This extension is a thin wrapper around the native changelog.index object
that allows us to incrementally replace its methods. Since some index
methods (ex. nodemap.__getitem__) are called very frequently, Cython
features are used intentionally to avoid overhead. This also makes it easier
to integrate logic with C interface in the future.

As a side effect, this patch enforce index to be conceptually separate
from nodemap. So changelog.index[node] could be made illegal in the
future, which seems to be a good thing.

Test Plan

Run hg sl with and without the extension in a large repo. Check traceprof
outputs. Notice the performance difference around index methods are roughly
10%, which seems acceptable:

Without the extension:

25      \ node (4823 times)                  changelog.py:361
18       | node (4931 times)                 revlog.py:631

With the extension:

27      \ node (4823 times)                  changelog.py:361
19       | node (4931 times)                 revlog.py:631

Also run rt --extra-config-opt=extensions.clindex= from core hg and make
sure changes are all caused by having an extra extension enabled.

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

quark created this revision.Nov 9 2017, 2:28 PM
Herald added a reviewer: Restricted Project. · View Herald TranscriptNov 9 2017, 2:28 PM
quark updated this revision to Diff 3382.Nov 9 2017, 2:37 PM
durham accepted this revision.Nov 14 2017, 7:04 PM
durham added a subscriber: durham.
durham added inline comments.
hgext3rd/clindex.pyx
7

I'd also mention why this is useful.

setup.py
334

I'd probably put this first. The list isn't quite alphabetical, but it's pretty close.

This revision is now accepted and ready to land.Nov 14 2017, 7:04 PM
This revision was automatically updated to reflect the committed changes.