Author: justi9
Date: 2007-11-02 18:16:50 -0400 (Fri, 02 Nov 2007)
New Revision: 1229
Modified:
mgmt/cumin/bin/cumin-test
mgmt/cumin/python/wooly/__init__.py
Log:
Some small improvements to marshal_url_vars (one of the usual
suspects) from profiling.
Modified: mgmt/cumin/bin/cumin-test
===================================================================
--- mgmt/cumin/bin/cumin-test 2007-11-02 21:51:36 UTC (rev 1228)
+++ mgmt/cumin/bin/cumin-test 2007-11-02 22:16:50 UTC (rev 1229)
@@ -75,10 +75,10 @@
stats.sort_stats("cumulative").print_stats(15)
stats.sort_stats("time").print_stats(15)
- #stats.print_callees("wooly/__init__.*\\(marshal_url_vars\\)")
- #stats.print_callees("wooly/__init__.*\\(path\\)")
- #stats.print_callees("wooly/__init__.*\\(get\\)")
- #stats.print_callees("wooly/__init__.*\\(render\\)")
+ stats.print_callees("wooly/__init__.*\\(marshal_url_vars\\)")
+ stats.print_callees("wooly/__init__.*\\(path\\)")
+ stats.print_callees("wooly/__init__.*\\(get\\)")
+ stats.print_callees("wooly/__init__.*\\(render\\)")
stats.strip_dirs()
else:
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2007-11-02 21:51:36 UTC (rev 1228)
+++ mgmt/cumin/python/wooly/__init__.py 2007-11-02 22:16:50 UTC (rev 1229)
@@ -39,7 +39,7 @@
return self.cached_ancestors
def path(self):
- if not self.cached_path:
+ if self.cached_path == None:
if not self.parent:
self.cached_path = ""
elif not self.parent.parent:
@@ -50,7 +50,7 @@
return self.cached_path
def page(self):
- if not self.cached_page:
+ if self.cached_page == None:
if not self.parent:
self.cached_page = self
else:
@@ -182,7 +182,7 @@
self.cached_path = None
def path(self):
- if not self.cached_path:
+ if self.cached_path == None:
if not self.widget.parent:
self.cached_path = self.name
else:
@@ -510,8 +510,16 @@
vars = list()
for param in params:
- key = param.path()
+ #key = param.path()
+ # Inlined below saving about a half a second in a
+ # 1000-hit profile
+
+ if param.cached_path == None:
+ key = param.path()
+ else:
+ key = param.cached_path
+
if param.is_collection:
collection = self.get(key)
@@ -520,7 +528,18 @@
svalue = quote(param.marshal(value))
vars.append("%s=%s" % (key, svalue))
else:
- value = self.get(key)
+ #value = self.get(key)
+
+ # Inlined below saving about a second in a
+ # 1000-hit profile
+
+ if key in self.values:
+ value = self.values[key]
+ elif self.trunk:
+ value = self.trunk.get(key)
+ else:
+ value = None
+
default = param.get_default(self)
if value not in (default, None):