about summary refs log tree commit homepage
path: root/lib/PublicInbox/View.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-09 12:03:35 +0000
committerEric Wong <e@80x24.org>2021-10-09 21:31:07 +0000
commit394af1500d35c14883d9037b5776687a0a882f35 (patch)
tree99f01c4e12f960915140ce2658675a456aca71df /lib/PublicInbox/View.pm
parentf37219b70b5ab83cd7740c4d533f1cf7e5049946 (diff)
downloadpublic-inbox-394af1500d35c14883d9037b5776687a0a882f35.tar.gz
By using syswrite to populate env->{psgi.input}.  The substr()
call IO::Handle->write will trigger Perl's target/scratchpad and
result in a permanent allocation.  Since this is a cold path,
that allocation is pointless, and syswrite() can already write a
substring.

Allowing Perl to cache a large allocation in a cold path only
result in fragmentation and wasted RAM.

write(2) on a regular file won't result in short writes
unless the FS quotas or free space limits are hit, or the buffer
is close to overflowing (e.g. the 0x7ffff000-byte Linux limit).
Since our HTTP server will never buffer that much in RAM,
there's no need to retry syswrite nor rely on the retrying
implicit in IO::Handle->write and the "print" perlop.
Diffstat (limited to 'lib/PublicInbox/View.pm')
0 files changed, 0 insertions, 0 deletions