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


Groups > comp.lang.python > #90958

Re: Help regarding python run time

References <CALbtgctWb5zHWG=Nf-Qoi94gUscp3L=Xx39a_onqzzx1hNci6A@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2015-05-20 09:23 -0600
Subject Re: Help regarding python run time
Newsgroups comp.lang.python
Message-ID <mailman.172.1432135454.17265.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, May 20, 2015 at 7:02 AM, AKHIL RANA <AKHILR@iitk.ac.in> wrote:
> Hi,
>
> I am student at IIT Kanpur and working on a Opencv based Python project. I
> am working on program development which takes less time to execute. For that
> i have tested my small program hello word on python to now the time taken by
> this program. I had run many time. and every time it run it gives me a
> different run time.
>
> Can we some how make the program to run at constant time so that we can work
> on how to reduce the timing ?

Not practically. The exact run time is dependent on a lot of factors
that are mostly out of your control: what other programs are running,
what they're doing and what resources they're using at that moment;
what hardware interrupts occur while your program is running; is data
to be read from disk cached or not; is data to be loaded from RAM
cached or not; if the disk is mechanical, what cylinder and sector
does the read head happen to be at when it gets a read request.

Instead of trying to measure an exact time over one run, you will get
better results by running the program several times and then taking
the minimum measurement as representative of the program's runtime
under ideal conditions.

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


Thread

Re: Help regarding python run time Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-20 09:23 -0600
  Re: Help regarding python run time Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2015-05-20 17:48 +0200
    Re: Help regarding python run time Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-20 10:26 -0600

csiph-web