Page MenuHomePhabricator

revlog: use struct.Struct instances for slight performance wins
ClosedPublic

Authored by alex_gaynor on Jul 10 2017, 4:59 PM.

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

alex_gaynor created this revision.Jul 10 2017, 4:59 PM
dsp added a subscriber: dsp.Jul 11 2017, 11:27 AM
dsp added inline comments.
mercurial/revlog.py
189

is there a reason to rename this to indexformatv0_unpack and not call it indexformatv0.unpack? If there is no particular reason, it feels to me that indexformatv0.unpack and indexformatv0.pack is more consistent with the use of indexformatv0.size.

alex_gaynor added inline comments.Jul 11 2017, 11:29 AM
mercurial/revlog.py
189

Preserve the micro-optimization that this line performs no attribute lookups, just a single global lookup. (It's probably measurable on CPython, though not on PyPy).

dsp added a comment.Jul 11 2017, 11:33 AM

LGTM

Thanks for the explanation. Can we add this reasoning to the commit message maybe and clearly describe what the microoptimization is?

quark retitled this revision from revlog: Use struct.Struct instances for slight performance wins to revlog: use struct.Struct instances for slight performance wins.Jul 11 2017, 12:12 PM
durin42 accepted this revision.Jul 14 2017, 11:55 AM

(This is already pushed)

This revision is now accepted and ready to land.Jul 14 2017, 11:55 AM
This revision was automatically updated to reflect the committed changes.