2010年10月11日 星期一

Fstream read performance issue on WinCE

I meet this issue when develop a window mobile application which needs huge file IO operations on our company's handheld device. Until now, I still don't know this issue cause by official windows mobile STD library or our company's OS image only.

The target application randomly read binary files like a RO-database. I using STD ofstream API to read data from file and found the performance was badly. I try to debug this performance issue on that application and found that the root cause is fstream API.

I made a 100MB dummy file and one simple application to read the file sequentially (a for-loop), the total ready time using fstream is almost ten times of another one using fopen/fread interface.

I am lazy to test the same behavior on other company's device (actually, I don't have other device….), so I just re-write the code to use fread() API and the problem solved.

PS. I got the same behavior on two models of our company's handheld device, and they are use Window Mobile 6.1 system.

沒有留言:

張貼留言