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


Groups > comp.lang.python > #54187

Re: How to get time (milisecond) of a python IO execution

From Dave Angel <davea@davea.name>
Subject Re: How to get time (milisecond) of a python IO execution
Date 2013-09-15 11:31 +0000
References <8baf5318-f82c-417d-9a1d-956bf9cb3856@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.0.1379244724.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 14/9/2013 22:59, Tal Bar-Or wrote:

> Hi All
>
> i am trying to test measure some IO execution in milliseconds , but bit confuse about best method achive that under windows 7

Measuring any performance can be tricky, and I/O in particular.  Windows
will cache the recently used file information, at a few levels.  So if
you do the same thing repeatedly, you'll get an unnaturally low average
time.

if you really need to measure how long it takes to get a file size,
you would need to write your own, very controlled, test code.  For
example, there is an APi call that tells Windows to flush its disk
caching logic.  However, it doesn't necessarily flush the buffers that
the drive itself keeps.  Worse, in order to run your program, you have
to do some disk I/O, and if that happens to use some of the same sectors
as the thing you're timing, you're biasing the results.

If you have multiple partitions, you could arrange that the file in
question is the only thing your system uses on that partition, to
minimize the likelihood that something else has primed the pump.  But
realize also that once you're measuring the real thing, speed of
exeution will vary enormously depending on the speed of the drive, the
layout of the directories, and the fragmentation of the disk.


-- 
DaveA

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


Thread

How to get time (milisecond) of a python IO execution Tal Bar-Or <tbaror@gmail.com> - 2013-09-14 19:59 -0700
  Re: How to get time (milisecond) of a python IO execution Skip Montanaro <skip@pobox.com> - 2013-09-15 05:52 -0500
  Re: How to get time (milisecond) of a python IO execution Dave Angel <davea@davea.name> - 2013-09-15 11:31 +0000

csiph-web