Repository navigation
uucore: only honour the last glibc.cpu.hwcaps setting, case-sensitively - #14844
Conversation
691fd91 to
30b1591
Compare
30b1591 to
5efa89e
Compare
Merging this PR will degrade performance by 46.81%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
|
GNU testsuite comparison: |
5efa89e to
73be728
Compare
fd203e9 to
145840b
Compare
82f5c14 to
4d4f267
Compare
I think this is a false positive. I don't think the change touched any of these failed performance tests. |
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
4d4f267 to
63026b3
Compare
Summary
This work was a regression fix in some local work for #14805, but I think it's clearer to split it out.
GLIBC_TUNABLES=glibc.cpu.hwcaps=-NAME,...is how a user tells glibc, GNUcksum/wcand uutils to stop using a CPU feature. uutils read it more loosely than GNU: it upper-cased names, trimmed whitespace around them, and merged everyglibc.cpu.hwcaps=setting instead of keeping the last one. Strings that GNU ignores therefore madewcandcksumfall back to slower paths.This PR makes the parser read the variable the way GNU does: names are case-sensitive, a name is the whole token, and when the tunable is set more than once only the last setting counts. Leading whitespace before a setting name or a token is still accepted, as GNU accepts it (glibc itself is stricter there). One unit test per rule.
Examples (x86-64 with AVX2; only the avx2 line of the
--debugoutput is shown)Lower-case name: GNU compares names byte for byte, so
-avx2disables nothing.Before:
After, same as GNU:
Tunable set twice: only the last
glibc.cpu.hwcaps=counts, so AVX2 stays enabled.Before:
After, same as GNU:
Trailing space: the name is the whole token, so
AVX2does not matchAVX2.$ GLIBC_TUNABLES='glibc.cpu.hwcaps=-AVX2 ' cksum --debug /dev/nullBefore:
After, same as GNU:
The same parser drives
wc's SIMD selection, sowcwas dropping to its scalar byte counter on the same inputs. Well-formed inputs such asglibc.cpu.hwcaps=-AVX2behave exactly as before.