views:

68

answers:

0

WPF utilizes a single thread to dispatch events via the windows event pump. When each control is created, it is associated with a thread and consequently all activities associated with that control need to occur on that thread.

We've got an application that has a large number of top-level windows, each with a host of controls within them. These controls can do enough updates that when aggregated together they force a significant amount of events through the windows event pump. Our desire is to come up with a means to efficiently allocate threads that process the windows event pump; for sanity, we assume that all controls associated with a top-level window are associated with the same event pump and consequently the same Dispatcher.

Does anyone have any recommendations, suggestions or know of a toolkit that assists in the allocation and utilization of such threads. I've seen examples on the web that describe a thread-per-window model; we're trying to avoid that. We're shooting for an efficient balance here and thread-per-window is likely to push too much activity to thread context switching.

Are there any toolkits that help you approximate how many events each thread is capable of processing (assuming you're not doing much more than handling the event and dispatching the real processing) for the specific hardware you are using. I'm sure that an i7 with 4 cores and hyperthreading has a much different footprint than a lesser machine.

It's also quite possible we're approaching this problem wrong. However, we believe that our current application is saturating the thread that is handling UI processing. If you've done high performance through a single thread, I'd like to hear about your experiences.