开发者

Is there any point implementing my own file cache in a Windows app?

开发者 https://www.devze.com 2023-02-09 19:01 出处:网络
I have a Delphi app that references a datafile of 28-byte records.The file is written sequentially but read randomly.The datafile is split into N physical files which are rolled over at 10 开发者_如何

I have a Delphi app that references a datafile of 28-byte records. The file is written sequentially but read randomly. The datafile is split into N physical files which are rolled over at 10 开发者_如何学运维megs or so to provide some insurance against disk problems, and because we are only ever writing to the most recent one, and I found it became slower and slower to write to if it were allowed to grow to big. On startup I read the entire file set and build an index so that I can quickly know which file to seek into given a virtual record number.

As part of the splitting into N files I implemented a read cache. I realise now that Windows does a fair amount of caching on it's own, and I wonder if I'm gaining anything by sticking another cache between myself and the disk files.

Any thoughts appreciated.


No. Use file mappings to use the existing file cache more efficiently.

0

精彩评论

暂无评论...
验证码 换一张
取 消