c# - Performance concern while opening a dialog repetitively in wpf -
i have launch dialog button creates view model of window , bind the window(it having ui virutalization enabled). takes 1 second launch dialog @ first click. if open same dialog or back, starts taking more time in populating grid data source next iteration. if give pause, again open window, takes approx 1 or 2 seconds.
for first time populating item source take 1 second: next time populating item source takes 2 second next time populating item source takes 3 second next time populating item source takes 6 second next time populating item source takes 8 second
however, if call gc.collect() not recommended, populating grid data source takes approx 1 second. calling of
gc.collect() gc.waitforpendingfinalizer() gc.collect()
cost me time every iteration.
i know calling gc.collect
not option. can suggest how can boost application performance.
i more concerned user machine machine configuration whereas user machine may not fast.
it difficult pinpoint exact issue without looking @ code. however, can happen due few reasons.
it loads more data (may double?) evertime. have indicated loads 200 records everytime. make sure logic correct , clears previous data before re-publish.
make sure unsubscribe event subscriptions. there can hiden events triggering previous grid instances. can check putting break on handle , checking if trigger more once.
look @ every disposable instances creating , check if dispose them appropriately. not disposing disposable instance , may reason gc.collect help.
i not quite sure virtualization involvement here. perform same test without virtualization make sure that's not reason.
Comments
Post a Comment