Randall,
due to its interpretative nature, making such consideration in thinBasic is quite hard because most of the execution time is lost in interpreting the script and not reading/writing/converting data types or handling memory.
But back to your question, it mostly depend on the compiler used and the quality of the machine code generated.
Personally I've done many tests in the past on this matter using Power Basic compiler and I found that LONG are far the best interger class in terms of speed. Much much faster than DWORD. The reason is related to bit sign handling but this reason can be Power Basic specific and not a general reason.
Comparison example: http://www.powerbasic.com/support/pb...NG+DWORD+speed
From the thread you can see ...
######################################################################
DWORD
DIM d AS DWORD
d = 2
d = d + 5
compiles to ..
004010AB |. C745 80 02000000 MOV [LOCAL.32], 2
004010B2 |. B8 05000000 MOV EAX, 5
004010B7 |. 8B4D 80 MOV ECX, [LOCAL.32]
004010BA |. 03C1 ADD EAX, ECX
004010BC |. 8945 80 MOV [LOCAL.32], EAX
######################################################################
LONG
DIM l AS LONG
l = 2
l = l + 5
Compiles to ...
004010AB |. C745 80 02000000 MOV [LOCAL.32], 2
004010B2 |. B8 05000000 MOV EAX, 5
004010B7 |. 0145 80 ADD [LOCAL.32], EAX
As you can see there are 2 lines of instructions more to handle DWORD and this takes time.
Also one important thing to remember is that DWORD data type is optimized to store handle or pointers to memory areas. So they are not optimized for math. While LONG seems more related to numeric expressions.
So my advice is to always use LONG when math is involved (even a simple + or - operation) and DWORD when memory handling or pointers storage is the main target. But again, inside and interpreter it will make not any difference. 99% of the time is lost for parsing :-[
Ciao
Eros
Bookmarks