Click here to Skip to main content
15,906,301 members
Home / Discussions / C#
   

C#

 
AnswerRe: Windows Process and MEF Pin
Eddy Vluggen22-Jan-14 8:28
professionalEddy Vluggen22-Jan-14 8:28 
AnswerRe: Windows Process and MEF Pin
Ron Beyer22-Jan-14 8:40
professionalRon Beyer22-Jan-14 8:40 
Questionexecuting rake from C# app Pin
lune1221-Jan-14 22:44
lune1221-Jan-14 22:44 
AnswerRe: executing rake from C# app Pin
Pete O'Hanlon21-Jan-14 23:02
mvePete O'Hanlon21-Jan-14 23:02 
GeneralRe: executing rake from C# app Pin
lune1222-Jan-14 0:33
lune1222-Jan-14 0:33 
GeneralRe: executing rake from C# app Pin
Pete O'Hanlon22-Jan-14 0:35
mvePete O'Hanlon22-Jan-14 0:35 
GeneralRe: executing rake from C# app Pin
lune1222-Jan-14 0:51
lune1222-Jan-14 0:51 
GeneralRe: executing rake from C# app Pin
Pete O'Hanlon22-Jan-14 0:57
mvePete O'Hanlon22-Jan-14 0:57 
AnswerRe: executing rake from C# app Pin
Bernhard Hiller22-Jan-14 20:34
Bernhard Hiller22-Jan-14 20:34 
QuestionError in DataGridView Filter Pin
a-erfani21-Jan-14 22:18
a-erfani21-Jan-14 22:18 
QuestionRe: Error in DataGridView Filter Pin
Richard MacCutchan21-Jan-14 23:20
mveRichard MacCutchan21-Jan-14 23:20 
AnswerRe: Error in DataGridView Filter Pin
a-erfani22-Jan-14 5:19
a-erfani22-Jan-14 5:19 
GeneralRe: Error in DataGridView Filter Pin
Richard MacCutchan22-Jan-14 5:25
mveRichard MacCutchan22-Jan-14 5:25 
GeneralRe: Error in DataGridView Filter Pin
a-erfani22-Jan-14 5:29
a-erfani22-Jan-14 5:29 
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 

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.