View Single Post
Old 09-17-2011, 06:24 AM   #2
PurgeandFire111
User
 
PurgeandFire111's Avatar
 
Join Date: Dec 2006
Posts: 253

PurgeandFire111 will become famous soon enough (58)PurgeandFire111 will become famous soon enough (58)

Default

Quote:
that just calls TriggerSleepAction(x) will it be better?

You will probably want to refrain from using TriggerSleepAction. In periodics especially, it can lead to very odd wait times. Generally, it may do things you just don't want it to do. I recommend that you opt for a timer method, it is harder to implement but the results will be a lot less varying.

Quote:
which one of these is preferable?

Well, I am not sure exactly what you mean. Do you mean a global array vs. a struct array? They are pretty much different things. The first one is just a bunch of arrays, so that will be very fast. The second one is an array variable of a struct, aka an integer array. So when reading the globals, it would just be a[x] while reading it from the struct will be ex[x].a. The second method will be slower because it is actually doing a[ex[x]], which is two array reads compared to a simple a[x].

... but there is always the high chance that I misunderstood your question. :P But if you are curious about strictly speed, the global block will be faster. It really depends on what you are doing as to which one you will use. If you are questioning structs vs using globals and doing all the work yourself, then I say you should just opt for structs because they were made for a reason. =) However, if you don't need a struct, then don't use one.
PurgeandFire111 is offline   Reply With Quote