471,326 Members | 1,881 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,326 software developers and data experts.

Problems Only When Using Run Without Debugging

Hi Everyone,

I have been having a bizarre problem when I do Run Without Debugging
(I have been doing this do to the intensity of some code which runs
slow when Debugging). When I run without debugging, the application
appears hangs on this code:
private static CCPix ClusterListHasPoint(Point ring,
List<CCPixtileList)
{
for (int i = 0; i < tileList.Count; i++)
{
if (tileList[i].Location.X == ring.X &&
tileList[i].Location.Y == ring.Y)
{
return tileList[i];
}
}
return null;
}
If the if statement is taken out, the loop does eventually finish
without debugging... but ridiculously longer.
With Debugging on, it does not cause a problem. Does anyone have any
thoughts? I've been looking around the web without too much luck :-\ I
have a feeling I am missing something small.
Thanks,

Will
Jun 27 '08 #1
4 1319
Will,
>I have been having a bizarre problem when I do Run Without Debugging
(I have been doing this do to the intensity of some code which runs
slow when Debugging). When I run without debugging, the application
appears hangs on this code:
private static CCPix ClusterListHasPoint(Point ring,
List<CCPixtileList)
{
for (int i = 0; i < tileList.Count; i++)
{
if (tileList[i].Location.X == ring.X &&
tileList[i].Location.Y == ring.Y)
{
return tileList[i];
}
}
return null;
}
If the if statement is taken out, the loop does eventually finish
without debugging... but ridiculously longer.
Not sure I parse this latest statement correctly - what exactly is your problem - does the following loop:

for (int i = 0; i < tileList.Count; i++)
{
}

with the if statement removed, really take long?
>With Debugging on, it does not cause a problem.
Does anyone have any
thoughts? I've been looking around the web without too much luck :-\ I
have a feeling I am missing something small.
I can't see anything obviously wrong with the code posted. Of course, you've not posted all your code - is CCPix special
in some way? Of what type are "Location"? How high is tileList.Count?

Regards,
Gilles.

Jun 27 '08 #2
Will wrote:
Hi Everyone,

I have been having a bizarre problem when I do Run Without Debugging
(I have been doing this do to the intensity of some code which runs
slow when Debugging). When I run without debugging, the application
appears hangs on this code:
[...]
If the if statement is taken out, the loop does eventually finish
without debugging... but ridiculously longer.
If it's not performant enough, why not try a predicate and use tileList.Find()?

http://msdn2.microsoft.com/en-us/library/x0b5b5bc.aspx

Here's an example of what I'm talking about:

public static Point HasPoint(Point tgt, List<PointptList)
{
Predicate<Pointp = new Predicate<Point>(
delegate(Point itm) { return (itm.X == tgt.X && itm.Y == tgt.Y); });

return ptList.Find(p);
}

Chris.
Jun 27 '08 #3
On Apr 24, 8:30*am, Chris Shepherd <c...@nospam.chsh.cawrote:
Will wrote:
Hi Everyone,
I have been having a bizarre problem when I do Run Without Debugging
(I have been doing this do to the intensity of some code which runs
slow when Debugging). When I run without debugging, the application
appears hangs on this code:
[...]
If the if statement is taken out, the loop does eventually finish
without debugging... but ridiculously longer.

If it's not performant enough, why not try a predicate and use tileList.Find()?

http://msdn2.microsoft.com/en-us/library/x0b5b5bc.aspx

Here's an example of what I'm talking about:

public static Point HasPoint(Point tgt, List<PointptList)
{
* * Predicate<Pointp = new Predicate<Point>(
* * * *delegate(Point itm) { return (itm.X == tgt.X && itm.Y == tgt.Y); });

* * *return ptList.Find(p);

}

Chris.
Hi Chris,

Thanks for the post. Interestingly enough, I implemented the Predicate
example you referenced. Now instead of just becoming stuck, Running W/
O Debugging Does finish. It is still approximately executing about 40
times slower though... 240 seconds versus 6 seconds. At least it is a
step in the right direction.
Thanks again,

Will
Jun 27 '08 #4
Will wrote:
Hi Chris,

Thanks for the post. Interestingly enough, I implemented the Predicate
example you referenced. Now instead of just becoming stuck, Running W/
O Debugging Does finish. It is still approximately executing about 40
times slower though... 240 seconds versus 6 seconds. At least it is a
step in the right direction.
How much data are you sifting through?
What is the data stored in (class, or struct could be important here)?

Chris.
Jun 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Benedicte | last post: by
1 post views Thread by Tony Johansson | last post: by
reply views Thread by Bjørn Terje Svennes | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.