Quote:
Originally Posted by
nytty
Why is read-ahead a problem since above is only a 512bytes read
Because, I repeat, you are not getting raw access here.
You are not getting raw access.
You are not telling the drive 'move to sector x, read'.
You are telling the operating system 'give me data from position x'.
The operating system goes 'Hmmm, someone asked for that a little while ago', pulls it from cache, and gives it to you without touching the disk.
Dropping caches all the time is a bad idea. If you really want to get disk access speeds, use hdparm.
Quote:
Then if the cache is the reason, it should affect the file as well, but I am getting the same result for all reps?
Your results aren't accurate. You're running huge programs to do tiny things and most of what you're measuring is going to be error and bias of some sort. If you want to do real benchmarks, hdparm.
There isn't a significant difference between file and raw disk unless your file is very badly fragmented.