diff options
author | Leonhard Holz <leonhard.holz@web.de> | 2015-06-22 07:53:09 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2015-06-22 07:53:09 +0530 |
commit | ef635a29f7123f25ee0600b7a6aca1c511c63e85 (patch) | |
tree | e509ae02011879deda5c2a011722db8c0ccbbe95 | |
parent | f48b67323ad6a6d8f0c2f4128c07392a9a01c20b (diff) | |
download | glibc-ef635a29f7123f25ee0600b7a6aca1c511c63e85.tar.gz glibc-ef635a29f7123f25ee0600b7a6aca1c511c63e85.tar.xz glibc-ef635a29f7123f25ee0600b7a6aca1c511c63e85.zip |
remove unnecessary memset in strcoll
This patch avoids some initialization overhead in the hot path of strcoll by replacing a memset with zero assignments. It improves the file listing benchmark by 15% on x86. Tests are ok. filelist#C -1.30% filelist#en_US.UTF-8 -15.08% lorem_ipsum#vi_VN.UTF-8 -15.04% lorem_ipsum#ar_SA.UTF-8 -11.83% lorem_ipsum#en_US.UTF-8 -9.66% lorem_ipsum#zh_CN.UTF-8 -8.63% lorem_ipsum#cs_CZ.UTF-8 -8.28% lorem_ipsum#en_GB.UTF-8 -18.07% lorem_ipsum#da_DK.UTF-8 -11.13% lorem_ipsum#pl_PL.UTF-8 -15.31% lorem_ipsum#fr_FR.UTF-8 -12.26% lorem_ipsum#pt_PT.UTF-8 -10.64% lorem_ipsum#el_GR.UTF-8 -8.19% lorem_ipsum#ru_RU.UTF-8 -0.65% lorem_ipsum#iw_IL.UTF-8 -14.92% lorem_ipsum#es_ES.UTF-8 -11.47% lorem_ipsum#hi_IN.UTF-8 -1.05% lorem_ipsum#sv_SE.UTF-8 6.44% lorem_ipsum#hu_HU.UTF-8 -9.85% lorem_ipsum#tr_TR.UTF-8 -14.96% lorem_ipsum#is_IS.UTF-8 -10.35% lorem_ipsum#it_IT.UTF-8 -11.33% lorem_ipsum#sr_RS.UTF-8 -9.88% lorem_ipsum#ja_JP.UTF-8 -3.23% * string/strcoll_l.c (STRCOLL): Remove unnecessary memset.
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | string/strcoll_l.c | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index 7b9ab6a643..1150ec5d2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2015-06-22 Leonhard Holz <leonhard.holz@web.de> + * string/strcoll_l.c (STRCOLL): Remove unnecessary memset. + * string/strcoll_l.c: Remove unused struct element idxnow. 2015-06-21 Joseph Myers <joseph@codesourcery.com> diff --git a/string/strcoll_l.c b/string/strcoll_l.c index 967bbba231..8f1225fc7a 100644 --- a/string/strcoll_l.c +++ b/string/strcoll_l.c @@ -315,8 +315,11 @@ STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, __locale_t l) int result = 0, rule = 0; coll_seq seq1, seq2; - memset (&seq1, 0, sizeof (seq1)); - seq2 = seq1; + seq1.len = 0; + seq1.idxmax = 0; + seq1.rule = 0; + seq2.len = 0; + seq2.idxmax = 0; for (int pass = 0; pass < nrules; ++pass) { |