1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:27:45 +00:00

cat: Use a 32 KB I/O buffer here to improve "cat a > b" scenario

This is roughly twice as fast as the old 4 KB buffer size. We still
don't go nearly as fast as "cp", since we don't ftruncate() up front
like "cp" does.
This commit is contained in:
Andreas Kling 2019-11-03 00:09:17 +01:00
parent be19606501
commit ddd8332015

View file

@ -24,7 +24,7 @@ int main(int argc, char** argv)
} }
for (auto& fd : fds) { for (auto& fd : fds) {
for (;;) { for (;;) {
char buf[4096]; char buf[32768];
ssize_t nread = read(fd, buf, sizeof(buf)); ssize_t nread = read(fd, buf, sizeof(buf));
if (nread == 0) if (nread == 0)
break; break;