[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
memove performance of NetBSD
I am using NetBSD 3.1 ,I have some issues with the performance of memmove().
The memmove() implementation in NetBSD has the following algorithm
<1> If the source is aligned then copy 8*4 bytes at a time to destination
<2> If the source is unaligned then the copy is done byte by byte
The code snippet for <2> is as below
177 * Copy from unaligned source to aligned dest.
179 5: # destaligned
180 andi t0,SIZEREG,3 # t0 = bytecount mod 4
181 subu a3,SIZEREG,t0 # number of words to transfer
182 beq a3,zero,3b
184 move SIZEREG,t0 # this many to do after we are done
185 addu a3,SRCREG,a3 # stop point
188 LWHI t3,0(SRCREG)
189 LWLO t3,3(SRCREG)
190 addi SRCREG,4
191 sw t3,0(DSTREG)
192 bne SRCREG,a3,1b
193 addi DSTREG,4
195 j 3b
Due to which the performance of memmove() degrades when the source is unaligned.
I feel the algorithm could be changed as below:
<2> If the source is unaligned then copy the only some bytes of source
to destination so that source is at an aligned address, then copy 8*4
bytes at a time.
The above step could increase the performance of memmove() for
unaligned source address.
Please let me know your opinion on my views.
Thanks & Regards,
Main Index |
Thread Index |