Blockread/write, how fast? 
Author Message
 Blockread/write, how fast?

Hello

I wanted to check how fast my computer reads and writes to the disk. I
wrote a small program which first writes a file with blockwrite and then
reads the file with blockread. To get the time I used gettime.

The result is stunning! Too good to be believable, about 100 MB /sec.
:-) I have tried to "debug" the code 100 times, without result... It is
actually fast because the program creates a very big file in a short
time. But I don't trust it.

I would really appreciate some help/thoughts.

/Tobz

If you want to look at my code:

procedure skriv_las_hastighet(var skriv, las : double; antal_ganger64k :
integer);
var
   fil_p : file;
   p : pointer;
   h,min,sec,hund : word;
   a : real;
   index : integer;
begin
  assign(fil_p,'data.tmp');
  rewrite(fil_p,1);
  getmem(p,64000);

  gettime(h,min,sec,hund);
  a:=(h*60*60*100)+(min*60*100)+(sec*100)+(hund);
  for index:=1 to antal_ganger64k do
      blockwrite(fil_p,mem[seg(p^):ofs(p^)],64000);

  gettime(h,min,sec,hund);
  skriv:=(h*60*60*100)+(min*60*100)+(sec*100)+(hund)-a;

  reset(fil_p,1);
  gettime(h,min,sec,hund);
  a:=(h*60*60*100)+(min*60*100)+(sec*100)+(hund);
  for index:=1 to antal_ganger64k do
      blockread(fil_p,mem[seg(p^):ofs(p^)],64000);

  gettime(h,min,sec,hund);
  las:=(h*60*60*100)+(min*60*100)+(sec*100)+(hund)-a;

  close(fil_p);
end;



Wed, 18 Jun 1902 08:00:00 GMT  
 Blockread/write, how fast?
Quote:

> I wanted to check how fast my computer reads and writes to the disk. I
> wrote a small program which first writes a file with blockwrite and then
> reads the file with blockread. To get the time I used gettime.

> The result is stunning! Too good to be believable, about 100 MB /sec.
> :-) I have tried to "debug" the code 100 times, without result... It is
> actually fast because the program creates a very big file in a short
> time. But I don't trust it.

It seems that you tested the disk cache of your computer. :-)
Btw:
 reset(fil_p,1);
must be replaced by
 Seek(fil_p,0);
--
Franz Glaser, Glasau 3, A-4191 Vorderweissenbach Austria +43-7219-7035-0
Muehlviertler Elektronik Glaser.  Industrial control and instrumentation

http://www.geocities.com/~franzglaser/ http://members.xoom.com/f_glaser/


Wed, 18 Jun 1902 08:00:00 GMT  
 Blockread/write, how fast?

Quote:

>The result is stunning! Too good to be believable, about 100 MB /sec.
>:-) I have tried to "debug" the code 100 times, without result... It is
>actually fast because the program creates a very big file in a short
>time. But I don't trust it.
>I would really appreciate some help/thoughts.

Clearly your data was cached in some way. Perhaps you're running the
programs under windows? Perhaps you are running a disk cache program
under DOS? You should go to a DOS environment, without disk caches, if
you really want to test diskspeed this way. However, your test will be
incomplete since you'll be testen old 16-bit disk access only.

Perhaps you should modify your test program; use something which
hasn't been read, or just written, for the read test. Even better;
access the disk at a lower level (although Windows will complain if
you try that).

A better way to compare disk speed is to simply duplicate a file of
250 MB on the (defragmented) disk and time it using a stopwatch. :-)
(it's too big for a cache, and you'll be reading & writing).

Peter de Jong



Wed, 18 Jun 1902 08:00:00 GMT  
 Blockread/write, how fast?

Quote:

> I wanted to check how fast my computer reads and writes to the disk. I
> wrote a small program which first writes a file with blockwrite and then
> reads the file with blockread. To get the time I used gettime.

> The result is stunning! Too good to be believable, about 100 MB /sec.
> :-) I have tried to "debug" the code 100 times, without result... It is
> actually fast because the program creates a very big file in a short
> time. But I don't trust it.

The data you have written to the disk is still in the cache when you read it
again, that's why you get such a high data transfer rate. I don't know what
you are measuring, but certainly not the disk speed.


Wed, 18 Jun 1902 08:00:00 GMT  
 Blockread/write, how fast?

Quote:

> The result is stunning! Too good to be believable, about 100 MB /sec.
> :-) I have tried to "debug" the code 100 times, without result... It is
> actually fast because the program creates a very big file in a short
> time. But I don't trust it.

You didn't mention what Pascal you're using, but if it's a dos/real mode
one, the trouble may be your 'integer's.  If they're short int, just maybe
they're wrapping...

That is, if it wasn't the disk cache problem :)

Steve



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Bitmap to blockread/write

2. blockread/write using file handles?

3. BLOCKread/write

4. Need a (very) fast write-routine for the full screen

5. Wanted: Fast Write and WriteLn replacement...

6. fast Reading and Writing

7. Faster writes to screen

8. faster file-writing and cos functions?

9. Fast cursor blinking rate on fast machines?

10. I need Help (fast) and i mean fast...

11. error 200 on blockread (w/ patched tpl files)

12. Blockread/Blockwrite question.

 

 
Powered by phpBB® Forum Software