freebsd-src/bin
Hiroki Sato be860ca2a7 Improve performance of "read" built-in command when using a seekable
fd.

The read built-in command calls read(2) with a 1-byte buffer because
newline characters need to be detected even on a byte stream which
comes from a non-seekable file descriptor.  Because of this, the
following script calls >6,000 read(2) to show a 6KiB file:

 while read IN; do echo "$IN"; done < /COPYRIGHT

When the input byte stream is seekable, it is possible to read a data
block and then reposition the file pointer to where a newline
character found.  This change adds a small buffer to do this and
reduces the number of read(2) calls.

Theoretically, multiple built-in commands reading the same seekable
byte stream in a single pipe chain can share the buffer.  However,
this change just makes a single invocation of the read built-in
allocate a buffer and deallocate it every time for simplicity.
Although this causes read(2) to read the same regions multiple times,
the performance penalty should be small compared to the reduction of
read(2) calls.

Reviewed by:		jilles
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D23747
2020-02-20 03:01:27 +00:00
..
cat Allow building bin/cat on non-FreeBSD systems 2020-01-16 14:15:00 +00:00
chflags Add an example to the chflags(1) man page. 2018-06-12 16:44:13 +00:00
chio DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
chmod Correct wording around '-' masks. 2019-03-09 00:30:13 +00:00
cp General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
csh Fix .depend files to work for build tools. 2019-06-15 17:08:13 +00:00
date Restore the -n flag parsing, but ignore it. 2019-04-24 05:24:10 +00:00
dd Add iflag=fullblock to dd 2019-09-30 22:00:48 +00:00
df Add a deprecation warning when using the feature which mounts devices 2018-02-10 00:22:25 +00:00
domainname General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
echo Convert cap_enter() < 0 && errno != ENOSYS to caph_enter() < 0. 2018-06-19 23:43:14 +00:00
ed Drop ed(1) "crypto" 2018-11-04 17:56:16 +00:00
expr expr(1): Fix overflow detection when operand is INTMAX_MIN 2018-04-14 04:35:10 +00:00
freebsd-version Convert freebsd-version to using -v 2019-05-23 17:19:00 +00:00
getfacl Avoid copying a struct stat for acl_from_stat() calls. 2018-11-01 17:45:29 +00:00
hostname General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
kenv Fix mandoc -Tlint warnings in bin/ 2017-12-07 01:57:27 +00:00
kill General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
ln General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
ls Update Makefile.depend files 2019-12-11 17:37:53 +00:00
mkdir General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
mv General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
pax Add a note that the use of -B option does not guarantee a size of fragment 2018-12-29 23:08:59 +00:00
pkill Clarify that /dev/kmem is not used. 2018-12-03 20:01:51 +00:00
ps ps(1): Pet mandoc and igor 2018-10-31 17:47:08 +00:00
pwait Remove unused include. 2020-02-02 20:51:28 +00:00
pwd pwd: mark usage as dead 2018-06-17 05:14:50 +00:00
realpath General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
rm rm(1): Formalize non-functional status of -P flag 2018-11-10 20:26:55 +00:00
rmail DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
rmdir General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
setfacl Don't set NFSv4 ACL inheritance flags on non-directories. 2018-10-26 21:17:06 +00:00
sh Improve performance of "read" built-in command when using a seekable 2020-02-20 03:01:27 +00:00
sleep Convert cap_enter() < 0 && errno != ENOSYS to caph_enter() < 0. 2018-06-19 23:43:14 +00:00
stty Some devices take undesired actions when RTS and DTR are 2019-06-12 18:07:04 +00:00
sync DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
test DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
tests Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
uuidgen pkgbase: Create a FreeBSD-utilities package and make it the default one 2019-09-05 14:15:47 +00:00
Makefile Remove rcmds. 2017-10-06 08:43:14 +00:00
Makefile.inc Use src.opts.mk in preference to bsd.own.mk except where we need stuff 2014-05-06 04:22:01 +00:00