lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 25 Oct 2022 23:27:55 +0000
From:   Nathan Moinvaziri <nathan@...hanm.com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Andy Shevchenko <andy@...nel.org>
Subject: Re: [PATCH] lib/string.c: Improve strcasecmp speed by not lowering if
 chars match

On 10/25/2022 12:32 PM, Christophe JAILLET wrote:
> Hi,
> the algorithm on github is not the same as the one posted here.
>
> IIUC, the one on github is wrong. If you compare 2 strings that are 
> the same, they will have the same length, and "if (c1 == c2) 
> continue;" will go one past the end of the strings. And the result 
> will be <0 or 0 or >0 depending the the char *after* the trailing \0.
>
> On the other side, the results of the benchmark on github are likely 
> not accurate with the algorithm posted here, because there is one more 
> test in each loop ("while (c1 != 0)") as long as the 2 strings are the 
> same.
> On github this test is skipped because you will go through the "continue"
>
> CJ 

Hi CJ,

Thanks for catching that, I had changed it at the last second. I have 
updated the code and the benchmarks to what I initially proposed in the 
patch. Results are about +/-1% from previously.

Nathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ