Re: print statements and profiling a function slowed performance

2014-06-29 Thread Chris Angelico
On Sun, Jun 29, 2014 at 4:14 PM, Dennis Lee Bieber wrote: > On Sat, 28 Jun 2014 23:50:26 +1000, Chris Angelico > declaimed the following: > >>No, they were measured; but the exact difference will depend on Python >>version, console, OS, etc, etc, etc, etc, etc, which is why I said >>"maybe 100ms"

Re: print statements and profiling a function slowed performance

2014-06-28 Thread Chris Angelico
On Sun, Jun 29, 2014 at 12:25 PM, Rustom Mody wrote: > On Sunday, June 29, 2014 12:50:19 AM UTC+5:30, Marko Rauhamaa wrote: >> Chris Angelico wrote: > >> > Threading is a focus of so many myths. People who don't understand it >> > think that threads are magic pixie dust that fixes everything, or e

Re: print statements and profiling a function slowed performance

2014-06-28 Thread Rustom Mody
On Sunday, June 29, 2014 12:50:19 AM UTC+5:30, Marko Rauhamaa wrote: > Chris Angelico wrote: > > Threading is a focus of so many myths. People who don't understand it > > think that threads are magic pixie dust that fixes everything, or else > > magic pixie dust that breaks everything. Or both, at

Re: print statements and profiling a function slowed performance

2014-06-28 Thread Chris Angelico
On Sun, Jun 29, 2014 at 5:20 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> Threading is a focus of so many myths. People who don't understand it >> think that threads are magic pixie dust that fixes everything, or else >> magic pixie dust that breaks everything. Or both, at the same time. >> N

Re: print statements and profiling a function slowed performance

2014-06-28 Thread Marko Rauhamaa
Chris Angelico : > Threading is a focus of so many myths. People who don't understand it > think that threads are magic pixie dust that fixes everything, or else > magic pixie dust that breaks everything. Or both, at the same time. > Neither notion is true. I'm in the latter camp. More precisely

Re: print statements and profiling a function slowed performance

2014-06-28 Thread Chris Angelico
On Sat, Jun 28, 2014 at 11:41 PM, Dennis Lee Bieber wrote: > On Fri, 27 Jun 2014 12:06:54 +1000, Chris Angelico > declaimed the following: > >> >>If x is, say, range(100), a simple "for foo in x: pass" will >>complete fairly quickly (maybe 100ms on my computer), while the >>progress-indicated

Re: print statements and profiling a function slowed performance

2014-06-27 Thread Mark Lawrence
On 28/06/2014 01:12, Skip Montanaro wrote: On Fri, Jun 27, 2014 at 4:35 PM, Ian Kelly wrote: That's got to count for something, compared to a raw print that has to wait for the I/O to finish. A raw print basically just tosses some bytes in a stdio buffer (at least in Unix-land). Exactly, i

Re: print statements and profiling a function slowed performance

2014-06-27 Thread Chris Angelico
On Sat, Jun 28, 2014 at 10:12 AM, Skip Montanaro wrote: > threading-doesn't-always-speed-things-up-ly, y'rs, Threading is a focus of so many myths. People who don't understand it think that threads are magic pixie dust that fixes everything, or else magic pixie dust that breaks everything. Or bot

Re: print statements and profiling a function slowed performance

2014-06-27 Thread Skip Montanaro
On Fri, Jun 27, 2014 at 4:35 PM, Ian Kelly wrote: > That's got to count for > something, compared to a raw print that has to wait for the I/O to > finish. A raw print basically just tosses some bytes in a stdio buffer (at least in Unix-land). Stdio does whatever little it does, then passes the by

Re: print statements and profiling a function slowed performance

2014-06-27 Thread Ian Kelly
On Fri, Jun 27, 2014 at 10:05 AM, Skip Montanaro wrote: > On Fri, Jun 27, 2014 at 10:55 AM, Mark Lawrence > wrote: >> Expectations don't count, measure it :) > > It's no contest. I have measured it (ages ago). The logging module > does so many things that it's impossible for it to ever be as fas

Re: print statements and profiling a function slowed performance

2014-06-27 Thread Skip Montanaro
On Fri, Jun 27, 2014 at 10:55 AM, Mark Lawrence wrote: > Expectations don't count, measure it :) It's no contest. I have measured it (ages ago). The logging module does so many things that it's impossible for it to ever be as fast as a simple print statement. Look at the code in LogRecord.__init_

Re: print statements and profiling a function slowed performance

2014-06-27 Thread Mark Lawrence
On 27/06/2014 03:55, Steven D'Aprano wrote: On Thu, 26 Jun 2014 13:37:41 -0700, CM wrote: On Thursday, June 26, 2014 3:27:48 PM UTC-4, Mark Lawrence wrote: 3. use the logging module :) I've just never got around to it, but I guess I should. Thanks for the nudge. While using the logging m

Re: print statements and profiling a function slowed performance

2014-06-26 Thread Chris Angelico
On Fri, Jun 27, 2014 at 12:55 PM, Steven D'Aprano wrote: > On Thu, 26 Jun 2014 13:37:41 -0700, CM wrote: > >> On Thursday, June 26, 2014 3:27:48 PM UTC-4, Mark Lawrence wrote: >> >>> 3. use the logging module :) >> >> I've just never got around to it, but I guess I should. Thanks for the >> nudge

Re: print statements and profiling a function slowed performance

2014-06-26 Thread Steven D'Aprano
On Thu, 26 Jun 2014 13:37:41 -0700, CM wrote: > On Thursday, June 26, 2014 3:27:48 PM UTC-4, Mark Lawrence wrote: > >> 3. use the logging module :) > > I've just never got around to it, but I guess I should. Thanks for the > nudge. While using the logging module is recommended for logging, if

Re: print statements and profiling a function slowed performance

2014-06-26 Thread Chris Angelico
On Fri, Jun 27, 2014 at 6:36 AM, CM wrote: >> Yes, it stands to reason that profiling code >> is going to introduce a runtime cost. How else >> would we expect profiling to work? > > I think I was hoping for magic. :D Thank you for being honest :) The fact is, though, that time-of-day and consol

Re: print statements and profiling a function slowed performance

2014-06-26 Thread Michael Torrie
On 06/26/2014 02:36 PM, CM wrote: >> What I do find Heisenbergian are bugs that show >> up when debugging and profiling stuff are removed, >> but completely gone when present. IE profiling and >> debugging slow it down enough that often subtle race >> conditions are masked. > > Would never ha

Re: print statements and profiling a function slowed performance

2014-06-26 Thread CM
On Thursday, June 26, 2014 3:27:48 PM UTC-4, Mark Lawrence wrote: > 3. use the logging module :) I've just never got around to it, but I guess I should. Thanks for the nudge. -- https://mail.python.org/mailman/listinfo/python-list

Re: print statements and profiling a function slowed performance

2014-06-26 Thread CM
> Seems like over the years good old fashioned > debugging skills have been lost. In the earliest > days of IDEs (Turbo BASIC and QuickBASIC) I > regularly would employ debuggers with break > points, watches, and step through my code. I do also use a debugger, but lazily use print stateme

Re: print statements and profiling a function slowed performance

2014-06-26 Thread Mark Lawrence
On 26/06/2014 19:44, CM wrote: Huh. I learned two new Python facts this week: 1. print statements were slowing down my code enough to really notice a particular transition. It went from about 2-3 seconds to a bit under 1 second. What at first seemed unresponsive now seems almost snappy. The only

Re: print statements and profiling a function slowed performance

2014-06-26 Thread Michael Torrie
On 06/26/2014 12:44 PM, CM wrote: > Huh. I learned two new Python facts this week: > > 1. print statements were slowing down my code enough to > really notice a particular transition. It went from about > 2-3 seconds to a bit under 1 second. What at first seemed > unresponsive now seems almost sna

print statements and profiling a function slowed performance

2014-06-26 Thread CM
Huh. I learned two new Python facts this week: 1. print statements were slowing down my code enough to really notice a particular transition. It went from about 2-3 seconds to a bit under 1 second. What at first seemed unresponsive now seems almost snappy. The only difference was removing a lot of