Would it be more efficient?

Would it be more efficient?

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Would it be more efficient?

Post by Snipawolf »

To just define the INBUILDSTANCE, and all that other juicy stuff in the thread, instead of compiling it with standard commands?

I feel it would be faster, at least a whee bit, because it doesn't have to check through that file, just the cob.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

#defines are precompiler statements, the string INBUILDSTANCE gets replaced with the number it's defined as before the compiler produces the bytecode.
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

I know that...

Would it be more efficient to define it in my script, than to compile the standard commands along with it?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Post by smoth »

it only includes what it needs in the precompiling stage. Don't worry about that part.


defines are like a mini header... a define is nothing more then:

x=2

y=x+1

the compilers sees y=2+1

if you put x = 2 in the header it would be the same.
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Okay. So it reads my script, then it merely reads only what it needs. That's good, I like that way, much more efficient than using the whole thing.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

It doesn't even matter what it reads. In

#define x 1
#define y 2

z=1+x;

the second define would be looked at but since tghere are no ys in the text wouldn't do anything. Removing it would shorten the compile time slightly but if your COB takes more than a second or two to compile you're doing something seriously wrong anyway.
Post Reply

Return to “Game Development”