[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: винчестер быстро читает, медленно пишет



Alexander wrote:

ayax:~# cat rtest.c
#include <stdio.h>
void main(){
  int i;
  FILE *O;
  O = fopen("testfile", "rb");
  for(i=0;i<1024*1024*10;++i) fscanf(O, "a");
  fclose(O);
  }

ayax:~# cat wtest.c
#include <stdio.h>
void main(){
  int i;
  FILE *O;
  O = fopen("testfile", "wb");
  for(i=0;i<1024*1024*10;++i) fprintf(O, "a");
  fclose(O);
  }

Получилось вот что:

ayax:~# time ./wtest
real    0m18.027s
user    0m0.013s
sys     0m0.048s

ayax:~# time ./rtest
real    0m1.972s
user    0m1.965s
sys     0m0.008s


а что говорят
dd if=/dev/zero of=testfile bs=4096 count=500000
и
dd if=testfile of=/dev/null bs=4096 count=500000



Reply to: