rkern / line_profiler

(OLD REPO) Line-by-line profiling for Python - Current repo ->
https://github.com/pyutils/line_profiler
Other
3.6k stars 256 forks source link

Line profiler adds more time compared to time module #165

Open ddoe777 opened 4 years ago

ddoe777 commented 4 years ago

Hi,

I am running a function which has a lot of for-loop iterations. The function can not unfortunately be shared since it contains Intellectual Properties. Let me know if any specific programming nature of the code information can help! However, during the testing, the time measured by line_profiler seems to be twice when measured by time.time(). Are there cases where line profiler is not a good fit for measurement?

Thanks.

Nodd commented 4 years ago

Line profiler adds some overhead to be able to measure the time for each line. The relative time are still correct, but it's up to you to know what you want to measure.