Path: csiph.com!usenet.pasdenom.info!news.albasani.net!news.swapon.de!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail From: Helmut Jarausch Newsgroups: comp.lang.python Subject: Re: How to make this faster Date: 6 Jul 2013 07:25:21 GMT Lines: 46 Message-ID: References: < b3o997Fu5lhU2@mid. dfncis.de> <51d6f960$0$29999$c3e8da3$5496439d@news. astraweb.com> < 51d7897a$0$29999$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: news.dfncis.de OnV+q+C78s88Qz2eW12iTQQLNFeTb3UqgRdVfMwNE5SY278xj+eo82Tpe7 Cancel-Lock: sha1:mXNboTNHzZNeZKvtf/YajlUUxwY= User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Xref: csiph.com comp.lang.python:50050 On Sat, 06 Jul 2013 03:05:30 +0000, Steven D'Aprano wrote: > That doesn't explain how you time it, only that you have a loop executing > 100 times. Are you using time.time, or time.clock? (I trust you're not > measuring times by hand with a stop watch.) > > I expect you're probably doing something like this: > > start = time.time() I have been using time.process_time >> If the timing version, which executes function "Solve" one hundred >> times, runs about 80-100 seconds without a significant variation, then >> taking the mean is mathematically correct. > For longer running code, like this, you might also like this: > http://code.activestate.com/recipes/577896/ Thanks for the pointer. > If the best you can say is it takes "80-100 seconds", that's pretty > significant variation, of the order of 20%. That's not a variation of a SINGLE variant. One variant takes 80 seconds and the other variant to be compared with takes 100 seconds. > > In this case, with times of the order of a second per loop, it may be > reasonable to say "in this specific case, the error is too small to care > about", or "I just don't care about the error, since it will be about the > same for different variations of my solve function". But in that case, > why bother looping 100 times? > > >> I can't take the minimum >> since I don't measure the time a single call takes. > > Then perhaps you should. Many thanks, Helmut