Skip to content

File truncation is slow on Windows  #127606

Open
@bobi6666

Description

@bobi6666

hello, I found that the std::fs::write function is quite slow when writing to the same file, I was very surprised why this is so and then I used open options and found that if I put truncate true then that was the cause of the slowdown and then I created a function where I changed the length of the file only at the end after writing, but only if the new length of the data was smaller than the original file size, and therefore I want to ask if it is possible to apply something like this in the std::fs::write method?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-filesystemArea: `std::fs`C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchT-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions