Mr. Pop don't rule out the notion of using unsafe code in c#. It has purpose's. I do agree with you tho. In c# unless you understand it fully keep away from using unsafe code.
You have no idea what you're talking about :rolleyes:Quote:
unsafe code it's too messy in c#, and if you are using it because you think you're getting better performance ,in reality, while it might be better, it's not noticeably better, it's a hell of a lot worse to maintain though.
and don't use memcpy on managed memory :P , anyways it's seems OK but try to avoid any unsafe code in you're C# source :)
Agreed :)Quote:
Mr. Pop don't rule out the notion of using unsafe code in c#. It has purpose's. I do agree with you tho. In c# unless you understand it fully keep away from using unsafe code.
i really do! but the question why do you use unsafe while you can use the C# built in functions?Quote:
You have no idea what you're talking about :rolleyes:
Unsafe code is the most efficient way to access/modify data in memory, anyone who denies this is in denial about it.Quote:
Agreed :)
i really do! but the question why do you use unsafe while you can use the C# built in functions?
like instead of 'memcpy ' use Buffer.BlockCopy ?
void MEMCPY(byte[] Received, byte[] Buffer, int Len)
{
// fixed (byte* pointer = Received, buffer = Buffer)
// MSVCRT.MEMCPY(pointer, buffer, Len);
byte[] Received = new byte[Len];
for (int x = 0; x < Len; x++)
{
Received[x] = Buffer[x];
}
}
| Target | Buffer.BlockCopy | Array.Copy | memcpy (void*) | memcpy (IntPtr) | memcpy (void*, fixed byte*) | memcpy (fixed byte*, fixed byte*) |
| x64 | 31.547 | 30.734 | 30.201 | 30.922 | 34.817 | 29.760 |
| x86 | 43.606 | 41.208 | 37.309 | 37.626 | 40.051 | 37.704 |
| Any | 28.422 | 27.097 | 25.858 | 26.542 | 30.531 | 26.087 |
I changed some few things, if you want to see what, feel free to check out my source ^^Quote:
I don't see a need to change what anyone is comfortable with because it would be fractions of a nanosecond faster
Hopefully I'm not the only one that sees it that way
Nice release bauss..might save it for later
Sadly its not fractions of a nanosecond faster, its several milliseconds faster, and when writing a server several milliseconds is a long time.Quote:
I don't see a need to change what anyone is comfortable with because it would be fractions of a nanosecond faster
Hopefully I'm not the only one that sees it that way
Nice release bauss..might save it for later
Correct me if I'm wrong but isn't he saying each function was called 50 million times?Quote:
Originally Posted by CptSkyTested on Windows XP x64, for a copy of 50'000'000 elements and tested 1000 times for precision. All values in ms.
ulong[] x = new ulong[50000000];
for (ulong i = 0; i < 50000000; i++)
{
x[i] = i*3/4;
}