Perfomance decrease in `DEBUG` logging level
See original GitHub issueDescribe the bug
When logging is set to DEBUG
:
import logging
logging.getLogger().setLevel(logging.DEBUG)
then perfomance is greatly decrease and more than 80% of time is spent on logging.
To Reproduce Steps to reproduce the behavior:
- download las file big enough to feel the problem
- set log level to
DEBUG
:
import logging
logging.getLogger().setLevel(logging.DEBUG)
- collect data:
import cProfile
cProfile.run("las=lasio.read(r'c:\Users\username\Downloads\A_Kerbel.las')", "c:/tmp/las.prof")
- install tuna to display results:
pip install tuna
- display results:
python -m tuna c:/tmp/las.prof
- now you can see that about 80% is spent on debug. Is that ok?
Expected behavior I guess debug should take less than 80% of the time
Software versions (please complete the following information):
- Python 3.6.7 (default, Jun 26 2021, 18:30:45) [MSC v.1929 64 bit (AMD64)] on win32
- lasio version 0.29
Additional context Please see my topic dedicated to this problem. Here you can simply find all the information needed to understand the problem.
P.S. I’m not much expert in profiling and I only have little experience of working in python so I appologize if I explained some staff cumbersome
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Does log.debug decrease performance - Stack Overflow
The answer is that it depends on what you're logging, because params to log will still be evaluated even if there's no logging...
Read more >DEBUG level logging - impacts on performance - IBM
In normal operation the log level for all of the subsystems should be set to INFO. DEBUG level can adversely impact performance. Parent...
Read more >Add to debug log how current logging levels could be affecting ...
Add to debug log how current logging levels could be affecting performance ... the code was executing at such a slow speed was...
Read more >Will logging in DEBUG level cause performance issues in ...
Excessive logging will of course incur a CPU and I/O cost, but whether that cost degrades performance in a measurable way depends on...
Read more >How logging in Java affects performance? - Automation Talks
Java logging severely affects performance of your application. Its quite common sense that more you log, more you perform file IO which slows ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kinverarity1 thank you very much, it seems now it works fast as expected. To test it I did:
then inside my Slicer’s python shell (wich sets
DEBUG
log level):less than a second has past to perform these two lines of code
@kerim371 if you are able to test the
master
branch of lasio to see if it helps that would be appreciated. I have moved the offending logger call to a custom level which is set below the standardDEBUG
level.