[AccessD] Array faster in DLL?

Gustav Brock Gustav at cactus.dk
Mon Oct 31 11:07:11 CST 2005


Hi Marty

You may have a point. I didn't give it a thought.
One could imagine that it does a type cast to double as a result of the division, then another back to long (or to double for the 100) for the comparison.

Please note, this code doesn't serve any serious purpose except "doing something" that takes a little while. 

/gustav

>>> martyconnelly at shaw.ca 31-10-2005 17:39:20 >>>
Just one hint for VBA code speed on this line
Since everything is being done by integers

 If alngTmp(lngItem, 1) / 10 = 100 Then

On a run of 50 seconds
If I use integer division with the "\" operator , I save around 1 second

 If alngTmp(lngItem, 1) \ 10 = 100 Then

If I use multiplication instead of division , I save 5-6 seconds
It does a type conversion to a long, but I have never seen a full 
documented description of this
from MS so I don't trust it, so I would use CLng which would add overhead.

 If alngTmp(lngItem, 1) * 0.1 = 100 Then

Some optimizing compilers have options that might change division by a 
constant to multiplication of it's inverse.





More information about the AccessD mailing list