This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author William.Hart
Recipients William.Hart
Date 2011-03-02.03:03:34
SpamBayes Score 2.1982416e-14
Marked as misclassified No
Message-id <1299035016.51.0.282905880953.issue11369@psf.upfronthosting.co.za>
In-reply-to
Content
I recently started using logging extensively in the Coopr software, and I ran into some performance issues when logging was used within frequently used kernels in the code.  After profiling, it became clear that the performance of the logging package could be improved by simply caching the value of the Logger.isEnabledFor() method.

I've created a draft version of this cachine mechanism based on a snapshot of logging that I took from Python 2.7.1.  This is currently hosted in pytuilib.logging, though I'd love to see this migrate into the Python library (see https://software.sandia.gov/trac/pyutilib/browser/pyutilib.logging/trunk/pyutilib/logging).

Basically, I did the following:

1. Added a counter to the Manager class (status) that is incremented whenever the manager object has its level set

2. Add a counter to the Logger class (level_status) that represents the value of the manger status when the Logger's cache was last updated

3. Rework the isEnabledFor() method to update the cache if the logger status is older than the manager status.  I moved the present isEnabledFor logic into the _isEnabledFor() method for simplicity.

The attached file shows the diffs.  Note that there were a few other diffs due to an effort to make pyutilib.logging work on Python 2.5-2.7.

--Bill
History
Date User Action Args
2011-03-02 03:03:37William.Hartsetrecipients: + William.Hart
2011-03-02 03:03:36William.Hartsetmessageid: <1299035016.51.0.282905880953.issue11369@psf.upfronthosting.co.za>
2011-03-02 03:03:35William.Hartlinkissue11369 messages
2011-03-02 03:03:35William.Hartcreate