<feed xmlns='http://www.w3.org/2005/Atom'>
<title>coreutils/src/wc.c, branch v9.0</title>
<subtitle>Mirror of https://https.git.savannah.gnu.org/git/coreutils.git/
</subtitle>
<id>https://git.shady.money/coreutils/atom?h=v9.0</id>
<link rel='self' href='https://git.shady.money/coreutils/atom?h=v9.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/'/>
<updated>2021-09-15T22:08:28Z</updated>
<entry>
<title>maint: prefer rawmemchr to memchr when easy</title>
<updated>2021-09-15T22:08:28Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2021-09-15T21:09:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=2715aba08a381a6099c1c6b054995e6b3df785c8'/>
<id>urn:sha1:2715aba08a381a6099c1c6b054995e6b3df785c8</id>
<content type='text'>
* bootstrap.conf (gnulib_modules): Add rawmemchr.
* src/csplit.c: Include idx.h.
* src/csplit.c (record_line_starts):
* src/head.c (elide_tail_lines_pipe):
* src/shuf.c (next_line):
* src/split.c (lines_split):
* src/tail.c (pipe_lines):
* src/wc.c (wc_lines):
Prefer rawmemchr to memchr when rawmemchr is easy.
* src/csplit.c (load_buffer):
* src/head.c (struct linebuffer):
Make room for a 1-byte sentinel.
</content>
</entry>
<entry>
<title>wc: add --debug to diagnose which implementation used</title>
<updated>2021-05-02T19:51:37Z</updated>
<author>
<name>Pádraig Brady</name>
<email>P@draigBrady.com</email>
</author>
<published>2021-05-01T19:02:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=e7fff54c92477a9f114b3f482b4f81a66144633e'/>
<id>urn:sha1:e7fff54c92477a9f114b3f482b4f81a66144633e</id>
<content type='text'>
* src/wc.c: (main): Handle the new --debug option.
Only call avx2_supported if needed.
(avx2_supported): Diagnose various failures and attempts.
* NEWS: Mention the new wc improvement and --debug option.
</content>
</entry>
<entry>
<title>wc: use avx2 optimization when counting only lines</title>
<updated>2021-05-02T19:51:37Z</updated>
<author>
<name>Kristoffer Brånemyr</name>
<email>ztion1@yahoo.se</email>
</author>
<published>2021-02-20T11:27:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=4064c57380621399b54217a64c2c2bed1d0dccd1'/>
<id>urn:sha1:4064c57380621399b54217a64c2c2bed1d0dccd1</id>
<content type='text'>
Use cpuid to detect CPU support for avx2 instructions.
Performance was seen to improve by 5x for a file with only newlines,
while the performance for a file with no such characters is unchanged.

* configure.ac [USE_AVX2_WC_LINECOUNT]: A new conditional,
set when __get_cpuid_count() and avx2 compiler intrinsics are supported.
* src/wc.c (avx2_supported): A new function using __get_cpuid_count()
to determine if avx2 instructions are supported.
(wc_lines): A new function refactored from wc(),
which implements the standard line counting logic,
and provides the fallback implementation for when avx2 is not supported.
* src/wc_avx2.c: A new module to implement using avx2 intrinsics.
* src/local.mk: Reference the new module.  Note we build as a separate
lib so that it can be portably built with separate -mavx2 etc. flags.
</content>
</entry>
<entry>
<title>doc: clarify what's counted by wc</title>
<updated>2021-04-11T18:23:13Z</updated>
<author>
<name>Pádraig Brady</name>
<email>P@draigBrady.com</email>
</author>
<published>2021-04-11T15:24:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=512fe0490254aaa3cb679237dafe9cc1bb7cd3ea'/>
<id>urn:sha1:512fe0490254aaa3cb679237dafe9cc1bb7cd3ea</id>
<content type='text'>
* src/wc.c (usage): State that only printable characters are considered
when counting words.  This also disambiguates wether we're talking
about bytes or characters in this context.
* doc/coreutils.texi (wc invocation): Likewise.  Also clarify
that --characters counts valid locale aware characters,
and that --lines does not count a trailing "line" unless
it ends with a newline character.
Fixes https://bugs.gnu.org/47702
</content>
</entry>
<entry>
<title>maint: use "char const *" rather than "const char *"</title>
<updated>2021-04-11T17:33:45Z</updated>
<author>
<name>Pádraig Brady</name>
<email>P@draigBrady.com</email>
</author>
<published>2021-04-11T17:23:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=ef772bf97f7ec577754cbb5b278504d83cf41a43'/>
<id>urn:sha1:ef772bf97f7ec577754cbb5b278504d83cf41a43</id>
<content type='text'>
* cfg.mk (sc_prohibit-const-char): Add a new syntax-check to
enforce this style.
* *.[ch]: sed -i 's/const char \*/char const */g'
</content>
</entry>
<entry>
<title>maint: update all copyright year number ranges</title>
<updated>2021-01-01T16:36:09Z</updated>
<author>
<name>Pádraig Brady</name>
<email>P@draigBrady.com</email>
</author>
<published>2021-01-01T16:36:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=32ff1d1313ff566685b9092ac929251a4c22e7c4'/>
<id>urn:sha1:32ff1d1313ff566685b9092ac929251a4c22e7c4</id>
<content type='text'>
Run "make update-copyright" and then...

* gnulib: Update to latest with copyright year adjusted.
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
* tests/sample-test: Adjust to use the single most recent year.
</content>
</entry>
<entry>
<title>maint: update all copyright year number ranges</title>
<updated>2020-01-01T14:16:56Z</updated>
<author>
<name>Pádraig Brady</name>
<email>P@draigBrady.com</email>
</author>
<published>2020-01-01T14:16:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=aaba82431ceca97441d56152d8c7ec2d84fa1d12'/>
<id>urn:sha1:aaba82431ceca97441d56152d8c7ec2d84fa1d12</id>
<content type='text'>
Run "make update-copyright" and then...

* gnulib: Update to latest with copyright year adjusted.
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
* tests/sample-test: Adjust to use the single most recent year.
</content>
</entry>
<entry>
<title>wc: treat non breaking space as a word separator</title>
<updated>2019-02-26T06:49:44Z</updated>
<author>
<name>Pádraig Brady</name>
<email>P@draigBrady.com</email>
</author>
<published>2019-02-24T05:23:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=a5202bd58531923ea9f93cc35ddeec5e3a8e0189'/>
<id>urn:sha1:a5202bd58531923ea9f93cc35ddeec5e3a8e0189</id>
<content type='text'>
* src/wc.c (iswnbspace): A new function to match
characters in this class.
(isnbspace): Likewise for single byte charsets.
(main): Initialize posixly_correct from the environment,
to allow disabling honoring NBSP in non C locales.
(wc): Call is[w]nbspace() along with is[w]space.
* bootstrap.conf: Ensure btowc is available.
* tests/misc/wc-nbsp.sh: A new test.
* tests/local.mk: Reference the new test.
* NEWS: Mention the change in behavior.
</content>
</entry>
<entry>
<title>maint: update all copyright year number ranges</title>
<updated>2019-01-01T23:51:48Z</updated>
<author>
<name>Assaf Gordon</name>
<email>assafgordon@gmail.com</email>
</author>
<published>2019-01-01T23:50:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=8dfcf38af1280c34d7c02b1bbed151368f6de211'/>
<id>urn:sha1:8dfcf38af1280c34d7c02b1bbed151368f6de211</id>
<content type='text'>
Run "make update-copyright" and then...

* gnulib: Update to latest with copyright year adjusted.
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
* tests/sample-test: Adjust to use the single most recent year.
</content>
</entry>
<entry>
<title>wc: optimize processing of ASCII in multi byte locales</title>
<updated>2018-06-21T04:00:39Z</updated>
<author>
<name>Pádraig Brady</name>
<email>P@draigBrady.com</email>
</author>
<published>2018-05-18T04:41:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/coreutils/commit/?id=77517a99179b728c6369341b0d36568bac5d7914'/>
<id>urn:sha1:77517a99179b728c6369341b0d36568bac5d7914</id>
<content type='text'>
===== Benchmark setup (on GNU/Linux) ====
$ yes áááááááááááááááááááá | head -n100000 &gt; mbc.txt
$ yes 12345678901234567890 | head -n100000 &gt; num.txt

===== Before ====
$ time src/wc -Lm &lt; mbc.txt
real    0m0.186s
$ time src/wc -m &lt; mbc.txt
real    0m0.186s
$ time src/wc -Lm &lt; num.txt
real    0m0.055s
$ time src/wc -m &lt; num.txt
real    0m0.056s

==== After ====
$ time src/wc -Lm &lt; mbc.txt
real    0m0.196s
$ time src/wc -m &lt; mbc.txt
real    0m0.173s
$ time src/wc -Lm &lt; num.txt
real    0m0.031s
$ time src/wc -m &lt; num.txt
real    0m0.028s

* src/wc.c (wc): Only call wide variant functions like
iswprint() and wcwidth() for non is_basic() characters.
I.E. non ISO C "basic character set" characters.
This is especially significant on OSX where wcwidth()
is very expensive (about 10x in tests).
* NEWS: Mention the improvement.
Suggested by Eric Fischer.
</content>
</entry>
</feed>
