Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/sshrepo.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 | 97ed99d1f419 |
children | 82f3b0f3f0a5 |
comparison
equal
deleted
inserted
replaced
14075:bc101902a68d | 14076:924c82157d46 |
---|---|
4 # | 4 # |
5 # This software may be used and distributed according to the terms of the | 5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 from i18n import _ | 8 from i18n import _ |
9 import util, error, wireproto, url | 9 import util, error, wireproto |
10 | 10 |
11 class remotelock(object): | 11 class remotelock(object): |
12 def __init__(self, repo): | 12 def __init__(self, repo): |
13 self.repo = repo | 13 self.repo = repo |
14 def release(self): | 14 def release(self): |
21 class sshrepository(wireproto.wirerepository): | 21 class sshrepository(wireproto.wirerepository): |
22 def __init__(self, ui, path, create=0): | 22 def __init__(self, ui, path, create=0): |
23 self._url = path | 23 self._url = path |
24 self.ui = ui | 24 self.ui = ui |
25 | 25 |
26 u = url.url(path, parsequery=False, parsefragment=False) | 26 u = util.url(path, parsequery=False, parsefragment=False) |
27 if u.scheme != 'ssh' or not u.host or u.path is None: | 27 if u.scheme != 'ssh' or not u.host or u.path is None: |
28 self._abort(error.RepoError(_("couldn't parse location %s") % path)) | 28 self._abort(error.RepoError(_("couldn't parse location %s") % path)) |
29 | 29 |
30 self.user = u.user | 30 self.user = u.user |
31 if u.passwd is not None: | 31 if u.passwd is not None: |