Home All Groups Group Topic Archive Search About

ISDATE() took 8 seconds to complete ?

Author
15 Aug 2006 9:36 PM
MT
Platform : VB.NET 2003
I have code as below.
Question: The 8 seconds only occured on the 1st time the code run.  If I
click the button again , the interval become smaller than 1 seconds.  This
sympton occured on multiple development PC that run the .NET 2003.  Any idea
why is that ?

* Code :

    Private Sub btnTiming_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnTiming.Click
        Dim blnResult As Boolean

        Debug.WriteLine("start time: " & Now())
        blnResult = IsDate("88/88/8888")
        Debug.WriteLine("end time: " & Now())

    End Sub

* Output Result show:
start time: 8/15/2006 5:32:14 PM
end time: 8/15/2006 5:32:22 PM

Author
15 Aug 2006 11:46 PM
Jay B. Harlow [MVP - Outlook]
MT,
| Any idea
| why is that ?
The benefits (and also pitfalls) of JIT compiling.

Remember that VB.NET creates MSIL code. At run time the CLR converts your
MSIL code into executable code the first time you execute a routine.
Subsequent calls to that routine will be faster as the JIT itself has
already been complete.

NOTE: The JIT steps occurs each time you execute the program. You can use
NGEN to pre-JIT your assembly, however I understand that a JIT still
occurs...



--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


Show quoteHide quote
"MT" <sales_nospam@mft.com> wrote in message
news:%23JLO9JLwGHA.2260@TK2MSFTNGP03.phx.gbl...
| Platform : VB.NET 2003
| I have code as below.
| Question: The 8 seconds only occured on the 1st time the code run.  If I
| click the button again , the interval become smaller than 1 seconds.  This
| sympton occured on multiple development PC that run the .NET 2003.  Any
idea
| why is that ?
|
| * Code :
|
|    Private Sub btnTiming_Click(ByVal sender As System.Object, ByVal e As
| System.EventArgs) Handles btnTiming.Click
|        Dim blnResult As Boolean
|
|        Debug.WriteLine("start time: " & Now())
|        blnResult = IsDate("88/88/8888")
|        Debug.WriteLine("end time: " & Now())
|
|    End Sub
|
| * Output Result show:
| start time: 8/15/2006 5:32:14 PM
| end time: 8/15/2006 5:32:22 PM
|
|
|
|
Author
16 Aug 2006 5:53 AM
Cor Ligthert [MVP]
MT,

That is because in VBNet 2003 the ISDate is using the standard error try
catch mechanisme inside. Therefore that time is only the first time taking
so much time. This is now changed with a TryCast in VB2005, therefore this
behaviour should be changed also in the VB2005 version.

However the time you call is extremely long, is this done on an slow
processor?

I hope this gives an idea,

Cor

Show quoteHide quote
"MT" <sales_nospam@mft.com> schreef in bericht
news:%23JLO9JLwGHA.2260@TK2MSFTNGP03.phx.gbl...
> Platform : VB.NET 2003
> I have code as below.
> Question: The 8 seconds only occured on the 1st time the code run.  If I
> click the button again , the interval become smaller than 1 seconds.  This
> sympton occured on multiple development PC that run the .NET 2003.  Any
> idea why is that ?
>
> * Code :
>
>    Private Sub btnTiming_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles btnTiming.Click
>        Dim blnResult As Boolean
>
>        Debug.WriteLine("start time: " & Now())
>        blnResult = IsDate("88/88/8888")
>        Debug.WriteLine("end time: " & Now())
>
>    End Sub
>
> * Output Result show:
> start time: 8/15/2006 5:32:14 PM
> end time: 8/15/2006 5:32:22 PM
>
>
>
>