none
Visual Studio 2012 Excel Addin loads slowly RRS feed

  • Question

  • Hi,

    I am working on a Visual Studio 2012 Excel Add-In project in which I am using the Designer to create a custom Ribbon functionality. I have published the Excel Add-In project using Load-on Demand setting (LoadBehavior 10(16) in registry) to ensure that office users won't see a performance hit when they open excel (LoadBehaviour 3 would load addin on launching excel)

    The drawback of this load-on demand setting is that when the users click on my custom addin tab, it takes anywhere between 6 to 10 seconds to load which I feel is quite a delay. The excel built-in addins don't take so much time. 

    Are there ways to speed up the loading of my custom addin? 

    Thanks

    Chaitak


    Saturday, October 11, 2014 12:14 PM

Answers

  • You need to run a long-running tasks in secondary threads. Try to add log statements and see what lines of code take too much time. For example, reading data from disk is a time-consuming operation which can be done in another thread.

    Sunday, October 12, 2014 3:36 PM
  • Chaitak,

    If you need to run a long-running task, for example, get a web response or read the data in the database, you can run all these stuff in a background. Thus, your add-in will be loaded faster. The data will be processed in the background, the UI will not be blocked or frozen. 

    Sunday, October 12, 2014 6:26 AM

All replies

  • Hello Chaitak,

    How much time does the Load event handler take? Did you try to measure your code?

    You can treat your add-in as a regular .Net application. So, you can use the same techniques as .Net developers use:

    1. NGEN.exe - prebuilt native images. It will help not to spend a lot of time for JIT-er.

    2. Do the initialization process in another thread(s).

    Did you have a chance to test a clean  add-in project? Is there any difference between yours and new one?

    Saturday, October 11, 2014 12:49 PM
  • Hi Eugene,

    Thanks for your suggestions. I will try these.

    Can you elaborate (sample code) a little more on point 2. 

    Thanks

    Chaitak

    Saturday, October 11, 2014 3:53 PM
  • Chaitak,

    If you need to run a long-running task, for example, get a web response or read the data in the database, you can run all these stuff in a background. Thus, your add-in will be loaded faster. The data will be processed in the background, the UI will not be blocked or frozen. 

    Sunday, October 12, 2014 6:26 AM
  • Thanks Eugene for your help!!!

    The operations that I am calling on Ribbon_Load are the following:

    1) Loading 2 combo boxes with data from an xml file.

    2) Loading 1 combo box with data from one of the excel sheet.

    3) Loading multiple images from resource file.

    Also I tested with an empty excel addin project, it loads in a blink. So it is something to do with my addin.

    Please let me know how I can speed up these operations..


    Sunday, October 12, 2014 3:22 PM
  • You need to run a long-running tasks in secondary threads. Try to add log statements and see what lines of code take too much time. For example, reading data from disk is a time-consuming operation which can be done in another thread.

    Sunday, October 12, 2014 3:36 PM
  • Thanks Eugene,

    I will try this tomorrow...

    Sunday, October 12, 2014 4:25 PM