# zig fmt: avoid unnecessary file system access · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/64dfd1883eb2b9ab175af9b07c84bd4b53b7e904)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 64dfd1883eb2b9ab175af9b07c84bd4b53b7e904

Requested commit: 64dfd1883eb2b9ab175af9b07c84bd4b53b7e904

Commit: 64dfd1883eb2b9ab175af9b07c84bd4b53b7e904

Tree: 468d8404da72474318a8abb166238b0b0b572436

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
zig fmt: avoid unnecessary file system access

zig fmt previously would write a temp file, and then either rename it
into place if necessary, or unlink it if nothing was changed. Now zig
fmt renders into a memory buffer, and only writes the temp file and
renames it into place if anything changed.

Based on the performance testing I did this actually did not have much
of an impact, however it's likely that on other operating systems and
other hard drives this could make a big difference.

```

## Parents

- [0a9672fb86b84658f8780f57e769be45e41f3034](https://git.cafe/gitcafe/zig/commit/0a9672fb86b84658f8780f57e769be45e41f3034?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/64dfd1883eb2b9ab175af9b07c84bd4b53b7e904?format=markdown)
