|
C++ vs. Lice-C performance
#454204
09/01/15 09:09
09/01/15 09:09
|
Joined: Mar 2011
Posts: 3,150 Budapest
sivan
OP
Expert
|
OP
Expert
Joined: Mar 2011
Posts: 3,150
Budapest
|
Hi, do you have any comparison tests or idea about the difference of (nearly) similar Lite-C and C++ codes? (And C# just for fun.) My experinces: Recently I have ported the static part of my RTS map decomposition codes to UE4, which - surprisingly for me - works at least 10, maybe 30 times faster than in 3DGS (1-1.5 sec stop in UE4 game thread what is approx. 30sec with 3DGS but with a few interim waits to avoid long freezing). It consists of large dynamic struct array allocations, several memset and few memcpy of arrays, passing arrays as function parameters by pointers, large loops with many complex computations. And significant amount of ray tracing, but it is rather an OBB vs. PhysX3.3 question (it is fast enough with 3DGS, lightning fast with PhysX). I know it is heavily code dependent as it can be seen in C++ vs. C# benchmarks, but I would like to get a rough idea and a confirmation of that my AI related codes also would run similarly faster with UE4-C++ than in 3DGS-Lite-C (consisting of mainly dynamic array struct management - lot of array memsets, and loops through arrays - and expensive computations like tons of A* pathfinding). Moreover in Ue4-C++ I can convert my codes to run in separate threads in the background for the cost of more memory (each thread would require its own, not like when they are running after each other). Or course UE4 actor system and ticking is different from 3DGS entity system, where I could avoid using separate waits for my RTS units (I use only one loop with wait() as the main game loop and another for MapBuilder editor UI loop). Thanks for any info
|
|
|
Re: C++ vs. Lice-C performance
[Re: sivan]
#454211
09/01/15 11:40
09/01/15 11:40
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
|
c++ and c# comparison depends highly on what you are doing and how you are doing it.
3333333333
|
|
|
Re: C++ vs. Lice-C performance
[Re: Quad]
#454212
09/01/15 11:44
09/01/15 11:44
|
Joined: Oct 2011
Posts: 1,082 Germany
Ch40zzC0d3r
Serious User
|
Serious User
Joined: Oct 2011
Posts: 1,082
Germany
|
Lite-C is more then a scripting language, the code itself gets translated to direct assembler, the question is how good this translation is. And seriously, if you create a multiplayer game dont even think about the word unity. Even the greatest retards can drag a dll into their project and use YOUR classes and functions because .net code isnt secured in any way. UE4 reversing is not even close to what happened to UE3. On UE3 you are able to dump a whole SDK for your game hacks by injecting a DLL to the game. But Im sure the same will happen to UE4 some day
Last edited by Ch40zzC0d3r; 09/01/15 11:45.
|
|
|
Re: C++ vs. Lice-C performance
[Re: Ch40zzC0d3r]
#454213
09/01/15 12:12
09/01/15 12:12
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
|
UE3 was using unreal script, some sort of jvm-like vm language. UE4 uses c++ i doubt that will happen
3333333333
|
|
|
Re: C++ vs. Lice-C performance
[Re: Quad]
#454214
09/01/15 12:33
09/01/15 12:33
|
Joined: Oct 2011
Posts: 1,082 Germany
Ch40zzC0d3r
Serious User
|
Serious User
Joined: Oct 2011
Posts: 1,082
Germany
|
UE3 was using unreal script, some sort of jvm-like vm language. UE4 uses c++ i doubt that will happen They still save function and class names/size with the UE4 insert class member macro
Last edited by Ch40zzC0d3r; 09/01/15 12:33.
|
|
|
Re: C++ vs. Lice-C performance
[Re: sivan]
#454266
09/02/15 19:42
09/02/15 19:42
|
Joined: Jul 2001
Posts: 6,904
HeelX
Senior Expert
|
Senior Expert
Joined: Jul 2001
Posts: 6,904
|
Naturally, the Lite-C compiler isn't as optimized as the Visual Studio compiler, period. So, it is a well known secret that if you do your code in a DLL, it is a lot fast. So, if code execution is an issue, just drop it into a DLL function - should be straight forward.
The only thing you can't drop into a DLL are wait(1) calls. So if you rely on classic Gamestudio scheduling, you could build e.g. classes for actors that encapsulate the behaviour which is called by the "framing" wait(1) construct in Lite-C. Sounds awful, though.
Best way would be to design your code with as less wait(1)'s as possible and shift later to DLL.
|
|
|
|