PowerDNS / pdns

PowerDNS Authoritative, PowerDNS Recursor, dnsdist
https://www.powerdns.com/
GNU General Public License v2.0
3.63k stars 904 forks source link

Consider replacing strcasecmp calls #11657

Open rgacogne opened 2 years ago

rgacogne commented 2 years ago

Short description

Otto raised the fact that strcasecmp() is locale dependent and that it could lead to performance issues, in the comments of #11624. We should investigate how we can replace it to avoid any surprises.

omoerbeek commented 2 years ago

cf. https://daniel.haxx.se/blog/2022/05/19/case-insensitive-string-comparisons-in-c/

rgacogne commented 2 years ago

Right, so it looks like strcasecmp can be slower with some locales because it is heavily optimized in some cases? Then we likely need to make sure that our version is not just slow in all cases ;)

omoerbeek commented 2 years ago

Or use OpenBSD :-)

     On OpenBSD, these functions always use the C locale and ignore the global
     locale, the thread-specific locale, and the locale argument.