Page MenuHomePhabricator

perftweaks: disable accessing served repoview at repo.updatecaches
ClosedPublic

Authored by quark on Nov 27 2017, 12:29 PM.

Details

Summary

It saves 0.15s per transaction in fbsource. With other implemented
optimization (treemanifest, treedirstate, and clindex and perftweaks).

Before:

(hg-dev) $ echo 1 >> README ; time hg commit -m bar
postclose warms-cache: User 0.140  Sys 0.020  Real 0.160

real    0m0.613s
user    0m0.419s
sys     0m0.186s

After:

(hg-dev) $ echo 1 >> README ; time hg commit -m bar
postclose warms-cache: User 0.000  Sys 0.000  Real 0.000

real    0m0.461s
user    0m0.303s
sys     0m0.149s

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 27 2017, 12:29 PM
Herald added a reviewer: Restricted Project. · View Herald TranscriptNov 27 2017, 12:29 PM
quark updated this revision to Diff 3898.Nov 27 2017, 4:56 PM
quark updated this revision to Diff 3902.Nov 27 2017, 9:06 PM
durham requested changes to this revision.Nov 27 2017, 10:31 PM
durham added a subscriber: durham.
durham added inline comments.
hgext3rd/perftweaks.py
82

Do we need to do this only if disablebranchcache is set?

88

The comment in localrepo.updatecaches says the updatecache call here should update all the caches. Since we do store a branchcache in self['default'], do we need to manually invalidate that at least? For every filter level?

90

Can we undo this change after updatecaches is called? Maybe in a try/finally? Seems risky to just edit the transaction and leave it edited.

93

Why do it this way instead of using wrapfunction?

This revision now requires changes to proceed.Nov 27 2017, 10:31 PM
quark added inline comments.Nov 28 2017, 7:50 PM
hgext3rd/perftweaks.py
82

Yes. I'll add a new config option and use it here.

88

No. The cache invalidation (comparing tip, tipnode, filteredhash) will work.

We should avoid calculating other filter levels since loading their repoviews are expensive.

90

Good point. Will make the change. I don't think there are important users of tr.changes though.

93

This is the preferred way documented in the docstring of extensions.wrapfunction.

quark updated this revision to Diff 3993.Nov 29 2017, 8:40 PM
durham accepted this revision.Dec 4 2017, 11:36 PM
This revision is now accepted and ready to land.Dec 4 2017, 11:36 PM
This revision was automatically updated to reflect the committed changes.