question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Perfomance decrease in `DEBUG` logging level

See original GitHub issue

Describe 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:

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:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
kerim371commented, Jul 16, 2021

@kinverarity1 thank you very much, it seems now it works fast as expected. To test it I did:

pip install git+https://github.com/kinverarity1/lasio.git

then inside my Slicer’s python shell (wich sets DEBUG log level):

import lasio
las=lasio.read(r'd:d\A_Kerbel.las')

less than a second has past to perform these two lines of code

2reactions
kinverarity1commented, Jul 16, 2021

@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 standard DEBUG level.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found