( )⚙ D1257 dirstate: remove excess attribute lookups for dirstate.status (issue5714)

This is an archive of the discontinued Mercurial Phabricator instance.

dirstate: remove excess attribute lookups for dirstate.status (issue5714)
ClosedPublic

Authored by durham on Oct 27 2017, 4:14 PM.

Details

Summary

A recent refactor added a layer of abstraction to the dirstate which makes doing
things like 'foo in dirstate' now require some extra Python attribute lookups.
This is causing a 100ms slow down in hg status for mozilla-central.

The fix is to hoist the inner dict's functions onto the main class once the lazy
loading it complete, as well as store the actual functions before doing the
status loop (as is done for other such functions).

In my testing, it seems to address the performance regression, but we'll
need to see the perf run results to know for sure.

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

durham created this revision.Oct 27 2017, 4:14 PM
yuja accepted this revision.Oct 28 2017, 3:46 AM
This revision is now accepted and ready to land.Oct 28 2017, 3:46 AM
yuja requested changes to this revision.Oct 28 2017, 3:57 AM

Probably the cached attributes need to be deleted at clear(), where new
dict is assigned to self._map.

This revision now requires changes to proceed.Oct 28 2017, 3:57 AM
durham updated this revision to Diff 3147.Oct 28 2017, 3:36 PM

Fixed by using _map.clear() instead of replacing the _map.

yuja accepted this revision.Oct 28 2017, 11:30 PM

Queued, thanks.

This revision is now accepted and ready to land.Oct 28 2017, 11:30 PM
This revision was automatically updated to reflect the committed changes.