Skip to content

Avoid copying content when writing files #1551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dzbarsky
Copy link

A well-behaved FS implementation should not mutate the bytes to be written. (Also, it seems like many call sites already have an []byte and convert to a string just to call WriteFile)

@jakebailey
Copy link
Member

(Also, it seems like many call sites already have an []byte and convert to a string just to call WriteFile)

For fun, I went to try and refactor file writing to see if using []byte were possible all the way, but it is a lot of changes. Reading as strings is pretty intentional so things kinda bubble from there. But maybe it's possible.

It'd be interesting to see your benchmarks for your PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants