Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello.

I am maintaining a system with many clients to use web services on a server. Our programs are winform applications with some web service objects declared in many forms because we made the important operations to be processed on the server. Each winform program contains a main form and tens of child forms with web service objects declared as form-level objects in them.

The problem is when the web service objects are not only declared, but also initialized at the opening of the form, the opening of the form will be so slow. How can I approve the performance the win form creation?
Posted
Comments
Sergey Alexandrovich Kryukov 9-Sep-13 1:32am    
I would say, not enough information. It does not look like you complain about performance itself, but you just need the user to start dealing with application sooner. This is not the same as performance, but may certainly improve overall throughput in certain scenarios.
—SA

1 solution

Fist, please see my comment to the question.

Now, as I say, it really may make sense to startup the application sooner. As you did not provide any information useful to help you to improve performance (overall throughput, taking into account the human factor), you can address the problem if pre-initialized service objects on the client side. You should think about initialization of them prematurely. Instead, you can implement the call-by-need strategy:
http://en.wikipedia.org/wiki/Call_by_need[^].

Basically, you should keep the set of services with null references, and initialize them only when you are about to perform the very first call to each of them. Check for null, and if it is null, perform initialization.

—SA
 
Share this answer
 
Comments
Manoj K Bhoir 9-Sep-13 1:59am    
Perfect Answer.... My 5!
Sergey Alexandrovich Kryukov 9-Sep-13 2:08am    
Thank you, Manoj.
—SA
Momoko Asahina 708H 9-Sep-13 22:08pm    
Thank you. In our system, there are hundreds of child forms. Many of them use web services to complete important tasks. But in some of them , some web service objects are declared as form-level variables and initialized when opening the form; in the others, the web service objects are just declared as same level, or even appeared when needed by "USING". Opening these 2 kinds of forms take different time, the former case needs more time to open. I wish I can find a way to make the former case forms open faster.

Thank you for answering and subsuming my deficient question.
Sergey Alexandrovich Kryukov 10-Sep-13 0:26am    
You are welcome.
This only justifies application of the technique I suggested. Will you accept the answer formally (green button)?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900