Re: [Zope] ZopeProfiler:does its installation have a performance impact?

2007-09-21 Thread Andreas Jung



--On 21. September 2007 09:11:11 +0200 robert rottermann [EMAIL PROTECTED] 
wrote:



Hi there,
does the installation of ZopeProfiler have a noticable performance
impact when it is disabled?


No

-aj

pgp8PEoL3qUyk.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] ZopeProfiler:does its installation have a performance impact?

2007-09-21 Thread Dieter Maurer
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
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )