Parla.py icon indicating copy to clipboard operation
Parla.py copied to clipboard

Relatively aggressive logging may affect performance

Open arthurp opened this issue 3 years ago • 1 comments

The system has quite a lot of logging in there from various debugging efforts. Most of the time this is fine because it's at the debug level so it doesn't show up. If you think this might be affecting you, profile it. Don't just assume this is an issue. If you are sure logging is an issue, search for logger. in the code base. There is a fair amount of logging in task_runtime.py and other core files.

Overhead Cost Mitigation
Information collection Can be high Use logger.isEnabledFor to check if logging it enabled before collecting information and making the log call.
String formatting Can be high Use the %-style formatting built into the logger functions. This formatting only happens if the log entry is actually printed. Sadly, f-strings and str.format used in log calls end up bring run before regardless of the log level.
The function call and log level check Very low Create a _debug_logging flag in the module and check it before making the log call. This check will be faster. In extreme cases, comment out the logging statement.

arthurp avatar Apr 06 '21 18:04 arthurp