Vexorian
Why no custom sig?
- Reaction score
- 187
I dunno why that thread was closed. But I had to say this.
Let me say this, FirstOfGroup is faster than ForGroup when you don't need to keep the group after the iteration.
Else it is slower.
But the difference is negligible and FirstOfGroup has the advantage of not using another function so code looks more structured and you can easily use local variables without going through the work of passing them using bridge globals.
In fact, using bridge globals may as well make ForGroup heavier.
But if you ask me, I would rather not use groups at all, when you use ForGroup it means you want an iteration and groups are bad for that. And I have seen issues arise with FirstOfGroup if there are waits between the loop and one unit dies.
It is all easier to use a "dynamic array". Unit group is barely useful for IsUnitInGroup, and that's not so useful either. I am lately just using groups for quick detections in areas and ranges but never to actually store groups of units for later use.
BTW, the old benchmark ForGroup benchmark didn't use GetEnumUnit so it could as well be flawed.
Let me say this, FirstOfGroup is faster than ForGroup when you don't need to keep the group after the iteration.
Else it is slower.
But the difference is negligible and FirstOfGroup has the advantage of not using another function so code looks more structured and you can easily use local variables without going through the work of passing them using bridge globals.
In fact, using bridge globals may as well make ForGroup heavier.
But if you ask me, I would rather not use groups at all, when you use ForGroup it means you want an iteration and groups are bad for that. And I have seen issues arise with FirstOfGroup if there are waits between the loop and one unit dies.
It is all easier to use a "dynamic array". Unit group is barely useful for IsUnitInGroup, and that's not so useful either. I am lately just using groups for quick detections in areas and ranges but never to actually store groups of units for later use.
BTW, the old benchmark ForGroup benchmark didn't use GetEnumUnit so it could as well be flawed.