public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
To: "Zhangxuelei (Derek)" <zhangxuelei4@huawei.com>,
	Yikun Jiang <yikunkero@gmail.com>
Cc: "libc-alpha@sourceware.org" <libc-alpha@sourceware.org>,
	nd <nd@arm.com>, Siddhesh Poyarekar <siddhesh@gotplt.org>,
	jiangyikun <jiangyikun@huawei.com>,
	Szabolcs Nagy <Szabolcs.Nagy@arm.com>
Subject: Re: [PATCH v2 2/2] aarch64: Optimized memcpy and memmove for Kunpeng processor
Date: Tue, 29 Oct 2019 14:34:00 -0000	[thread overview]
Message-ID: <VI1PR0801MB2127A81CAEA89A23AE97791583680@VI1PR0801MB2127.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <8DC571DDDE171B4094D3D33E9685917BD87078@DGGEMI529-MBX.china.huawei.com>

Hi Derek,

>> Note that memchr_strlen significantly outperforms the fastest strlen
>> on sizes larger than 256, so I don't think that using uminv to test
>> for zeroes is the fastest approach.
>
> Indeedly, but memchr_strlen really has poor performance before 256 bytes,

Well that means memchr can be sped up for small sizes. While it is more
complex than strlen, it shouldn't be significantly slower.

> and if we mix this method into current version, we may need a length count
> and judge it more than 256 bytes or not in each loop, is this way cheap?

That may be possible, eg. by unrolling the first 64-128 bytes and using a loop
optimized for throughput for anything larger (on the assumption that if a
string is larger than 128, it is likely much larger).

However my point was that while the uminv sequence is simple and small, it's not
the fastest, so ultimately we need to find an alternative sequence which works
better for all the generic string functions which search for a character (strlen, strnlen,
memchr, memrchr, rawmemchr, strchr, strnchr, strchrnul, strcpy, strncpy).

> And we think small size is more important for strlen.

Absolutely, handling small cases quickly is essential for all string functions.

Wilco

  parent reply	other threads:[~2019-10-29 14:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21 14:25 Zhangxuelei (Derek)
2019-10-22  9:50 ` Yikun Jiang
2019-10-24 14:57   ` Carlos O'Donell
2019-10-26  9:57     ` Florian Weimer
2019-10-26 13:40       ` Carlos O'Donell
2019-10-29  1:20     ` Carlos O'Donell
2019-10-29 14:34 ` Wilco Dijkstra [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-10-29  3:22 Zhangxuelei (Derek)
2019-10-29  3:26 ` Carlos O'Donell
2019-10-30  6:42   ` Yikun Jiang
2019-11-01 12:55     ` Carlos O'Donell
2019-10-26 13:46 Zhangxuelei (Derek)
2019-10-26 13:22 Zhangxuelei (Derek)
2019-10-26 13:40 ` Carlos O'Donell
2019-10-17 13:16 Xuelei Zhang
2019-10-17 14:57 ` Yikun Jiang
2019-10-18 15:50   ` Wilco Dijkstra
2019-10-22 18:29 ` Wilco Dijkstra

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=VI1PR0801MB2127A81CAEA89A23AE97791583680@VI1PR0801MB2127.eurprd08.prod.outlook.com \
    --to=wilco.dijkstra@arm.com \
    --cc=Szabolcs.Nagy@arm.com \
    --cc=jiangyikun@huawei.com \
    --cc=libc-alpha@sourceware.org \
    --cc=nd@arm.com \
    --cc=siddhesh@gotplt.org \
    --cc=yikunkero@gmail.com \
    --cc=zhangxuelei4@huawei.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.
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).