Googles appar
Huvudmeny

Post a Comment On: cbloom rants

"01-30-09 - SetFileValidData and async writing"

5 Comments -

1 – 5 of 5
Anonymous Anonymous said...

Are you sure the hard drive can actually do more than 40MB/s?

February 1, 2009 at 12:17 PM

Anonymous Anonymous said...

SetFileInformationByHandle should do the same thing as NtSetInformationFile, unless I'm wrong or high.

Also, fragmentation might also be an issue even with setting the total size and the allocated size.

MSN

February 1, 2009 at 2:33 PM

Blogger cbloom said...

Yeah, SetFileInformationByHandle looks promising, but it's >= Vista only.

Fragmentation on NTFS is definitely like playing the lottery, but I have found that extending a file over and over with appends almost always gives you bad fragmentation because NTFS seems to be pretty greedy about putting the initial file chains in small portions of the disk free space, which means it can't do the append contiguously.

On the other hand if you do a big reserve up front, you at least have a hope of getting an unfragmented block (though it's not guaranteed).

In fact, I've started to just always reserve at least 1 MB for files I write, and then if I wind up writing them smaller, I just truncate them down. I haven't yet found a disadvantage to this.

February 1, 2009 at 3:57 PM

Anonymous Anonymous said...

It actually works on XP too, but you need to download http://www.microsoft.com/downloads/details.aspx?FamilyId=1DECC547-AB00-4963-A360-E4130EC079B8&displaylang=en

Profit!

MSN

February 2, 2009 at 10:07 AM

Blogger cbloom said...

Ah cool, that looks like just some wrappers to expose the undocumented internals.

February 2, 2009 at 12:21 PM

You can use some HTML tags, such as <b>, <i>, <a>

This blog does not allow anonymous comments.

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.