Skip to content
Snippets Groups Projects
Commit cee0473e authored by Scott Chacon's avatar Scott Chacon
Browse files

remove profiling code and cache all trees more effectively

parent 4286209d
No related branches found
No related tags found
No related merge requests found
......@@ -35,9 +35,7 @@
hg_repo_path += '-hg'
dest_repo = hg.repository(ui, hg_repo_path, create=True)
print dest_repo
# fetch the initial git data
git = GitHandler(dest_repo, ui)
git.remote_add('origin', git_url)
......@@ -40,23 +38,8 @@
# fetch the initial git data
git = GitHandler(dest_repo, ui)
git.remote_add('origin', git_url)
import cProfile, pstats
import lsprofcalltree
prof = cProfile.Profile()
prof = prof.runctx("git.fetch('origin')", globals(), locals())
stats = pstats.Stats(prof)
k = lsprofcalltree.KCacheGrind(prof)
data = open('/tmp/prof.kgrind', 'w+')
k.output(data)
data.close()
stats.sort_stats("cumulative") # Or cumulative
stats.print_stats(80) # 80 = how many to print
# The rest is optional.
#stats.print_callees()
#stats.print_callers()
#git.fetch('origin')
git.fetch('origin')
# checkout the tip
node = git.remote_head('origin')
......
......@@ -108,6 +108,7 @@
self.path = root
self.tags = Tags(self.tagdir(), self.get_tags())
self._object_store = None
self.tree_cache = {}
def controldir(self):
"""Return the path of the control directory."""
......@@ -315,7 +316,12 @@
return ret
def get_object(self, sha):
return self.object_store[sha]
if sha in self.tree_cache:
return self.tree_cache[sha]
obj = self.object_store[sha]
if obj._type == 'tree':
self.tree_cache[sha] = obj
return obj
def get_parents(self, sha):
return self.commit(sha).parents
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment