• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] whats better for efficiency

Status
Not open for further replies.
Level 29
Joined
Oct 24, 2012
Messages
6,543
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