Query About Nested Using Statements for Updating GUI

0
0

Hi,

I was just wondering from a performance perspective, is there anything wrong with using Application.Update whilst already inside an Application Update?

I use a fair bit of background processing and I noticed today I had a few places where I have the nested updates.

I cant see any performance issues but I just thought Id ask the experts.

Here is a small sample of what I’m talking about.  The sample is very basic concept, not a real world scenario.

In my real world scenario, the same method may or may not be called from the background.

private void MainMethod(int testValue) {

Wisej.Web.Application.Update(this, () => {

switch ( testValue ) {

case 0:

RunMethod1();

break;

case 1:

RunMethod2();

break;

}

});

}

private void RunMethod1() {

//Method Code Here

}

private void RunMethod2() {

Wisej.Web.Application.Update(this, () => {

//Method 2 Code Here

}

}

So Method 2 is also being executed inside an Update statement but the parent caller is already inside an Update.

So just wondering if I should analyse my real world code for each background operation and double check upon the nested Update calls.

Thanks,

Brayden.

 

  • You must to post comments
0
0

The performance hit should be negligible. Wisej keeps a list of “dirty” components (a component is marked dirty by calling the Update  method of the component). At the end of the normal request from the browser Wisej goes through the dirty components only and builds the response json containing only the differences.

When you use Application.Update() it does the same but it does it immediately and pushes the changes to the browser through the websocket connection. So if you call Application.Update() and nothing changed since the previous update the dirty list is empty and nothing happens.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.