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

C#

 
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 
I wanted to see how close the performance of a loop in C# is to something written in assembly.
C#
uint x = int.MaxValue;
DateTime st = DateTime.Now;
for (uint i = 0; i < x; i++) ;
TimeSpan sp = new TimeSpan(DateTime.Now.Ticks - st.Ticks);
Console.WriteLine("looped: {0} in {1}", x, sp);

In Debug it ran in 6+ seconds. Oh, idiot! Compile it! Ran in 2.1+ to 2.2 seconds. It's rated at 2.1 GHz so it should have finished in just under 2 seconds, so close enough to assembler speeds.

Did some more changes elsewhere in the code and used uint to define x. Wha?? Over 6 seconds, went back to int, now it is 3 seconds.
looped: 4294967295 in 00:00:06.2643583
looped: 2147483647 in 00:00:03.0888054

It's like it changed from 2 flops per loop to 3 flops. When I checked performance logs, it runs at 50% CPU on a dual core machine, so it is showing 100% of one CPU is dedicated to this loop for the 3 seconds.

Any ideas why changes in other sections of logic might affect this piece? I'm normally running 90-97% idle with occasional dips to the 80's.

Modified:
1. Subject to be more specific
2. added last line of code segment because it was missing.

modified 22-Jan-14 1:29am.

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 
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 

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.