Reserve disk space before writing a file for efficiency

前端 未结 6 710
情书的邮戳
情书的邮戳 2020-12-14 19:42

I have noticed a huge performance hit in one of my projects when logging is enabled for the first time. But when the log file limit is reached and the program starts writing

6条回答
  •  轮回少年
    2020-12-14 20:04

    You can use the SetFileValidData function to extend the logical length of a file without having to write out all that data to disk. However, because it can allow to read disk data to which you may not otherwise have been privileged, it requires the SE_MANAGE_VOLUME_NAME privilege to use. Carefully read the Remarks section of the documentation.

    Also implementation of SetFileValidData depend on fs driver. NTFS support it and FAT only since Win7.

提交回复
热议问题