comparison mercurial/localrepo.py @ 14076:924c82157d46

url: move URL parsing functions into util to improve startup time The introduction of the new URL parsing code has created a startup time regression. This is mainly due to the use of url.hasscheme() in the ui class. It ends up importing many libraries that the url module requires. This fix helps marginally, but if we can get rid of the urllib import in the URL parser all together, startup time will go back to normal. perfstartup time before the URL refactoring (8796fb6af67e): ! wall 0.050692 comb 0.000000 user 0.000000 sys 0.000000 (best of 100) current startup time (139fb11210bb): ! wall 0.070685 comb 0.000000 user 0.000000 sys 0.000000 (best of 100) after this change: ! wall 0.064667 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)
author Brodie Rao <brodie@bitheap.org>
date Sat, 30 Apr 2011 09:43:20 -0700
parents 72c84f24b420
children 7f45b1911893
comparison
equal deleted inserted replaced
14075:bc101902a68d 14076:924c82157d46
12 import lock, transaction, store, encoding 12 import lock, transaction, store, encoding
13 import scmutil, util, extensions, hook, error 13 import scmutil, util, extensions, hook, error
14 import match as matchmod 14 import match as matchmod
15 import merge as mergemod 15 import merge as mergemod
16 import tags as tagsmod 16 import tags as tagsmod
17 import url as urlmod
18 from lock import release 17 from lock import release
19 import weakref, errno, os, time, inspect 18 import weakref, errno, os, time, inspect
20 propertycache = util.propertycache 19 propertycache = util.propertycache
21 20
22 class localrepository(repo.repository): 21 class localrepository(repo.repository):
1693 # inconsistent view 1692 # inconsistent view
1694 cl = self.changelog 1693 cl = self.changelog
1695 cl.delayupdate() 1694 cl.delayupdate()
1696 oldheads = cl.heads() 1695 oldheads = cl.heads()
1697 1696
1698 tr = self.transaction("\n".join([srctype, urlmod.hidepassword(url)])) 1697 tr = self.transaction("\n".join([srctype, util.hidepassword(url)]))
1699 try: 1698 try:
1700 trp = weakref.proxy(tr) 1699 trp = weakref.proxy(tr)
1701 # pull off the changeset group 1700 # pull off the changeset group
1702 self.ui.status(_("adding changesets\n")) 1701 self.ui.status(_("adding changesets\n"))
1703 clstart = len(cl) 1702 clstart = len(cl)
1935 for src, dest in renamefiles: 1934 for src, dest in renamefiles:
1936 util.rename(src, dest) 1935 util.rename(src, dest)
1937 return a 1936 return a
1938 1937
1939 def instance(ui, path, create): 1938 def instance(ui, path, create):
1940 return localrepository(ui, urlmod.localpath(path), create) 1939 return localrepository(ui, util.localpath(path), create)
1941 1940
1942 def islocal(path): 1941 def islocal(path):
1943 return True 1942 return True