comparison mercurial/copies.py @ 43254:181d28ba05da

copies: avoid instancing more changectx to access parent revisions We just need to know the revision numbers of the parents, creating full context is needlessly expensive. This provide a small, but noticeable performance boost. revision: large amount; added files: large amount; rename small amount; c3b14617fbd7 9ba6ab77fd29 before: ! wall 2.885636 comb 2.900000 user 2.870000 sys 0.030000 (median of 10) after: ! wall 2.702270 comb 2.710000 user 2.690000 sys 0.020000 (median of 10) revision: large amount; added files: small amount; rename small amount; c3b14617fbd7 f650a9b140d2 before: ! wall 4.298271 comb 4.290000 user 4.240000 sys 0.050000 (median of 10) after: ! wall 3.976610 comb 3.970000 user 3.920000 sys 0.050000 (median of 10) revision: large amount; added files: large amount; rename large amount; 08ea3258278e d9fa043f30c0 before: ! wall 0.773397 comb 0.770000 user 0.770000 sys 0.000000 (median of 11) after: ! wall 0.701634 comb 0.700000 user 0.700000 sys 0.000000 (median of 13) revision: small amount; added files: large amount; rename large amount; df6f7a526b60 a83dc6a2d56f before: ! wall 0.013585 comb 0.010000 user 0.010000 sys 0.000000 (median of 217) after: ! wall 0.013550 comb 0.010000 user 0.010000 sys 0.000000 (median of 218) revision: small amount; added files: large amount; rename small amount; 4aa4e1f8e19a 169138063d63 before: ! wall 0.003202 comb 0.000000 user 0.000000 sys 0.000000 (median of 929) after: ! wall 0.002993 comb 0.010000 user 0.010000 sys 0.000000 (median of 992) revision: small amount; added files: small amount; rename small amount; 4bc173b045a6 964879152e2e before: ! wall 0.000077 comb 0.000000 user 0.000000 sys 0.000000 (median of 12060) after: ! wall 0.000072 comb 0.000000 user 0.000000 sys 0.000000 (median of 12804) revision: medium amount; added files: large amount; rename medium amount; c95f1ced15f2 2c68e87c3efe before: ! wall 0.510614 comb 0.500000 user 0.500000 sys 0.000000 (median of 18) after: ! wall 0.473681 comb 0.470000 user 0.470000 sys 0.000000 (median of 20) revision: medium amount; added files: medium amount; rename small amount; d343da0c55a8 d7746d32bf9d before: ! wall 0.126552 comb 0.130000 user 0.130000 sys 0.000000 (median of 77) after: ! wall 0.115240 comb 0.110000 user 0.110000 sys 0.000000 (median of 85) Differential Revision: https://phab.mercurial-scm.org/D7122
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 16 Oct 2019 17:49:30 +0200
parents 82dabad535d2
children b8d60845fa5d
comparison
equal deleted inserted replaced
43253:82dabad535d2 43254:181d28ba05da
205 copies = all_copies.pop(r) 205 copies = all_copies.pop(r)
206 if r == b.rev(): 206 if r == b.rev():
207 return copies 207 return copies
208 for i, c in enumerate(children[r]): 208 for i, c in enumerate(children[r]):
209 childctx = repo[c] 209 childctx = repo[c]
210 p1, p2 = cl.parentrevs(c)
210 p1copies, p2copies = childctx._copies 211 p1copies, p2copies = childctx._copies
211 if r == childctx.p1().rev(): 212 if r == p1:
212 parent = 1 213 parent = 1
213 childcopies = p1copies 214 childcopies = p1copies
214 else: 215 else:
215 assert r == childctx.p2().rev() 216 assert r == p2
216 parent = 2 217 parent = 2
217 childcopies = p2copies 218 childcopies = p2copies
218 if not alwaysmatch: 219 if not alwaysmatch:
219 childcopies = { 220 childcopies = {
220 dst: src for dst, src in childcopies.items() if match(dst) 221 dst: src for dst, src in childcopies.items() if match(dst)