• 🏆 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!

Speed Comparison

Status
Not open for further replies.
Level 7
Joined
Apr 27, 2011
Messages
272
I've been checking alot of sites i know but i cannot find a speed comparison table... so i decided to post here.

So is this a correct order of speed comparison? Since Im really confused about their speed. ("<" - means slower than)

Gamecaches < Structs < Hashtables < Arrays < 2D Arrays (in vJASS)

or you can just tell me which one works the fastest among them in terms of recovering and storing of values/data .
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
structs compile to arrays imho so their speed is equal
gamecache is slowest
hashtables are second slowest and become slower with more data stored in them
2d arrays require normal arrays so they are slower than normal arrays (which should be fastest)

Speed:
1. Array
2. 2D-Array/Struct(not 100% sure)
3. hashtable
4. gamecache

it depends on how you want to store the data
if you want to attach it to handles your only way is to use hashtables or structs and some attachment stuff
if you want to store less than 8192 things with indexes less than 8192 you should use arrays
if you want to save/load data in campaigns you can use gamecaches
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
if only Blizzard allowed timer callback functions to take arguments....
It would make no sense from a programming point of view. How would they get stored? When would they get evaluated? How many would be supported?

The fastest is logically non array variables (scalar variables) as they are 1 memory lookup rather than 2 that an array needs.

Hashtables are prety slow compared to an array lookup due to the complexity of the underlying data structure but they provide an enormous scope range and keep an efficiency of mostly near O(1).

A gamecache is even slower as it is basically a hashtable but with string hashes and file syncronization.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
If arguments are evaluated when the timer is started, it would just need to store an accompany object to contain all the parameters. The timer system itself would need to store this reference but that can be done as an object variable for the timer itself.

The problem with JASS is the code argument that the timer takes does not support arguments at all. You can however make a system which stores a vJASS struct to a timer using simlar principles (although not the same).
 
Status
Not open for further replies.
Top