diff mercurial/hgweb/hgwebdir_mod.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 938fbeacac84
children 44382887d012 dd74cd1e5d49
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py	Sat Apr 30 16:33:47 2011 +0200
+++ b/mercurial/hgweb/hgwebdir_mod.py	Sat Apr 30 09:43:20 2011 -0700
@@ -9,7 +9,7 @@
 import os, re, time
 from mercurial.i18n import _
 from mercurial import ui, hg, scmutil, util, templater
-from mercurial import error, encoding, url
+from mercurial import error, encoding
 from common import ErrorResponse, get_mtime, staticfile, paritygen, \
                    get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
 from hgweb_mod import hgweb
@@ -364,7 +364,7 @@
 
     def updatereqenv(self, env):
         if self._baseurl is not None:
-            u = url.url(self._baseurl)
+            u = util.url(self._baseurl)
             env['SERVER_NAME'] = u.host
             if u.port:
                 env['SERVER_PORT'] = u.port