[To Home Page]

fileio
Dennis Lang
landenlabs.com

C/C++ Measure performance of various File Input/Output interfaces (API)

Updated: 13-Jun-2010, 28-Apr-2011

The following report shows the performance (MegaBytes/Second) of various Input/Output interfaces (API's) on Windows 7. The following File Management interfaces are measured:

Windows 7/64 test run on HP dual quad-core 2.8GHz, with 1 TB Hitachi HDs721010KLA330 drive, measured average transfer rate of 69MB/s using HDTune.

The test is performed by first creating two 100 Megabyte files. One file is used to flush the OS file cache between each test. The flush is done by sequencially reading the entire file. Each test uses the specified i/o interfaces to read or write a specified record size buffer. The sequencial test runs across the entire 100MB file. The random test only touches 50% of the file. The random access test is shorten because I don't think the entire file needs to be randomly read to get the effective random access transfer rate. The time to run the test is measured as well as the total number of bytes procssed. The resuls are saved to a log file.

HDTune measured the average raw transfer rate of the disk drive at 69MB/sec, yet most of the test results exceed that rate. This difference reflects Windows's ability to buffer disk access to improve performance, most noticable in the Input tests.

http://www.hdtune.com/
hdtune

The tests measure local disk and network file performance. The local disk tests both the default disk flush settings and with the flush disabled.

disk-write-flush

The first series of graphs shows the Input performance. The graphs include both Sequencial and Random file access results in one graph.

WINDOWS source code
In order to minimize file fragmentation impact, the test file is made by seeking to the allocation file position and then end-of-file is set. Using this file creation method produces a continguous file allocation most of the time. For refernce, the disk fragmentation is displayed when the tests is run.

Create a contiguous file:

     HANDLE hFile = CreateFileA(
        filePath,
        GENERIC_READ|GENERIC_WRITE,
        FILE_SHARE_READ | FILE_SHARE_WRITE,
        NULL,
        OPEN_ALWAYS, 
        FILE_FLAG_NO_BUFFERING,
        NULL);

    SetFilePointer(hFile, filePos.LowPart, &filePos.HighPart,  FILE_BEGIN);
    

Summary of Input Results:

Windows 7 Input File Performance with default Disk Flush enabled
input-disk-flush-on

Windows 7 Input File Performance with disk flush disabled
input-disk-flush-off

Windows 7 Input File Performance over a 100mb network
input-network


The following graphs shows the Output performance. I am guessing the memory mapped i/o is significantly faster than the other API's over the network because the writes are not flushed until the file is closed.

Summary of Output Results:

Windows 7 Output File Performance with default disk flush enabled
output-disk-flush-on

Windows 7 Output File Performance with disk flush disabled
output-disk-flush-off

Windows 7 Output File Performance over a 100mb network
output-network

The above graphs were produced by running fileio with the following options:

Local disk test:
   fileio -Fc -k 100mb -z > localtest.csv

Network test:
   fileio -Fc -P \\host\dir\fileio.dat -k 100mb -z > remotetest.csv

fileio Dowload source code:
FileIO-v3.0.zip (Windows)
FileIO-v2.0.zip (Linux and Windows)