VSIFFlushL is potential bottleneck on Windows
|Reported by:||Mateusz Łoskot||Owned by:||warmerdam|
(It's not a real defect, but performance issue.)
VSIFFlushL on Windows is implemented in terms of FlushFileBuffers? which is an expansive routine
FlushFileBuffers?(): This function will flush everything in the write-back cache, as it does not know what part of the cache belongs to your file. This can take a lot of time, depending on the cache size and the speed of the media. How necessary is it? There is a thread which goes through and writes out dirty pages, so it is likely not very necessary.
FlushFileBuffers? requests OS buffers to be written to file. fflush requests C run-time buffers to be written to OS, but actual commit to file may be delayed. So, fflush tends to be order of magnitude faster,
These differences may lead to significant performance differences in case a driver will have been updated from FILE* to VSILFILE*.