This is an archive of the discontinued Mercurial Phabricator instance.

dirstate: perform transactions with _copymap using single call, where possible
ClosedPublic

Authored by mbolin on Aug 23 2017, 2:23 PM.

Details

Summary

This replaces patterns such as this:

if f in self._copymap:
    del self._copymap[f]

with this:

self._copymap.pop(f, None)

Although eliminating the extra lookup/call may be a negligible performance win
in the standard dirstate, alternative implementations, such as
sqldirstate
may see a bigger win where each of these calls results in an RPC,
so the savings is greater.

Test Plan

make tests

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

mbolin created this revision.Aug 23 2017, 2:23 PM
mbolin updated this revision to Diff 1209.Aug 23 2017, 2:25 PM

Minor fix.

dsp accepted this revision.Aug 24 2017, 1:07 AM
dsp added a subscriber: dsp.

I wonder if that is something that we can find with check-code to reduce the overall usage of these kind of patterns.

durin42 accepted this revision.Aug 28 2017, 2:46 PM
This revision is now accepted and ready to land.Aug 28 2017, 2:46 PM
This revision was automatically updated to reflect the committed changes.