From: Bob Butler on

"mscir" <mscir(a)yahoo.com> wrote in message
news:hm6bof$ma7$1(a)adenine.netfront.net...
> I don't think this is causing any speed problems, but I was wondering how
> IF statements are executed when they include an AND, is the IF evaluated
> as FALSE if the first condition is FALSE or are both evaluated?

VB does not short-circuit expressions like some other languages do; all
parts are evaluated.


From: Webbiz on
On Thu, 25 Feb 2010 09:24:28 -0800, mscir <mscir(a)yahoo.com> wrote:

>Webbiz wrote:
>
>> For X = 0 To HighDatesCount - 2
>> For Y = X + 1 To HighDatesCount - 1
>> TradingDays = GetTradingDays(HighDates(X), HighDates(Y))
>> If TradingDays > 4 Then
>> RatioResult = TradingDays * .404
>> ResultDate = ForwardDate(HighDates(Y), RatioResult)
>> If DateValue(ResultDate) > DateValue(sLastDataDate) -
>> 7 And DateValue(ResultDate) < DateValue(sLastDataDate) + 60 Then
>> ReDim Preserve AllDates(AD_Count)
>> AllDates(AD_Count) = ResultDate
>> AD_Count = AD_Count + 1
>> End If
>> End If
>> Next Y
>> Next X
>
>I don't think this is causing any speed problems, but I was wondering
>how IF statements are executed when they include an AND, is the IF
>evaluated as FALSE if the first condition is FALSE or are both
>evaluated? Iow would this be faster?
>
>If DateValue(ResultDate) > DateValue(sLastDataDate) - 7 Then
> If DateValue(ResultDate) < DateValue(sLastDataDate) + 60 Then
> ...
> End If
>End If
>
>Mike
>
>--- news://freenews.netfront.net/ - complaints: news(a)netfront.net ---


Yes. The test shows your suggestion increases the speed a tad. This
particular code ran at 4.6. With the change you suggested, 4.1.

Unfortunately, the original problem still exists as this increase is
too minor.

Here is something else I have noticed. I found a couple of other XP
machines that also ran this application slow at this section of code.
What was the difference between the fast XP and slow XP machines?

The machines where it ran slower do not have VB6 installed. Don't know
if that provides any clues, but this is just so strange. When I say
slow, I mean...

slooooooooooooooooooooooooooooooowwwwwwwwwwwwwwwww.

Minutes instead of seconds, seriously! It just looks like the whole
thing has locked up. If not patient to wait and start clicking around,
it will go "no response". Most users won't tolerate that kind of
slowness.

Thanks.

Webbiz
From: Webbiz on
On Thu, 25 Feb 2010 09:32:01 -0800, "Bob Butler" <noway(a)nospam.ever>
wrote:

>
>"mscir" <mscir(a)yahoo.com> wrote in message
>news:hm6bof$ma7$1(a)adenine.netfront.net...
>> I don't think this is causing any speed problems, but I was wondering how
>> IF statements are executed when they include an AND, is the IF evaluated
>> as FALSE if the first condition is FALSE or are both evaluated?
>
>VB does not short-circuit expressions like some other languages do; all
>parts are evaluated.
>

Ah, and so it goes and evaluates the expressions after the AND whether
or not the first expression is true or false.

That explains the speed differences.

:-)
Webbiz