vb.net - fastest method of updating class properties -


i have rather large program , such going simplify bit.

so have list (of entity), entity being custom class heaps of properties. have 1ms timer, updates list. in timer creates temporary list external source, , if list different current list, updates main list.

now gets slow, think. have lot of threads, 1 each property of class updates property (the values come externally) , stop them all, otherwise whilst list gets updated throw kinds of errors. update main list temp list, , create new threads again e.g.

prop1thread = new thread(addressof updateprop1) 

and start them again.

pretty there better method use? properties have updated in different threads, otherwise destroys performance. can't change way list of entities either. need better way of handling updating of properties of changing list of entities.

firstly say: post code, because there's not enough information diagnose sure.

secondly: sounds though have lot of threads property updating. if have more threads have processors on machine, slowing code down more you're speeding up.

further, sounds you're doing lot of work work every 1ms on timer. being case, guess you're thrashing system aggressively - unless you're sure mention in question running in < 1ms. depending on how you're handling timer, it's possible have multiple iterations of code stacking up, contribute loss in performance.

my advice be:

  • drop down couple of threads (one property update handling, 1 timer) - sounds though have far many
  • reduce frequency of timer. in fact, rid of timer , test against single iteration see one-off update time is, , bring timer in understand how that's affecting performance (if @ all)
  • profile, profile, profile understand problem

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -