• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] whats better for efficiency

Status
Not open for further replies.
i have a couple of efficiency related questions.

1.
whats better to do modulo integer or subtring. ( note: these will be in a loop up from 0 to 7 )

2.
i have a couple of minigames. in them i usea periodic trigger to do some actions. i simply turn the trigger on when minigame starts. i was wondering if its better to use periodic triggers or to use repeating timers ? i think timers would be more efficient right ? also which is more accurate ?
 
1. Do ModuloInteger.
In fact, inline it.
ModuloInteger(x, y)
->
x - x/y*y

2. Repeating timers are more efficient.
When it comes to accuracy, they're both about the same.
These timers have awesome resolutions. You can go as low as a tenth of a millisecond.

edit
Since it seems you're using GUI (Because you called them "repeating" timers), then for 1, I'd scratch that.
It's not easy to tell which is more efficient. SubString will cause string leaks, so in either case, go for ModuloInteger.
 
Status
Not open for further replies.
Top