Increase ReadFdToString buffer size
Reduces syscall overhead for large files. For 4k+ files, this can
improve performance 2x. For smaller files, it seems neutral.
debuggerd_benchmark showed 4% improvement, but it was a bit noisy, so
not high confidence.
Test: TH
Change-Id: Ibc4ddc4de0431926e161af9061f61023e0d1f21e
diff --git a/file.cpp b/file.cpp
index 1bdcbb9..69ee69f 100644
--- a/file.cpp
+++ b/file.cpp
@@ -226,7 +226,7 @@
content->reserve(sb.st_size);
}
- char buf[BUFSIZ] __attribute__((__uninitialized__));
+ char buf[4096] __attribute__((__uninitialized__));
ssize_t n;
while ((n = TEMP_FAILURE_RETRY(read(fd.get(), &buf[0], sizeof(buf)))) > 0) {
content->append(buf, n);