# Improve efficiency of buffered_reader\. \(\#21256\) · gitcafe/zig

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

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

Visibility: public

Requested revision: b19d0fb0fd3e4ff023968e77f01848ffb9dce360

Requested commit: b19d0fb0fd3e4ff023968e77f01848ffb9dce360

Commit: b19d0fb0fd3e4ff023968e77f01848ffb9dce360

Tree: 3b591d1f39f59a13377c6a17d5b9a891fd8b0add

Author: Lucas Santos

Committer: GitHub

## Message

```
Improve efficiency of buffered_reader. (#21256)

The previous implementation of buffered_reader always reads from the
unbuffered reader into the internal buffer, and then dumps the data onto
the destination. This is inefficient, as sometimes it's possible to read
directly into the destination. The previous strategy generates more
memory copies and unbuffered reads than necessary.
```

## Parents

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

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