changeset 876:8c112b6d5e61

git_handler.load_map: avoid property accesses For a mapfile with 1.5 million entries, this speeds up perfgitloadmap from 2.5 seconds to 2.3.
author Siddharth Agarwal <sid0@fb.com>
date Thu, 09 Apr 2015 19:51:33 -0700
parents 9fdd6a1b3339
children b250e7b3ad71
files hggit/git_handler.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -169,13 +169,15 @@
         return self._map_hg.get(hgsha)
 
     def load_map(self):
-        self._map_git_real = {}
-        self._map_hg_real = {}
+        map_git_real = {}
+        map_hg_real = {}
         if os.path.exists(self.repo.join(self.map_file)):
             for line in self.repo.opener(self.map_file):
                 gitsha, hgsha = line.strip().split(' ', 1)
-                self._map_git_real[gitsha] = hgsha
-                self._map_hg_real[hgsha] = gitsha
+                map_git_real[gitsha] = hgsha
+                map_hg_real[hgsha] = gitsha
+        self._map_git_real = map_git_real
+        self._map_hg_real = map_hg_real
 
     def save_map(self):
         file = self.repo.opener(self.map_file, 'w+', atomictemp=True)