Download add-in faster when cold boot

We are creating an add-in for Microsoft Word (2007 and 2010). We encounter a delay problem when we launch our add-on during cold boot, that is, the machine turns off and returns. Then the first launch of Word takes about 30-35 seconds. Subsequent launches are faster.

We thought that this could be caused by a delay when loading the VSTO and .NET dll from disk to memory. To test this, we created a dummy Word add-in that did not contain code at all. With a cold boot, when loading only this add-in, Word took about 17 seconds to start.

Is there any way to speed up this process? If there are any methods that can speed up loading of VSTO and .NET, this will be very helpful.

+4
source share
2 answers

To test this, we created a Word dummy that did not contain any code.

This is the wrong test of your theory. Even an add-in that does not contain code at all requires loading the .NET Framework DLLs to load.

When you add additional dependencies to your actual add-in, this explains why you see a doubling of the required load time (from 17 to 35 seconds).

This is a known โ€œproblemโ€ with .NET solutions - if the .NET runtime is not loaded, they start to run slowly for the first time. Subsequent startup times are much faster.

In fact, you cannot do this except to run NGEN over your assembly . It might help cold starts a bit, but it has other consequences, and therefore I would not recommend this as a simple question, of course. My recommendation was simply to get used to slowing down a cold start or switching to another technology.

+2
source

There are two registry keys that can affect the load time of the add-in: LoadBehavior and Warmup . Read about them here .

Set LoadBehavior to 9 (Load on demand) so that your add-ons load when they are first used, and not when Word starts, thereby reducing the startup time of Word.

Setting Warmup to 1 may help. This will cause the .NET environment and the VSTO runtime to load before your add-in to "reduce the perceived time to load the add-in." (Personally, Iโ€™m not sure how much of this effect has. My load loads are very fast, so I didnโ€™t see a boost from using this setting.)

In general, itโ€™s strange that your add-in takes a very long time to load. I suggest that you carefully study the code that runs when the add-in loads (constructors, load events, etc.).

+2
source

Source: https://habr.com/ru/post/1413146/


All Articles