[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] copy, dd: simplify and optimize NUL bytes detection
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH] copy, dd: simplify and optimize NUL bytes detection |
Date: |
Thu, 22 Oct 2015 17:52:26 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 22/10/2015 17:47, Bernhard Voelker wrote:
>> Note the above does break early if non zero detected in first 16 bytes.
>>
>> Also I suspect the extra conditions involved in using longs
>> for just the first 16 bytes would outweigh the benefits?
>> I.E. the first simple loop probably breaks early, and if not
>> has the added benefit of "priming the pumps" for the subsequent memcmp().
>
> what about spending some 16 bytes of memory and do the memcmp on the whole
> buffer?
>
> static unsigned char p[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
> return 0 == memcmp (p, buf, bufsize);
memcmp has high setup costs, because the compiler doesn't know it as
well as memcpy, so no. :(
Nerd sniping at its best!
Paolo
- Re: [PATCH] copy, dd: simplify and optimize NUL bytes detection, (continued)
- Re: [PATCH] copy, dd: simplify and optimize NUL bytes detection, Paolo Bonzini, 2015/10/22
- Re: [PATCH] copy, dd: simplify and optimize NUL bytes detection, Eric Blake, 2015/10/22
- Re: [PATCH] copy, dd: simplify and optimize NUL bytes detection, Paolo Bonzini, 2015/10/22
- Re: [Qemu-devel] [PATCH] copy, dd: simplify and optimize NUL bytes detection, Radim Krčmář, 2015/10/22
- Re: [Qemu-devel] [PATCH] copy, dd: simplify and optimize NUL bytes detection, Paolo Bonzini, 2015/10/22
- Message not available
- Re: [Qemu-devel] [PATCH] copy, dd: simplify and optimize NUL bytes detection, Paolo Bonzini, 2015/10/23
- Re: [Qemu-devel] [PATCH] copy, dd: simplify and optimize NUL bytes detection, Pádraig Brady, 2015/10/23
- Re: [Qemu-devel] [PATCH] copy, dd: simplify and optimize NUL bytes detection, Pádraig Brady, 2015/10/23
- Re: [Qemu-devel] [PATCH] copy, dd: simplify and optimize NUL bytes detection, Pádraig Brady, 2015/10/25
- Re: [PATCH] copy, dd: simplify and optimize NUL bytes detection, Bernhard Voelker, 2015/10/22
- Re: [PATCH] copy, dd: simplify and optimize NUL bytes detection,
Paolo Bonzini <=
- Re: [PATCH] copy, dd: simplify and optimize NUL bytes detection, Eric Blake, 2015/10/22
- Re: [PATCH] copy, dd: simplify and optimize NUL bytes detection, Bernhard Voelker, 2015/10/23