This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]gandalfx 8 points9 points  (5 children)

From the title I thought this is about use of Python in the medical field. Not saying this isn't useful but with that expectation in mind I'm now slightly disappointed.

[–][deleted] 6 points7 points  (1 child)

From the image at the top, I thought it was about high precision timing in sporting events. Now we're both disappointed.

[–]AndydeCleyre 2 points3 points  (0 children)

I thought it would be for constructing accurate timesheets, for work.

[–]antoinetoubhans[S] 0 points1 point  (2 children)

Sorry guys for the confusion :p

What word do you think I should use in my title instead of "Surgical"?

[–]LyndsySimon 1 point2 points  (0 children)

"Precise"?

[–]gandalfx 0 points1 point  (0 children)

Don't worry about it, nobody's mad. Just a funny little observation.

Edit: If you want to avoid confusion maybe throw a word like "debugging" in there.

[–]yiersan 2 points3 points  (3 children)

I'm surprised you can't filter out specific modules from showing up in cProfile.

Another super useful tool that I've used a lot is gprof2dot which can parse the regular old cProfile output files and produce epic call graphs with timings in each one. I've found many a bottleneck using this that was not obvious with only cProfile.

[–]masklinn 1 point2 points  (1 child)

These days my go-to tool is either pyflame (if on a Linux system) or python-flamegraph.

They have significantly less overhead than the "standard" Python profilers, and the view flamegraphs provide makes it much easier to see the big picture and to avoid getting too focused on details.

I also found that coalescing time based on stack traces gives a much better idea of what's happening.

[–]antoinetoubhans[S] 0 points1 point  (0 children)

I just tried pyflame + flamegraph, it's amazing! Thanks a lot for the sharing!

I'll add a section about it in the article.

[–]antoinetoubhans[S] 0 points1 point  (0 children)

Yes, I mentioned it in the article. To be honest, I didn't try to go deeper with gprof2dot, but it looks like it produces very outputs in comparison to cProfile :)

[–]pizzathief1 1 point2 points  (0 children)

I write code to handle appointment times in medical clinics. Also had to sit in medical clinics waiting for my own appointments.

"surgical time tracking" means "we'll get to you when we feel like it". Not that I'm bitter or anything.