speed question 
Author Message
 speed question

My question is, would it be quicker to use the immediate if, or to use the
math functions on the Difficulty variable?

Difficulty is a byte becuase it will only ever be 0 or 5;
Filenames is a string;
TypeOfGame is a byte that can be 0 - 3.

These two statements are actually for different reasons, so don't try to
compare them, I just chose them arbitrairly becuase one used the IIF, and
the other used math.

FileNames = Format$(Index * IIf(Difficulty = 0, 100, 50) + IIf(Difficulty =
0, 100, 50), "000") & IIf(Difficulty = 0, "DN", "DE") & "-1.BMP"

If TypeOfGame Mod 2 = 0 Then FileNames = Format$(Index * (-(Difficulty * 10)
+ 100) + (-(Difficulty * 10) + 100), "000") & "D.BMP"

Thanks,
Bodi Klamph
Azure Dragon Software

begin 666 Bodi Klamph.vcf
M0D5'24XZ5D-!4D0-"E9%4E-)3TXZ,BXQ#0I..DML86UP:#M";V1I#0I&3CI"
M;V1I($ML86UP: T*14U!24P[4%)%1CM)3E1%4DY%5#I"2VQA;7!H0$%Z=7)E

`
end



Thu, 09 Nov 2000 03:00:00 GMT  
 speed question

MS published a whitepaper when VB4 came out on optimizing techniques for VB4, indicating
that using IIf() was 200+ times slower than the equivalent multiple-if statements.  This
may not be the case today with VB5, but there has been no article to amend this
performance rating either.

--

Randy Birch, MVP Visual Basic
VBnet, The Visual Basic Developers Resource Centre
http://home.sprynet.com/sprynet/rasanen/vbnet/default.htm

Common Controls Replacement Project Member
http://www.mvps.org/ccrp

:My question is, would it be quicker to use the immediate if, or to use the
:math functions on the Difficulty variable?
:
:Difficulty is a byte becuase it will only ever be 0 or 5;
:Filenames is a string;
:TypeOfGame is a byte that can be 0 - 3.
:
:These two statements are actually for different reasons, so don't try to
:compare them, I just chose them arbitrairly becuase one used the IIF, and
:the other used math.
:
:
:FileNames = Format$(Index * IIf(Difficulty = 0, 100, 50) + IIf(Difficulty =
:0, 100, 50), "000") & IIf(Difficulty = 0, "DN", "DE") & "-1.BMP"
:
:If TypeOfGame Mod 2 = 0 Then FileNames = Format$(Index * (-(Difficulty * 10)
:+ 100) + (-(Difficulty * 10) + 100), "000") & "D.BMP"
:
:Thanks,
:Bodi Klamph
:Azure Dragon Software
:
:
:
:



Thu, 09 Nov 2000 03:00:00 GMT  
 speed question

I have done a little testing on the IIF in vb5 and it is still much slower.

Regards,
David Phillips



Quote:
> MS published a whitepaper when VB4 came out on optimizing techniques for
VB4, indicating
> that using IIf() was 200+ times slower than the equivalent multiple-if
statements.  This
> may not be the case today with VB5, but there has been no article to
amend this
> performance rating either.

> --

> Randy Birch, MVP Visual Basic
> VBnet, The Visual Basic Developers Resource Centre
> http://home.sprynet.com/sprynet/rasanen/vbnet/default.htm

> Common Controls Replacement Project Member
> http://www.mvps.org/ccrp


> :My question is, would it be quicker to use the immediate if, or to use
the
> :math functions on the Difficulty variable?
> :
> :Difficulty is a byte becuase it will only ever be 0 or 5;
> :Filenames is a string;
> :TypeOfGame is a byte that can be 0 - 3.
> :
> :These two statements are actually for different reasons, so don't try to
> :compare them, I just chose them arbitrairly becuase one used the IIF,
and
> :the other used math.
> :
> :
> :FileNames = Format$(Index * IIf(Difficulty = 0, 100, 50) +
IIf(Difficulty =
> :0, 100, 50), "000") & IIf(Difficulty = 0, "DN", "DE") & "-1.BMP"
> :
> :If TypeOfGame Mod 2 = 0 Then FileNames = Format$(Index * (-(Difficulty *
10)
> :+ 100) + (-(Difficulty * 10) + 100), "000") & "D.BMP"
> :
> :Thanks,
> :Bodi Klamph
> :Azure Dragon Software
> :
> :
> :
> :



Sat, 11 Nov 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Macro Speed Question

2. Excel Interop Speed Question

3. TYPEs in QBasic speed question

4. Database Query Speed Question(s)

5. DAO Speed Question

6. SQL Speed Question (Really Interesting me thinks)

7. visual basic (excel) execution speed question

8. A couple of Speed Questions

9. Add record speed question

10. ADO Speed question

11. Access dB speed question

12. SetTextureQuality speed question

 

 
Powered by phpBB® Forum Software