mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Port cksum builtin performance improvements from illumos (#391)
This commit ports performance optimizations from illumos for the libsum
code (used by the cksum and sum builtins):
98bea71f0d
The new codepath in libsum uses prefetching and loop unrolling to
improve performance (prefetching is done with __builtin_prefetch()
or sun_prefetch_read_many() if either is available).
Script for testing (note that cksum must be enabled in
src/cmd/ksh93/data/builtins.c):
#!/bin/ksh
builtin cksum || exit 1
for ((i=0; i!=50000; i++)) do
cksum -x att /etc/hosts
done >/dev/null
Results on Linux x86_64 (using CCFLAGS=-O2):
$ echo 'UNPATCHED:'; time arch/linux.i386-64/bin/ksh /tmp/foo; echo 'PATCHED'; time /tmp/ksh /tmp/foo
UNPATCHED:
real 0m09.989s
user 0m07.582s
sys 0m02.406s
PATCHED:
real 0m06.536s
user 0m04.331s
sys 0m02.204s
src/lib/libsum/{sum-att.c,sum-crc.c,Mamfile}:
- Port the performance optimizations from illumos to 93u+m libsum. To
prevent problems with older versions of GCC, avoid the new codepath
if GCC is older than the 3.1 release series. Additionally, the ast.h
header must be included to handle tcc defining __GNUC__ on FreeBSD.
- Apply some build fixes to allow the new codepath to build with Clang
3.6 and newer (my own testing indicates an even better performance
improvement with Clang than with GCC).
This commit is contained in:
parent
8f9d1bec97
commit
4032050249
4 changed files with 236 additions and 9 deletions
4
NEWS
4
NEWS
|
|
@ -14,6 +14,10 @@ Any uppercase BUG_* names are modernish shell bug IDs.
|
|||
Note that to use these options the operating system must support the
|
||||
corresponding resource limit.
|
||||
|
||||
- Ported performance optimizations from illumos to improve the performance
|
||||
of the cksum builtin. (Note that the cksum builtin is not enabled by
|
||||
default.)
|
||||
|
||||
2021-12-27:
|
||||
|
||||
- Two bash-like flags for 'whence' were backported from ksh 93v-:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue