Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
GeneralRe: Error in DataGridView Filter Pin
Richard MacCutchan22-Jan-14 5:36
mveRichard MacCutchan22-Jan-14 5:36 
GeneralRe: Error in DataGridView Filter Pin
a-erfani22-Jan-14 5:56
a-erfani22-Jan-14 5:56 
GeneralRe: Error in DataGridView Filter Pin
Dave Kreskowiak22-Jan-14 6:01
mveDave Kreskowiak22-Jan-14 6:01 
QuestionWhat's going on with this performance change? Pin
KP Lee21-Jan-14 19:16
KP Lee21-Jan-14 19:16 
GeneralRe: What's going on with this performance change? Pin
Richard MacCutchan21-Jan-14 23:13
mveRichard MacCutchan21-Jan-14 23:13 
GeneralRe: What's going on with this performance change? Pin
KP Lee22-Jan-14 8:52
KP Lee22-Jan-14 8:52 
AnswerRe: What's going on with this performance change? Pin
Matt T Heffron22-Jan-14 8:03
professionalMatt T Heffron22-Jan-14 8:03 
GeneralRe: What's going on with this performance change? Pin
KP Lee22-Jan-14 10:38
KP Lee22-Jan-14 10:38 
Thanks, it's good to know about Stopwatch, but doesn't explain a 150% shift in performance. (If it changed from 2 to 3 milliseconds, I wouldn't bat an eye, I'd expect that with DateTime.)
This is interesting:
looped: 4294967295 in 00:00:01.0834284
C#
System.Diagnostics.Stopwatch st = new System.Diagnostics.Stopwatch();
st.Start();
for (uint i = 0; i < x; i++) ;
st.Stop();
TimeSpan sp = new TimeSpan(st.ElapsedTicks);
Console.WriteLine("looped: {0} in {1}", x, sp);
Don't have StartNew on my 2010 express version and Start blows up with a void assignment to st.
Ran a stopwatch, got 5.93 seconds and I was slow on the trigger
C#
DateTime tim = DateTime.Now;
System.Diagnostics.Stopwatch st = new System.Diagnostics.Stopwatch();
st.Start();
for (uint i = 0; i < x; i++) ;
st.Stop();
TimeSpan sp = new TimeSpan(DateTime.Now.Ticks - tim.Ticks);
Console.WriteLine("looped: {0} in {1}", x, sp);
sp = new TimeSpan(st.ElapsedTicks);
Console.WriteLine("looped: {0} in {1}", x, sp);

Produced:
looped: 4294967295 in 00:00:04.1742388
looped: 4294967295 in 00:00:00.8532933

So, DateTime came up with a time that theory expects for that loop and the stop watch came up with 5 times faster than theory expects and what I am seeing. Gee, which one do you think I should trust? One that is slightly faster than my physical reflexes and closely aligns with theory or one that defies theory and observed behavior?

I'm guessing the stopwatch was trying to share the same CPU that needed 100% attention on the code it was running and threw out the timer.

So, putting changes that if anything should slow down the code works 150% better today? I don't get it.

Arrrg, pull out the stopwatch code and:
looped: 4294967295 in 00:00:06.2273562

put it back in:
looped: 4294967295 in 00:00:04.1612380
looped: 4294967295 in 00:00:00.8508048

Comment out the start and stop and...
looped: 4294967295 in 00:00:04.1622381
GeneralRe: What's going on with this performance change? Pin
Bernhard Hiller22-Jan-14 20:46
Bernhard Hiller22-Jan-14 20:46 
GeneralRe: What's going on with this performance change? Pin
KP Lee22-Jan-14 23:11
KP Lee22-Jan-14 23:11 
GeneralRe: What's going on with this performance change? Pin
Bernhard Hiller23-Jan-14 20:46
Bernhard Hiller23-Jan-14 20:46 
GeneralRe: What's going on with this performance change? Pin
KP Lee24-Jan-14 7:21
KP Lee24-Jan-14 7:21 
QuestionRegex select between two “strings” Pin
Hulu800421-Jan-14 15:29
Hulu800421-Jan-14 15:29 
AnswerRe: Regex select between two “strings” Pin
Dave Kreskowiak21-Jan-14 16:34
mveDave Kreskowiak21-Jan-14 16:34 
GeneralRe: Regex select between two “strings” Pin
Ron Beyer21-Jan-14 16:35
professionalRon Beyer21-Jan-14 16:35 
GeneralRe: Regex select between two “strings” Pin
Dave Kreskowiak21-Jan-14 16:51
mveDave Kreskowiak21-Jan-14 16:51 
QuestionC# Program Pin
redhuskie21-Jan-14 9:02
redhuskie21-Jan-14 9:02 
AnswerRe: C# Program Pin
Pete O'Hanlon21-Jan-14 9:06
mvePete O'Hanlon21-Jan-14 9:06 
GeneralRe: C# Program Pin
redhuskie21-Jan-14 9:12
redhuskie21-Jan-14 9:12 
GeneralRe: C# Program Pin
Nir Bar - AutoAppdate21-Jan-14 9:20
professionalNir Bar - AutoAppdate21-Jan-14 9:20 
GeneralRe: C# Program Pin
Pete O'Hanlon21-Jan-14 9:27
mvePete O'Hanlon21-Jan-14 9:27 
GeneralRe: C# Program Pin
redhuskie21-Jan-14 9:28
redhuskie21-Jan-14 9:28 
GeneralRe: C# Program Pin
Ravi Bhavnani22-Jan-14 10:55
professionalRavi Bhavnani22-Jan-14 10:55 
AnswerRe: C# Program Pin
BillWoodruff21-Jan-14 9:49
professionalBillWoodruff21-Jan-14 9:49 
AnswerRe: C# Program Pin
Rahul VB30-Jan-14 22:50
professionalRahul VB30-Jan-14 22:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.