NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: memove performance of NetBSD



Hi,

Thor Lancelot Simon <tls%panix.com@localhost> wrote:
> On Thu, Jan 28, 2010 at 02:07:45PM +0530, Channa wrote:
>> Hi,
>>
>> Thor Lancelot Simon <tls%panix.com@localhost>:
>> > On Thu, Jan 28, 2010 at 11:56:09AM +0530, Channa wrote:
>> >>
>> >> Yes the performance improves when the memmove is done as below:
>> >>
>> >> memmove(dst, src+1, sizeof(src));
>> >> memmove(dst, src+2, sizeof(src));
>> >> memmove(dst, src+3, sizeof(src));
>> >
>> > That's a pretty weird special case, since the start addresses overlap.
>> > What if you use more realistic start addresses?
>> >
>> [..]
>>
>> I wanted to verify for unaligned address, using malloc() i got the
>> memory for the src and dst and I always got aligned address.
>
> Yes, but the three copies you're doing (src+1, src+2, and src+3)
> overlap each other.

I am doing the memmove() operation for all three as below:
Step1:
src = malloc();
dst = malloc();
memmove(dst, src+1, sizeof(src));
free(src);
free(dst);

Step2:
src = malloc();
dst = malloc();
memmove(dst, src+2, sizeof(src));
free(src);
free(dst);

Step3:
src = malloc();
dst = malloc();
memmove(dst, src+3, sizeof(src));
free(src);
free(dst);

In the above case I dont think they overlap.

Is there any better way to perform memmove() when the source or the
destination is unaligned.?

By making them aligned using some method?

Thanks & Regards,
Channa


Home | Main Index | Thread Index | Old Index