all
When I try to read some media file from sd card after the first time I insert to the device, the read performance is much worse than the second time, does anybody have any idea about this phenomena, and how can I avoid this problem, I tried open and fopen, but the results are the same, I just want read performance is the same, no matter when I insert SD card, thanks
Using
O_DIRECT(see open(2)) when opening the file will bypass the buffer cache. This is often not a good idea, but I would expect it to be more consistent from run to run.Keep in mind that using
O_DIRECTrequires that the memory read into beSC_PAGESIZEaligned and read in blocks which are multiples ofSC_PAGESIZE.