c# - Performance issue when launching WPF application -


i have complex wpf application using lot of resources shared resource dictionary. first window initialized takes 8 seconds initialize. performance issue less on ssd disk drives still requires 2 seconds.

i tried use visual studio profiler , shows big expense of time on initializecomponent(); of windows needs displayed.

i believe related resource dictionary used can't replace because need , because windows , wpf elements using staticresource references.

i tried optimize launch as possible. created many background threads didn't helped much. whenever window needs displayed must attached on ui thread under same dispatcher. makes big performance issue , ui , progress bar left on screen blocked.

so summarize. point when showdialog called until window displayed takes 8 seconds. visible on first window. other window opened after displayed quickly.

now asking firstly happens in background , why delay big , second can done increase startup speed.

i didn't mentioned there no exceptions or dataerrors present during launch not related exceptions.

i believe initialization of buttons , other components because of them have controltemplate restyled.

lots of assemblies need loaded , lots of code must jit compiled before first window can shown. 1 useful technique reduce startup time structure code in such way types not loaded before needed. may preferable blank window on screen wait indicator before delving code outside of core wpf assemblies. optimize scenario.

avoid loading images/media , other resources if trying on screen possible.

avoid loading data synchronously, , little in view , view model constructors possible. defer loading of data until view has been shown (throw wait indicator if necessary).

if think xaml resources problem, split them up, , have each view pull in resources needs. don't merge them app.xaml. might how share resources more efficiently across multiple views.

throwing splash screen can improve perceived startup time. getting anything on screen let user know app doing goes long way.

lastly, don't fret much; poor startup time hallmark of wpf applications, , in end, there's can do.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -