• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Why dynamic indexing is flawed and people should use linked list instead

Status
Not open for further replies.

Cokemonkey11

Code Reviewer
Level 29
Joined
May 9, 2006
Messages
3,522
Not necessarily constricted to GUI lolz.
I can easily convert what I have done into vJass, I just did it in GUI for user friendly readability sakes.

I just did this cause I enjoyed making such a system that could become useful, no matter how little use you claim it has.

Sorry, I should have recognized your name.

I took a look at your system. From a code complexity (limiting case) standpoint, your code should theoretically behave similar to a dynamically indexed or linked list based system.

But unfortunately we're using wc3. I'll be impressed if your code can even reach the performance of a linked list equivalent, even given a 25% bias margin.

If your argument is that this code is easier to understand than a linked list, I respectfully disagree.
 
Sorry, I should have recognized your name.
I also think that I should change my avatar back. I've had my fun. :D

I took a look at your system. From a code complexity (limiting case) standpoint, your code should theoretically behave similar to a dynamically indexed or linked list based system.
Yeah although kinda my own little version.

But unfortunately we're using wc3. I'll be impressed if your code can even reach the performance of a linked list equivalent, even given a 25% bias margin.

If your argument is that this code is easier to understand than a linked list, I respectfully disagree.
I wouldn't necessarily think that it is easier to understand. Although IMO I would think that it is easier to setup when it is understood enough
This system will entirely indexing and de-indexing variables when the spell is done on it's own. Just by simply setup the variables and starting code at the start and do the actions that you want done periodically, in the periodic trigger.

Although would only be more efficient in some cases.
 
Sorry for the tiny necro, but I just had to reply here.

when looping through 1k indexes hashtables would be faster.

No. You'd still be doing the same amount of work with a hashtable, except you'd often resort to using a group enumeration over 1000 casters which I can bet my life is at least an order of magnitude slower than a simple iteration over a range of indices. If you don't choose a group enumeration, you'd resort to a linked list or an index range, which makes the hashtable quite redundant because you might as well just use the linked list nodes to store data into arrays or the indices themselves.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Hmm sorry if it is a bad question, but if CurrentIndex isn't -1 in the deindexing, then index 4 wouldn't run before index 3?

Instance at index 2 is removed and an instance from the last index is moved to index 2. The loop increases current index by one , the next index would be 3. Max index is decreased by one, so the instance that was moved to index 2 would not get looped through at all, if current index wasn't decreased by one.
 
Status
Not open for further replies.
Top