Wed Feb 22 04:47:15 UTC 2006 Alberto Bertogli * Move some one-time used imports to the user location. As a minor but noticeable optimization to darcsweb's load time, move the importing of sha and email.Utils modules to the place where they're used (only one in both cases). This takes the time spent on imports from 0.027s to 0.021s, which will probably be slightly noticeable on slower machines, reducing the time taken by a cache hit from 0.030s to 0.024s (on misses it doesn't make a difference). diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi --- old-darcsweb/darcsweb.cgi 2015-10-04 00:48:47.000000000 +0000 +++ new-darcsweb/darcsweb.cgi 2015-10-04 00:48:47.000000000 +0000 @@ -14,13 +14,11 @@ import os import string import stat -import sha import cgi import cgitb; cgitb.enable() import urllib import xml.sax from xml.sax.saxutils import escape as xml_escape -import email.Utils time_imports = time.time() - time_begin iso_datetime = '%Y-%m-%dT%H:%M:%SZ' @@ -481,6 +479,7 @@ class Cache: def __init__(self, basedir, url): + import sha self.basedir = basedir self.url = url self.fname = sha.sha(repr(url)).hexdigest() @@ -1868,6 +1867,7 @@ link = '%s/%s;a=commit;h=%s' % (config.myurl, config.myreponame, p.hash) + import email.Utils addr, author = email.Utils.parseaddr(p.author) if not addr: addr = "unknown_email@example.com"