Global struct arrays vs. hashtables

Embrace_It

New Member
Reaction score
9
I stand yet with another homebrewed system for god knows what, and I was wondering which is better/faster/safer etc., if either?

A global array of structs for all registered units/heroes/whatever

OR

Putting everything in a hastable or different hashtables?
(assuming one hashtable can hold different types, and I think it can)
 

Azlier

Old World Ghost
Reaction score
461
Struct members are faster than hashtables.
 

Embrace_It

New Member
Reaction score
9
Does this apply to getting data as well?

Struct array: Loop through every instance until a match is found
Hashtable: Load a value by using parent- and child keys.
 

Azlier

Old World Ghost
Reaction score
461
Oh, looping through all structs? Hashtables are much faster than an O(n) search. But, both O(n) and hashtables are unneeded here.

For "attaching" to units, you would use a unit indexing system, like AIDS.
 

Azlier

Old World Ghost
Reaction score
461
Click the link I posted above. That system lets you "attach" to units efficiently and easily.
 

Embrace_It

New Member
Reaction score
9
Yeah, I already know about AIDS and I clicked it anyway, I was just trying to see if I had understood your question correctly.

Thanks for the answers! That cleared things up! :thup: +rep

EDIT: Must spread rep first >.<
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top