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

"SetFilePointer()" is slow?

164 views
Skip to first unread message

Carey Gregory

unread,
Apr 5, 2004, 11:24:51 AM4/5/04
to
"pango" <anon...@discussions.microsoft.com> wrote:

>I use "SetFilePointer()" to read different parts of a file,but I heard calling "SetFilePointer()" frequently could drop down the throughput of read operation,is it true?Should I buffered a large area of a file,and read data from that buffer?

It's "slow" because moving the current position in a file defeats caching.
It's unlikely that reading large areas of the file would be faster unless
you can predict in advance where the next read will occur.

--
Carey Gregory
Windows Print Drivers & Components
http://www.gw-tech.com

pango

unread,
Apr 5, 2004, 11:01:08 PM4/5/04
to


----- Carey Gregory wrote: -----


If I open a file with no catching(add FILE_FLAG_NO_BUFFERING),then how the performance of "SetFilePointer()"?

Carey Gregory

unread,
Apr 6, 2004, 11:56:35 AM4/6/04
to
"pango" <anon...@discussions.microsoft.com> wrote:

>If I open a file with no catching(add FILE_FLAG_NO_BUFFERING),then
>how the performance of "SetFilePointer()"?

It probably doesn't make much difference to SetFilePointer itself.
Disabling caching can maximize async performance with overlapped I/O, but
for *most* applications it will significantly degrade read/write
performance. It also imposes a heavy price on the application which now
has to align all I/O operations on sector size boundaries.

Writing a simple program you can experiment with to measure I/O
performance would be pretty easy. Why not do that?

0 new messages