Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

File System Performance Tuning

12 views
Skip to first unread message

Eric Sun

unread,
Jan 8, 2010, 4:23:31 AM1/8/10
to
I am currently working on WINCE6.0 file system performance tuning. In
theory, memory mapped file will increase frequently accessed file
data. I use 2 method to read through a file

Method 1
-----------------------------------------
CreateFile(...)

for (cnt=0; cnt!=TEST_CNT; cnt++)
{
start = GetTickCount();

SetFilePointer(hFileInput, 0, 0, FILE_BEGIN);
loop ReadFile(..., buf, bufSize, ...) through the file

end = GetTickCount();

Dump (end - start);
}


Method 2
-----------------------------------------
CreateFile(...);
dwFileSize = GetFileSize(...);
CreateFileMapping(...);
pFile = MapViewOfFile(...);
for (cnt=0; cnt!=TEST_CNT; cnt++)
{
start = GetTickCount();

loop memcpy(buf, pFile + offset, bufSize) through the whole
file ;

end = GetTickCount();

Dump (end - start);
}

I use a 5MB test file and a 1MB buf to do the test on ATA and
calculate the read performace in MBps (with file cache pool big
enough). I set SYSGEN_CACHEFILT = 0 for these tests.

For method 1 (ReadFile Method)
the first time has a performance of 10.7MBps
after that each time has a performance of about 13.7MBps.

For method 2 (MemoryMapFile Method)
the first time has a performance of 1.3MBps
after that each time has a performance of about 253.9MBps

Obviously, with method 2, after the first time the file is read
through, all the file data are cached in file cache, after that all
access to the file has a dramatically fast speed. However, the
drawback is that the first time access performance compared to method
1 also dropped quite a lot, about 1/8 of the original speed.

It is quite beyond imagination that the first time performance using
memory map method deteriorate so much, even unacceptable.

I also set SYSGEN_CACHEFILT=1 to do the test, per my understanding of
CE6 file cache manager, setting this will make ReadFile method to do
similar thing like MemoryMap method. However the result don't make
much difference.

So I have the following 2 questions
1. What is the cause of MemoryMap method first time performance
deterioration?
2. Is it possible to make ReadFile method behave similar to
MemoryMapFile method? (i.e. default cache file content to file buffer
pool.)


Eric Sun

unread,
Jan 12, 2010, 3:42:52 AM1/12/10
to

Anyone give me some hint?

0 new messages