This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4/4] Remove powerpc64 strspn, strcspn, and strpbrk implementation



On 30-03-2016 15:14, Tulio Magno Quites Machado Filho wrote:
> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> 
>> On 30-03-2016 10:14, Tulio Magno Quites Machado Filho wrote:
>>> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
>>>
>>>> 	* sysdeps/powerpc/powerpc64/strcspn.S: Remove file.
>>>> 	* sysdeps/powerpc/powerpc64/strpbrk.S: Likewise.
>>>
>>> But the removal of these 2 brings some serious performance degradation.
>>> I think we should keep them for now.
>>
>> Do you mean regression on POWER7 only or for POWER8 as well? 
> 
> Both.
> 
>> And what do you mean by 'serious'?
> 
> The new strcspn C implementation spent 8x the time of the powerpc64 assembly.
> While strpbrk spent ~12x the time.
> Using the benchtests.
> 

This is definitively not what I am seeing the environment I am using
(powerpc64le, POWER8E (raw), 3.5GHz, --with-cpu=power7, CFLAGS=-O3,
gcc 4.8.4).
I am sending you the benchtests data in attachment.

For strcspn if reject is length {0,1} strchrnul will be used, which
is way faster than constructing the table and reading byte per byte.
Also for the rest of inputs, C version is slight faster in fact.

It is the same for strpbrk, since it will call strcspn in the end.
The only patch it will be faster is when 'accept == '\0', since
powerpc64 algorithm has a fast patch to return 0 in this case
(where C implementation will call strchrnul).

I am not seeing much difference with default optimization (-O2)
as well. 

Attachment: bench-strcspn-base.out
Description: Text document

Attachment: bench-strcspn-patch.out
Description: Text document

Attachment: bench-strpbrk-base.out
Description: Text document

Attachment: bench-strpbrk-patch.out
Description: Text document

Attachment: bench-strspn-base.out
Description: Text document

Attachment: bench-strspn-patch.out
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]