[Zope] ZopeProfiler:does its installation have a performance
impact?
Dieter Maurer
dieter at handshake.de
Fri Sep 21 13:36:40 EDT 2007
robert rottermann wrote at 2007-9-21 09:11 +0200:
>does the installation of ZopeProfiler have a noticable performance
>impact when it is disabled?
No.
"ZopeProfiler" monkey patches "ZPublisher.publish_module"
with the following function:
def _profilePublishModule(
module_name, stdin=sys.stdin, stdout=sys.stdout,
stderr=sys.stderr, environ=environ, debug=0,
request=None, response=None
):
lock= _lock # to facilitate refreshing
psrc= request or environ; path= psrc.get('PATH_INFO')
if _enabled and _doProfile(path):
... code only executed when the profiler is enabled ...
else:
result= publish_module(
module_name, stdin=stdin, stdout=stdout,
stderr=stderr, environ=environ, debug=debug,
request=request, response=response)
return result
As you can see:
The overhead when "ZopeProfiler" is disabled is
* an extra function call
* 3 assignments
* a request lookup
* a boolean check
In total: negligable compared to what the ZPublisher (not speaking
about Zope at all) is doing otherwise.
--
Dieter
More information about the Zope
mailing list