Closed ta946 closed 7 months ago
My initial feeling is negative on this. I don't think this feature is as generally useful as something like autoprofiling, and I want to avoid bloating the repo. My thought is that specifying -x is cumbersome and not something that users would want to repeat very often.
The overall time is also shown in the header, so I don't think it's necessary to repeat that information.
Of course if there is demand for this, then I'll reconsider.
yep, fair enough regarding -x, i use a shortcut in my IDE that has them configured so forgot about a user having to manually enter it every time.
As for the timing in header, it only displays total time, whereas the line timing shows nhits and time per hit. so its easier for me to know how many times the function was called and its single run time. Otherwise i would need to read the line timing inside the function to figure out the nhits, then divide total time, which becomes harder if the first line in the function is a loop
ignore timings for certain lines of code. eg: print, imports, initializations, debug related function calls. the timings are displayed in negative to indicate they are not included in the total time, and their percentage contribution is set to 0.
pass to the cli arg
-x
a space separated list of text that is matched for each line of code, which indicates that line should be ignored.kernprof.exe ... -x "print(" "import " "cv2.imshow(" "time.time()"
also add timing for the first line, usually the function definition, which shows the overall time taken by that function
my last new feature PR i promise 😁. im just being selfish with this one so I don't have to maintain a fork for this functionality, so i understand if you wouldn't want to add it.
example output: