Click here to Skip to main content
15,903,388 members
Home / Discussions / C#
   

C#

 
GeneralRe: Most efficient switch statement variable to use? Pin
harold aptroot24-Feb-09 11:53
harold aptroot24-Feb-09 11:53 
AnswerRe: Most efficient switch statement variable to use? Pin
Luc Pattyn24-Feb-09 14:23
sitebuilderLuc Pattyn24-Feb-09 14:23 
GeneralRe: Most efficient switch statement variable to use? Pin
Deresen24-Feb-09 10:08
Deresen24-Feb-09 10:08 
GeneralRe: Most efficient switch statement variable to use? Pin
harold aptroot24-Feb-09 11:31
harold aptroot24-Feb-09 11:31 
GeneralRe: Most efficient switch statement variable to use? Pin
Deresen24-Feb-09 12:02
Deresen24-Feb-09 12:02 
GeneralRe: Most efficient switch statement variable to use? Pin
harold aptroot24-Feb-09 12:19
harold aptroot24-Feb-09 12:19 
GeneralRe: Most efficient switch statement variable to use? Pin
Deresen24-Feb-09 12:26
Deresen24-Feb-09 12:26 
GeneralRe: Most efficient switch statement variable to use? Pin
harold aptroot24-Feb-09 13:01
harold aptroot24-Feb-09 13:01 
Well then 1GB is indeed small Smile | :)
But RAM is slow (compared to the CPU), a cache miss can easily cost 100 cycles - long enough to justify doing complex calculations just to avoid the cache miss, plenty of time for 150 to 250 instructions

That makes me wonder what the theoretical maximum of instructions in 100 cycles is (on Core2)
500 if looking only at the predecoder specs: macro fusion can fuse 2 instructions but can only be done once per cycle, so 5 instructions (3 of which must be 1 µop) and the size of such a "block" should satisfy N*size = 16 (to Never cross a boundary) and no 66H or 67H prefixes should occur anywhere
But then looking at the rest: the sequence must not have any dependacy chains, not all instructions are perfectly pipelined, there are only 3 "normal" ports (0, 1 and 5) and even register reading can be a bottleneck.
Only 6 µops per cycle are allowed, but that includes memory read/write (bringing us down to 400 except for µop fusion)
The predecoder throughput would be less important (only the first iteration) if we were executing a small (less than 4 times 16 bytes) loop..
And I'm not even going to mention the rest.
The best throughput of any one instruction is 3/cycle (a stream of NOP's for example) so it should be possible to do (slightly) better than that, right?

This is too complex, I'll leave it to the pro's.








AnswerRe: Most efficient switch statement variable to use? Pin
Ennis Ray Lynch, Jr.24-Feb-09 8:43
Ennis Ray Lynch, Jr.24-Feb-09 8:43 
AnswerRe: Most efficient switch statement variable to use? [modified] Pin
harold aptroot24-Feb-09 11:23
harold aptroot24-Feb-09 11:23 
GeneralRe: Most efficient switch statement variable to use? Pin
harold aptroot25-Feb-09 1:30
harold aptroot25-Feb-09 1:30 
AnswerRe: Most efficient switch statement variable to use? Pin
Mark Churchill24-Feb-09 14:13
Mark Churchill24-Feb-09 14:13 
GeneralRe: Most efficient switch statement variable to use? Pin
PIEBALDconsult24-Feb-09 15:15
mvePIEBALDconsult24-Feb-09 15:15 
GeneralRe: Most efficient switch statement variable to use? Pin
harold aptroot24-Feb-09 15:42
harold aptroot24-Feb-09 15:42 
Questionapp.config file Pin
rcwoods24-Feb-09 6:17
rcwoods24-Feb-09 6:17 
QuestionSaving and loading a file Pin
bar300024-Feb-09 5:31
bar300024-Feb-09 5:31 
AnswerRe: Saving and loading a file Pin
CPallini24-Feb-09 5:39
mveCPallini24-Feb-09 5:39 
AnswerRe: Saving and loading a file Pin
Paul Kettley24-Feb-09 6:12
Paul Kettley24-Feb-09 6:12 
GeneralRe: Saving and loading a file Pin
Jon Rista24-Feb-09 6:21
Jon Rista24-Feb-09 6:21 
AnswerRe: Saving and loading a file Pin
Luc Pattyn24-Feb-09 7:23
sitebuilderLuc Pattyn24-Feb-09 7:23 
GeneralRe: Saving and loading a file Pin
PIEBALDconsult24-Feb-09 7:37
mvePIEBALDconsult24-Feb-09 7:37 
QuestionVSTO Outlook 2007 Pin
staticv24-Feb-09 4:14
staticv24-Feb-09 4:14 
AnswerRe: VSTO Outlook 2007 Pin
Calin Tatar24-Feb-09 4:34
Calin Tatar24-Feb-09 4:34 
GeneralRe: VSTO Outlook 2007 Pin
staticv24-Feb-09 4:40
staticv24-Feb-09 4:40 
QuestionExposing an already running singlton .NET component as COM server Pin
Omer S.24-Feb-09 4:05
Omer S.24-Feb-09 4:05 

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.