Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83203

Re: list comparison vs integer comparison, which is more efficient?

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: list comparison vs integer comparison, which is more efficient?
Date 2015-01-04 12:30 +0000
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> <m8bb91$2h7$1@dont-email.me>
Newsgroups comp.lang.python
Message-ID <mailman.17371.1420374649.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 04/01/2015 12:22, Christian Gollwitzer wrote:
> Am 04.01.15 um 13:17 schrieb austin aigbe:
>> 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.
>
>> Why is this?
>
> These times are way too short for conclusive results. Typically, the OS
> timer operates with a millisecond resolution. You need to run a
> benchmark at least for a second to get reliable information about
> timing. INstead of 24 times, call your function 20000 times in loop.
>
>      Christian
>

Maybe using a custom built tool such as 
https://docs.python.org/3/library/timeit.html#module-timeit ?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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