comparison mercurial/dirstate.py @ 18032:a9e623bb440e

dirstate: test normalize is truthy instead of using a no-op lambda hg perfstatus -u on a working directory with 170,000 files, without this change: ! wall 1.869404 comb 1.850000 user 1.170000 sys 0.680000 (best of 6) With this change: ! wall 1.839561 comb 1.830000 user 1.120000 sys 0.710000 (best of 6)
author Siddharth Agarwal <sid0@fb.com>
date Tue, 04 Dec 2012 10:29:18 -0800
parents 0fed3fe45ea7
children 1a570f04de07
comparison
equal deleted inserted replaced
18031:54f063acc5ea 18032:a9e623bb440e
603 603
604 if not exact and self._checkcase: 604 if not exact and self._checkcase:
605 normalize = self._normalize 605 normalize = self._normalize
606 skipstep3 = False 606 skipstep3 = False
607 else: 607 else:
608 normalize = lambda x, y, z: x 608 normalize = None
609 609
610 files = sorted(match.files()) 610 files = sorted(match.files())
611 subrepos.sort() 611 subrepos.sort()
612 i, j = 0, 0 612 i, j = 0, 0
613 while i < len(files) and j < len(subrepos): 613 while i < len(files) and j < len(subrepos):
624 results = dict.fromkeys(subrepos) 624 results = dict.fromkeys(subrepos)
625 results['.hg'] = None 625 results['.hg'] = None
626 626
627 # step 1: find all explicit files 627 # step 1: find all explicit files
628 for ff in files: 628 for ff in files:
629 nf = normalize(normpath(ff), False, True) 629 if normalize:
630 nf = normalize(normpath(ff), False, True)
631 else:
632 nf = normpath(ff)
630 if nf in results: 633 if nf in results:
631 continue 634 continue
632 635
633 try: 636 try:
634 st = lstat(join(nf)) 637 st = lstat(join(nf))
674 if inst.errno in (errno.EACCES, errno.ENOENT): 677 if inst.errno in (errno.EACCES, errno.ENOENT):
675 fwarn(nd, inst.strerror) 678 fwarn(nd, inst.strerror)
676 continue 679 continue
677 raise 680 raise
678 for f, kind, st in entries: 681 for f, kind, st in entries:
679 nf = normalize(nd and (nd + "/" + f) or f, True, True) 682 if normalize:
683 nf = normalize(nd and (nd + "/" + f) or f, True, True)
684 else:
685 nf = nd and (nd + "/" + f) or f
680 if nf not in results: 686 if nf not in results:
681 if kind == dirkind: 687 if kind == dirkind:
682 if not ignore(nf): 688 if not ignore(nf):
683 match.dir(nf) 689 match.dir(nf)
684 wadd(nf) 690 wadd(nf)