Skip to content

Clean up CreateFile loop in ReadUTF8File #11753

@DHowett

Description

@DHowett

ReadUTF8File in the Settings library tries three times to read the settings file. If the size changes while it is being read, it'll try again.

Right now, the code looks like this (roughly):

while(tries) {
    open
    check permissions
    read in full
    check read size
}

It's expensive to open the file and check the permissions every time. Instead, we could:

open
check permissions
while (tries) {
    reset file pointer
    read in full
    check read size
}

That'll save us closing/reopening the file up to three times.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-CodeHealthIssues related to code cleanliness, linting, rules, warnings, errors, static analysis, etc.Area-SettingsIssues related to settings and customizability, for console or terminalIssue-TaskIt's a feature request, but it doesn't really need a major design.Product-TerminalThe new Windows Terminal.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions