Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Strange delays in executing code

Posted on 2012-03-23
9
Medium Priority
?
359 Views
Last Modified: 2012-04-02
Hi all,

I've build an application which runs fine but for some reason on certain pc's it (much) slower. The pc's are exactly the same concerning the hardware.

To debug I have added traces and the delays seems to come... from nowhere!

On a slow pc the following code takes about 0,5 seconds to complete:

if (this.MyObject == null) { ... }

On a fast pc this takes milliseconds.

Any ideas on how to profile/debug/check this and more important, how to solve this?

Thanks!

D'Mzzl
RoverM
0
Comment
Question by:roverm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 18

Expert Comment

by:UnifiedIS
ID: 37758313
What is 0,5 seconds?

Antivirus is always something to consider as a cause for slow response.  Try running the app with it shut down.

You could try running the app in safe mode also.
0
 
LVL 18

Expert Comment

by:Gary Davis
ID: 37759359
Well this.MyObject is (probably) a property and you are getting its value. A property can do a lot of processing and it is hidden from you when looking at the statement.

Check out what is happening by looking at the definition of the MyObject. Maybe something obvious will show.

Also, try breaking the line into two and see if the delay is in the 1st line (checking with the debugger):

var myObject = this.MyObject;
if (myObject == null) { ... }

Gary Davis
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 37759393
It sounds like an environmental problem.  Checking/stopping the antivirus is a good step.  The flipside is to make sure there is no malware present.  

Check if the CPU is being pegged by any rogue apps.
Is the network working at decent speed?
Is the hard drive thrashing?

Perfmon can also be a useful tool for figuring out what's going on under the hood--looking at threading issues, or memory issues.

PerfMon – Your debugging buddy
0
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 
LVL 12

Author Comment

by:roverm
ID: 37760212
Thanks for your responses.

Anti-Virus: This is a contained test, no anti-virus present. Also: Each machine is exactly the same.

Myobject is not a property, it's a class. So it's a reference to a pointer if it's checked for null.

Perfmon: I thought of that too but any suggestions on which counters to check?
0
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 1000 total points
ID: 37760333
The processes tab in the Task Manager is often a good way to see what slows down the system. Sort in on CPU and see if anything is taking up time from the microprocessor.

You can also check the performance tab. If any of the 2 default graphs is near the top, then there is something holding the program on the computer. If the memory is almost full, the computer is working with the swap file. This slows things a lot.

The Resources Monitor that can be called from that tab is also a good way to see what is happening on the computer.

Is the hard disk fragmented or does not have much space left?
0
 
LVL 12

Author Comment

by:roverm
ID: 37760358
The resource monitor and taskmanager is not showing anything unusual. I will try the perfmon to monitor it over time.
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 1000 total points
ID: 37766702
You might try running some benchmark software and comparing to the other systems to see if any subsystems are causing slow downs.

NovaBench
http://novabench.com/download.php

SiSoft Sandra (Has a lite version that is free)
http://www.sisoftware.net/

Re: Perfmon, you definitely want a profile for your app of the general memory use, exceptions thrown, number of threads, thread contention and processor time.  Do a comparison to the systems where it is working quickly.
0
 
LVL 12

Assisted Solution

by:roverm
roverm earned 0 total points
ID: 37767789
Hi Paul,

Tomorrow I have an whole day planned for debugging, monitoring and testing... Hope it helps, thanks.
0
 
LVL 12

Author Closing Comment

by:roverm
ID: 37795259
Hi all,

I have found the cause of the problem. Not by using any of your suggested solutions (that why I devided the point to the best suggestions) but by debugging.
The problem was the updating of the UI. At one point the mainform of the application was disabled (this.Enabled = false). This statement took milliseconds but as soon as .NET "thought" it had time to update the UI it blocked everything else. Once I remove this statement the speeds was the same on all pc's (fast!).

But I needed to disable/enable the mainform to prevent the user from entering information in an illegal state. I solved this by bringing an overlay (panel) to the front and push it back once done. This takes less than 1ms and does not block the UI.

Thanks for your suggestions.
D'Mzz!
RoverM
0

Featured Post

Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question