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

Some quick benches

Status
Not open for further replies.
Level 31
Joined
Jul 10, 2007
Messages
6,306
These benches were conducted to look at the viability of pointers.

Pointers are ok to use so long as they are inlined, meaning that a language must be written on top of Galaxy for support as working with the arrays directly is very prone to error. Furthermore, pointers require bitwise operations to retrieve the information. Each bitwise operation adds ~.05 ms/1000 executions.

Isn't even 2.67 ms per thousand executions fast enough? Not really, a pointer scheme should add minimum overhead to code so that performance intensive operations will run without any hiccups as a result of using these pointers.

Tested on the following computer:

Windows 7 Ultimate 64-bit (6.1, Build 7601)
Intel(R) Core(TM) i7-3930K CPU @ 4.29 GHz
16384 MB RAM
Asus DCII AMD Radeon 6970

Code:
*-----------------------------------------------------------------------------------------------*
*												*
*					Quick Benches						*
*					-------------						*
*												*
*	All tests ran set followed by get							*
*												*
*		DataTableSetInt									*
*		DataTableGetInt									*
*												*
*		arr[arr[3]] = 3									*
*		var = arr[arr[3]]								*
*												*
*		arr[3] = 3									*
*		var = arr[3]									*
*												*
*		scalar = 3									*
*		var = scalar									*
*												*
*		setArr(3, 5)									*
*		var = getArr(3)									*
*												*
*		setSc(5)									*
*		var = getSc(5)									*
*												*
*												*
*-----------------------------------------------------------------------------------------------*
*			|				    |					*
*	 Test           |       Time (ms/1000 calls)        |	         Description		*
*			|				    |					*
*-----------------------------------------------------------------------------------------------*
*			|				    |					*
*	Data Table G:	|             2.670 	            |	Global				*
*	Data Table L:	|             2.750 	    	    |	Local				*
*	Array 2:	|             0.970 	    	    |	(arr[arr[3]])			*
*	Array:		|             0.671         	    |	(arr[3])			*
*	Scalar:		|  	      0.403 	    	    |					*
*	Array Func:	|             2.000    		    |	(setArr(index, value))		*
*	Scalar Func:	|             1.900  		    |	(setSc(value))			*
*			|				    |					*
*-----------------------------------------------------------------------------------------------*
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
The conclusion of this is that you should avoid dynamic programming concepts where possible in favour of static programming concepts.

For abilities try and let the data editor do the persistence, only use triggers for key steps that are hard to produce using data (formula damage or random locations).
 
Status
Not open for further replies.
Top