VS 2005 Time delay in calling subroutine (Office Interop)

Hi to the group,
I wrote a program originally in VB.NET 2003 to retrieve some outlook items.
The program runs just fine.
I have recently converted it to VB.NET 2005 and here is the issue:

Program loads and runs up to the point of calling a subroutine -
'GetSomeOutlookItems'. The program has thus far taken about 1/2 second or so.
The subroutine is in its own module and imports Microsoft.Office.Interop.
The program now takes about 6 to 8 seconds to actually get to this subroutine.
Once the program gets there it takes about 1/2 second to finish loading all the data.

Is there something I am overlooking or doing wrong
Did VS2005 convert my program correctly

Thks in advance,
Any all suggestions are welcomed,

Dave



Answer this question

VS 2005 Time delay in calling subroutine (Office Interop)

  • Hancz

    Ahh, because the CLR has compiled and cached the assemblies involved on the first run - that makes sense. You may want to generate a native version of your assemblies for better performance (using ngen).

  • Jorge MVP

    Does the performance/speed improve on multiple runs in series

  • araus

    I will try this as soon as I learn how to use ngen.

    Eventhough this app takes longer to load, I feel that I at least know why.

    Many thanks to your help,

    Rgs,

    Dave

     


  • Sugoiram

    I opened Outlook and then started my application. The app took just as long to get from calling the sub to getting to the sub.

    The app was originally developed in VS 2003 and worked under Framework 1.1. There was no noticeable delay.

    I do not really know how Framework / Office.Interop works. You may be quite correct in that there is a 'process' that needs to take place before the called subroutine can be executed.

    FYI, the time delay does not exist while working within the IDE. The delay only happens when executing the complied .exe file.

    Dave

     


  • mikejliddell

  • Jeffrey E. Moeller

    The time is reduced by about 40% - 50% on the second run and no further time savings on subsequent runs.

    Dave

     


  • Daniel Kunstek

    That sounds about right. Remember that the Office Interops work with running Office processes. So, if the processes aren't running, they get started first. It's the load time in starting the processes that takes time. For example, if you're retrieving e-mails from Outlook, and it's not open, the Interop will open it, do its work, and then close it.

  • VS 2005 Time delay in calling subroutine (Office Interop)