Preload all assemblies (JIT)

前端 未结 5 2211
抹茶落季
抹茶落季 2020-12-10 08:53

We are taking a hit the first time some heavy UI screens are loaded. Our project is divided into one main executable and several DLL files. The DLL files can also contain UI

5条回答
  •  遥遥无期
    2020-12-10 09:09

    You can just create instances of the classes located in externall assemblies. Just call the constructor in a limited scope (I mean declare the variable inside a function. It should not be global var because it will delay GC to dispose that instance). This will load the assembly, compile it and cache it. You can even do this in a background thread so the main thread will keep responsiveness.

提交回复
热议问题