[Mono-devel-list] [Patch] Manged code is fast!
Ben Maurer
bmaurer at users.sourceforge.net
Thu May 20 19:48:31 EDT 2004
> private unsafe static void CharCopy (char* source, char* destination, int count)
What is the perf here if things are not dword aligned?
> + while (count >= 16) {
> + *((int*) destination) = *((int*) source);
> + destination += 2;
> + source += 2;
> + *((int*) destination) = *((int*) source);
> + destination += 2;
> + source += 2;
It is probably better to do something like:
*((int*) dest + x) = ...
To figure out why, take a look at what kind of assembly is generated.
Probably, it is using a memindex type instruction. So the extra addition
has no overhead, but it saves you the two add instructions.
Also, I have a patch that I am working on which does an assembly impl of
String.Equals. I got great perf on it, so maybe we can get something
similar.
-- Ben
More information about the Mono-devel-list
mailing list