DescriptionRely on 'memcpy' in WTF::copyChars
Before the change 'WTF::copyChars' contained an algorithm that was used
instead of 'memcpy' if the number of characters had been less than 20.
This however was unnecessary as 'memcpy' produces more efficient asm code
than the home-brewed algorithm did as it uses 'movq' (instead of 'movl')
doing the copying within the less number of asm commands (tested with
GCC 4.6.3).
So, this patch removes the home-brewed algorithm from 'WTF::copyChars'
and makes it always rely on 'memcpy'.
A simple testing programm doing the following code
for (int i = 10000000; --i;) {
// Re-create 'src' to prevent from optimizing cycle iterations out.
char* src = new char[15];
copyChars(dest, src, 15);
copyChars(dest, src, 14);
delete[] src;
}
takes:
0m0.324s before the change
0m0.235s after the change (using 'memcpy').
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=169865
Patch Set 1 #
Total comments: 3
Messages
Total messages: 6 (0 generated)
|