From: dengjianbo <dengjianbo@loongson.cn>
To: Xi Ruoyao <xry111@xry111.site>, libc-alpha@sourceware.org
Cc: adhemerval.zanella@linaro.org, caiyinyu@loongson.cn,
xuchenghua@loongson.cn, huangpei@loongson.cn
Subject: Re: [PATCH 1/4] LoongArch: Add ifunc support for strcpy{aligned, unaligned, lsx, lasx}
Date: Mon, 11 Sep 2023 17:53:26 +0800 [thread overview]
Message-ID: <1ce4cff2-72a5-06cc-ef64-904c3ec47e4f@loongson.cn> (raw)
In-Reply-To: <7246aa6f75703fd18f9a22e83d759dae1264797b.camel@xry111.site>
Tested strcpy-lasx comparing with strcpy(call stpcpy-lasx), the
difference between two timings are 0.28, strcpy-lasx takes less time.
When the length of data is less than 32, it could reduce the runtime
more than 30%.
See:
https://github.com/jiadengx/glibc_test/blob/main/bench/strcpy_lasx_compare_generic_strcpy.out
There are some duplicated code in strcpy from stpcpy, since the main
part is almost same. Maybe we can try to use one source code with
MARCO USE_AS_STPCPY to distinguish strcpy and stpcpy link x86_64? it
could avoid the performance degradation.
On 2023-09-08 22:22, Xi Ruoyao wrote:
> On Fri, 2023-09-08 at 17:33 +0800, dengjianbo wrote:
>> According to glibc strcpy microbenchmark test results(changed to use
>> generic_strcpy instead of strlen + memcpy), comparing with generic_strcpy,
>> this implementation could reduce the runtime as following:
>>
>> Name Percent of rutime reduced
>> strcpy-aligned 10%-45%
>> strcpy-unaligned 10%-49%, comparing with the aligned version,unaligned
>> version experience better performance in case src and dest
>> cannot be both aligned with 8bytes
>> strcpy-lsx 20%-80%
>> strcpy-lasx 15%-86%
> Generic strcpy calls stpcpy, so if we've optimized stpcpy maybe it's not
> necessary to duplicate everything in strcpy. Is there a benchmark
> result comparing the timing with and without this patch, but both with
> the second patch (optimized stpcpy)?
>
next prev parent reply other threads:[~2023-09-11 9:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 9:33 [PATCH 0/4] LoongArch: Add ifunc support for str{cpy, rchr}, dengjianbo
2023-09-08 9:33 ` [PATCH 1/4] LoongArch: Add ifunc support for strcpy{aligned, unaligned, lsx, lasx} dengjianbo
2023-09-08 14:22 ` Xi Ruoyao
2023-09-11 9:53 ` dengjianbo [this message]
2023-09-13 7:47 ` dengjianbo
2023-09-08 9:33 ` [PATCH 2/4] LoongArch: Add ifunc support for stpcpy{aligned, " dengjianbo
2023-09-08 9:33 ` [PATCH 3/4] LoongArch: Add ifunc support for strrchr{aligned, " dengjianbo
2023-09-08 9:33 ` [PATCH 4/4] LoongArch: Change to put magic number to .rodata section dengjianbo
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=1ce4cff2-72a5-06cc-ef64-904c3ec47e4f@loongson.cn \
--to=dengjianbo@loongson.cn \
--cc=adhemerval.zanella@linaro.org \
--cc=caiyinyu@loongson.cn \
--cc=huangpei@loongson.cn \
--cc=libc-alpha@sourceware.org \
--cc=xry111@xry111.site \
--cc=xuchenghua@loongson.cn \
/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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).