summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig A. Berry <craigberry@mac.com>2011-02-17 14:24:39 -0600
committerCraig A. Berry <craigberry@mac.com>2011-02-17 15:50:18 -0600
commitb83080de5c42543809ce9004bcdbcd3162a00e70 (patch)
tree3bb044a972f44b6f7b992f1209661868a63947b4
parentc22d665b55f24cd837419195a9ef11b09877c9cf (diff)
downloadperl-b83080de5c42543809ce9004bcdbcd3162a00e70.tar.gz
Increase PERLIOBUF_DEFAULT_BUFSIZ to larger of 8192 and BUFSIZ.
The previous default size of a PerlIO buffer (4096 bytes) was chosen many years ago before PerlIO was even the default I/O scheme for Perl. Benchmarks show that doubling this decade-old default increases read and write performance in the neighborhood of 25% to 50% when using the default layers of perlio on top of unix. The only situation without a noticeable performance benefit so far appears to be when physical I/O is so slow that it dwarfs any savings from the reduction in layer shuffling, but there is also no performance penalty in this case. BUFSIZ will be chosen in the unlikely event that it's larger than 8192 on the assumption that the system maintainers would not set such a value without good reason. If the new size causes problems, or to try an even bigger size, configure with: ./Configure -Accflags=-DPERLIOBUF_DEFAULT_BUFSIZ=N where N is the desired size in bytes; it should probably be a multiple of your page size.
-rw-r--r--perlio.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/perlio.h b/perlio.h
index 479a44f496..0575cb17bd 100644
--- a/perlio.h
+++ b/perlio.h
@@ -191,7 +191,7 @@ PERL_EXPORT_C void PerlIO_clone(pTHX_ PerlInterpreter *proto,
/* The default buffer size for the perlio buffering layer */
#ifndef PERLIOBUF_DEFAULT_BUFSIZ
-#define PERLIOBUF_DEFAULT_BUFSIZ 4096
+#define PERLIOBUF_DEFAULT_BUFSIZ (BUFSIZ > 8192 ? BUFSIZ : 8192)
#endif
#ifndef SEEK_SET