Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83235
| Date | 2015-01-04 13:24 +0100 |
|---|---|
| From | Jonas Wielicki <jonas@wielicki.name> |
| Subject | Re: list comparison vs integer comparison, which is more efficient? |
| References | <d27586b9-017a-4519-a6bb-e0a1fac005d0@googlegroups.com> <mailman.17365.1420355468.18130.python-list@python.org> <5499f48c-26e3-41c5-8735-2641fde5f35e@googlegroups.com> <7968fa1c-9b4c-4d17-9f71-1bbc55392921@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17390.1420459599.18130.python-list@python.org> (permalink) |
On 04.01.2015 13:17, austin aigbe wrote > Hi Terry, > > No difference between the int and list comparison in terms of the number of calls(24) and time (0.004s). Main part is the repeated call to sqrt(). > > However, it took a shorter time (0.004s) with 24 function calls than your code (0.005s) which took just 13 function calls to execute. How often did you run your measurement? 4ms is not a whole lot and can easily be skewed by sudden system load or other noise. You should call the function more often and/or repeat the measurement several times before coming to a judgement (except, possibly, that it doesn’t matter). cheers, jwi
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
list comparison vs integer comparison, which is more efficient? austin aigbe <eshikafe@gmail.com> - 2015-01-03 15:19 -0800
Re: list comparison vs integer comparison, which is more efficient? Chris Angelico <rosuav@gmail.com> - 2015-01-04 10:40 +1100
Re: list comparison vs integer comparison, which is more efficient? Terry Reedy <tjreedy@udel.edu> - 2015-01-04 02:10 -0500
Re: list comparison vs integer comparison, which is more efficient? austin aigbe <eshikafe@gmail.com> - 2015-01-04 03:20 -0800
Re: list comparison vs integer comparison, which is more efficient? austin aigbe <eshikafe@gmail.com> - 2015-01-04 04:17 -0800
Re: list comparison vs integer comparison, which is more efficient? Christian Gollwitzer <auriocus@gmx.de> - 2015-01-04 13:22 +0100
Re: list comparison vs integer comparison, which is more efficient? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-04 12:30 +0000
Re: list comparison vs integer comparison, which is more efficient? Chris Angelico <rosuav@gmail.com> - 2015-01-04 23:25 +1100
Re: list comparison vs integer comparison, which is more efficient? Jonas Wielicki <jonas@wielicki.name> - 2015-01-04 13:24 +0100
csiph-web