![]() |
|
Simple VB.Net 2D Game Engine - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Visual Basic & .NET Framework (https://sinister.ly/Forum-Visual-Basic-NET-Framework) +--- Thread: Simple VB.Net 2D Game Engine (/Thread-Simple-VB-Net-2D-Game-Engine) |
RE: Simple VB.Net 2D Game Engine - Falgantil - 05-02-2013 (05-02-2013, 12:27 AM)ArkPhaze Wrote:(05-01-2013, 09:20 AM)Falgantil Wrote:(05-01-2013, 05:15 AM)ArkPhaze Wrote:Quote:A very simple test is, try making a loop, writing "Hello there HackCommunity", say 1.000.000 times or so, in both languages. Start them at the same time and see what finishes first. I should think that C++'s "cout" and C#'s "Console.WriteLine" is more or less equal, processing-wise. Note that I am not saying that C++ is a bad language in any way. I'm just saying that sometimes you'd want to consider whether C++ is actually the best choice, even if you're very good at it. ~ Falgantil ~ RE: Simple VB.Net 2D Game Engine - ArkPhaze - 05-02-2013 I read this: Quote:An area where I saw mentioned (I don't have tested this myself) that C# is supposed to be more consistently efficient is repeated memory allocation (as it is based on a GC, allocating memory is done in chunks and managed by the GC and releasing can be differed while the C++ code immediately allocates and releases each chunks from/to the OS immediately resulting in slower repeated memory allocations). But once again on the other hand the GC could kick in at unexpected times so it's hard to qualify this as an advantage/disavantage. But the most important part is where he talks about the GC, which is a feature of the CLR I believe. Sure things may not be immediately released, but if the GC ever decides that it is time to clean up... That is a very computationally expensive task. (05-02-2013, 04:19 PM)Falgantil Wrote: I should think that C++'s "cout" and C#'s "Console.WriteLine" is more or less equal, processing-wise. You would be wrong to think that. Code: std::cout << "hello world";
0013219E push 13EF24h
001321A3 mov eax,dword ptr ds:[001423DCh]
001321A8 push eax
001321A9 call std::operator<<<std::char_traits<char> > (01312FDh)
001321AE add esp,8And only some of what goes on through the above: Code: [std::operator<<<std::char_traits<char> >:]
00FB12FD jmp std::operator<<<std::char_traits<char> > (0FB2210h)
[template<class _Traits> inline
basic_ostream<char, _Traits>& operator<<(
basic_ostream<char, _Traits>& _Ostr,
const char *_Val)
{ // insert NTBS into char stream]
00FB2210 push ebp
00FB2211 mov ebp,esp
[template<class _Traits> inline
basic_ostream<char, _Traits>& operator<<(
basic_ostream<char, _Traits>& _Ostr,
const char *_Val)
{ // insert NTBS into char stream]
00FB2213 push 0FFFFFFFFh
00FB2215 push 0FB9F48h
00FB221A mov eax,dword ptr fs:[00000000h]
00FB2220 push eax
00FB2221 push ecx
00FB2222 sub esp,154h
00FB2228 push ebx
00FB2229 push esi
00FB222A push edi
00FB222B lea edi,[ebp-164h]
00FB2231 mov ecx,55h
00FB2236 mov eax,0CCCCCCCCh
00FB223B rep stos dword ptr es:[edi]
00FB223D mov eax,dword ptr ds:[00FC10C4h]
00FB2242 xor eax,ebp
00FB2244 mov dword ptr [ebp-14h],eax
00FB2247 push eax
00FB2248 lea eax,[ebp-0Ch]
00FB224B mov dword ptr fs:[00000000h],eax
00FB2251 mov dword ptr [ebp-10h],esp
(cont...)
[ static size_t __CLRCALL_OR_CDECL length(const _Elem *_First)
{ // find length of null-terminated string]
00FB5DA3 sub esp,0C4h
00FB5DA9 push ebx
00FB5DAA push esi
00FB5DAB push edi
00FB5DAC lea edi,[ebp-0C4h]
00FB5DB2 mov ecx,31h
00FB5DB7 mov eax,0CCCCCCCCh
00FB5DBC rep stos dword ptr es:[edi]Now for console.WriteLine in C#: Code: Console.Write("hello world");
0000001a mov rcx,0B510003338h
00000024 mov rcx,qword ptr [rcx]
00000027 call 000000005E37A1E0
0000002c nopWhat gets called: Code: 00000000 push rbx
00000001 push rdi
00000002 sub rsp,28h
00000006 mov rdi,rcx
00000009 mov edx,0AEh
0000000e mov ecx,1
00000013 call FFFFFFFFFFF78050
00000018 mov rbx,rax
0000001b mov rax,qword ptr [rbx+000000D0h]
00000022 test rax,rax
00000025 jne 0000000000000030
00000027 mov cl,1
00000029 call 0000000000000120
0000002e xchg ax,ax
00000030 mov r11,qword ptr [rbx+000000D0h]
00000037 mov rax,qword ptr [r11]
0000003a mov rax,qword ptr [rax+58h]
0000003e mov rdx,rdi
00000041 mov rcx,r11
00000044 mov rax,qword ptr [rax+10h]
00000048 add rsp,28h
0000004c pop rdi
0000004d pop rbx
0000004e jmp rax
00000051 add rsp,28h
00000055 pop rdi
00000056 pop rbx
00000057 retRE: Simple VB.Net 2D Game Engine - iNanox - 10-28-2013 its a bit buggy but good job
RE: Simple VB.Net 2D Game Engine - iNanox - 10-28-2013 its a bit buggy but good job
RE: Simple VB.Net 2D Game Engine - iNanox - 10-28-2013 its a bit buggy but good job
RE: Simple VB.Net 2D Game Engine - iNanox - 10-28-2013 its a bit buggy but good job
RE: Simple VB.Net 2D Game Engine - iNanox - 10-28-2013 its a bit buggy but good job
|