From: "A. Wilcox" <awilfox@adelielinux.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH] towupper/towlower: fast path for ascii chars
Date: Tue, 30 May 2017 22:04:46 -0500 [thread overview]
Message-ID: <592E32CE.3030908@adelielinux.org> (raw)
In-Reply-To: <20170530122324.23733-1-ncopa@alpinelinux.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On 30/05/17 07:23, Natanael Copa wrote:
> Make a fast path for ascii chars which is assumed to be the most
> common case. This has significant performance benefit on xml json
> and similar
I'm not sure if that would be the common case when you are already
dealing with wide chars. I would assume you're using wide chars for a
reason...
> { - return __towcase(wc, 0); + return (unsigned)wc < 128 ?
> toupper(wc) : __towcase(wc, 0); }
>
> wint_t towlower(wint_t wc) { - return __towcase(wc, 1); + return
> (unsigned)wc < 128 ? tolower(wc) : __towcase(wc, 1); }
...so I would likely do something like:
return (unsigned)wc > 127 ? __towcase(wc, 1) : tolower(wc);
I think it comes down to silly style though. Functionally it is
likely similar / the same.
Would be curious to see if there is any difference on other loads (and
on other architectures).
- --arw
- --
A. Wilcox (awilfox)
Project Lead, Adélie Linux
http://adelielinux.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJZLjKRAAoJEMspy1GSK50UfPMQAI9WHwH2TRHfRBmC9F9dRRqR
c0wTMC0IkaI9iD7xrdpG9lq6EhHelNbC94bIUFtHY5Eao4Vf6SJUv7b+o+OEHGs0
11PmDSvciHZx4vQb64rQJte8u6s3Z++POMpsLKULS4Gi63xLCtaCKB8yp4/eKezL
5cBqxCIXz+TlCpS/7TQxyYjwCA8C13Utd/2GmU4/9cCkdDOHJ5asg3sfFS4MtVPS
tSSunDgDgn0b3b0nLD0q4PiymRZ0cpGj2MKLWCR2WPdBkMitjegNm4wYcJE6naWH
ao4Fp26McviszvQvxlWzidpiDAq6kxU6jwHylV/VniseqcG5XBDDyG/MrzzMDlKr
lyNGQg6xXAcVvIujZBJYJYrgL1oDEpQ6c+JS4aD4gcM0WIn8YM9K5PQPKbcwrsqo
2sDKY51UTT3SDoghtj7ZkqgBMbQLmEE5lyom3B7EtcQazKj9pWtTmCy8kI+cMQcT
WPYurl67aEg54WW1oGChKza6P1WyuWTL27TL4NVOsVMyCqSa2ekF7rJTBP7rey9r
hNuFz14/tKyZTA1Mq3RWtN15ydsC+ToLbZikYqEmmBq36p2J1BbeWznfRRw6dpyt
G1sz70FtTBtODAK1xVngsUsYVPINgNhaQlQKs96NSiQzU0khY2or9kbYWPm0GyS8
fPerUQTvKecXmUYd2OVk
=pfgv
-----END PGP SIGNATURE-----
prev parent reply other threads:[~2017-05-31 3:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-25 18:01 towlower performance maksis .
2017-05-27 0:39 ` Andre McCurdy
2017-05-27 0:59 ` Rich Felker
2017-05-30 12:23 ` [PATCH] towupper/towlower: fast path for ascii chars Natanael Copa
2017-05-31 3:04 ` A. Wilcox [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=592E32CE.3030908@adelielinux.org \
--to=awilfox@adelielinux.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).