Click here to Skip to main content
15,921,454 members
Home / Discussions / C#
   

C#

 
GeneralRe: Pointers Performance Pin
Leslie Sanford27-Jul-07 18:39
Leslie Sanford27-Jul-07 18:39 
AnswerRe: Pointers Performance Pin
Guffa27-Jul-07 22:13
Guffa27-Jul-07 22:13 
GeneralRe: Pointers Performance Pin
Leslie Sanford28-Jul-07 5:27
Leslie Sanford28-Jul-07 5:27 
GeneralRe: Pointers Performance [modified] Pin
Robert Surtees28-Jul-07 6:34
Robert Surtees28-Jul-07 6:34 
GeneralRe: Pointers Performance Pin
Leslie Sanford28-Jul-07 7:55
Leslie Sanford28-Jul-07 7:55 
GeneralRe: Pointers Performance Pin
Guffa28-Jul-07 9:33
Guffa28-Jul-07 9:33 
GeneralRe: Pointers Performance Pin
Robert Surtees28-Jul-07 10:58
Robert Surtees28-Jul-07 10:58 
AnswerRe: Pointers Performance Pin
Guffa28-Jul-07 13:37
Guffa28-Jul-07 13:37 
Well, the resulting code is a bit different, even in release mode.

The C# code:
*p = 42;
p++;
vs.
*p++ = 42;

The IL code:
ldloc.1
ldc.i4.s 0x2a
stind.i4
ldloc.1
ldc.i4.4
conv.i
add
stloc.1
vs.
ldloc.1
dup
ldc.i4.4
conv.i
add
stloc.1
ldc.i4.s 0x2a
stind.i4

The generated code:
mov dword ptr [ebx],2Ah
add ebx,4
vs.
mov edi,ebx
add ebx,4
mov dword ptr [edi],2Ah

I guess that the second code may be faster as the add and mov can be executed in parallell. In the first code the add has to wait for the move, as they use the same register.

---
single minded; short sighted; long gone;

AnswerMessage formatting question (expires on sunday) Pin
Luc Pattyn27-Jul-07 23:34
sitebuilderLuc Pattyn27-Jul-07 23:34 
GeneralRe: Message formatting question (expires on sunday) Pin
Leslie Sanford28-Jul-07 5:35
Leslie Sanford28-Jul-07 5:35 
GeneralRe: Message formatting question (expires on sunday) Pin
Luc Pattyn28-Jul-07 5:44
sitebuilderLuc Pattyn28-Jul-07 5:44 
GeneralRe: Message formatting question (expires on sunday) Pin
Leslie Sanford28-Jul-07 5:46
Leslie Sanford28-Jul-07 5:46 
GeneralRe: Message formatting question (expires on sunday) Pin
Luc Pattyn28-Jul-07 5:54
sitebuilderLuc Pattyn28-Jul-07 5:54 
GeneralRe: Message formatting question (expires on sunday) Pin
Leslie Sanford28-Jul-07 6:18
Leslie Sanford28-Jul-07 6:18 
GeneralRe: Message formatting question (expires on sunday) Pin
Luc Pattyn28-Jul-07 7:15
sitebuilderLuc Pattyn28-Jul-07 7:15 
QuestionInterActive javaScripte With Combobox html control Pin
Thaer Hamael27-Jul-07 15:53
Thaer Hamael27-Jul-07 15:53 
AnswerRe: InterActive javaScripte With Combobox html control Pin
Christian Graus27-Jul-07 16:54
protectorChristian Graus27-Jul-07 16:54 
Questionmigrating C to C# Pin
abstarsss27-Jul-07 14:00
abstarsss27-Jul-07 14:00 
AnswerRe: migrating C to C# Pin
Luc Pattyn27-Jul-07 14:19
sitebuilderLuc Pattyn27-Jul-07 14:19 
AnswerRe: migrating C to C# Pin
Christian Graus27-Jul-07 14:25
protectorChristian Graus27-Jul-07 14:25 
AnswerRe: migrating C to C# Pin
abstarsss27-Jul-07 14:41
abstarsss27-Jul-07 14:41 
QuestionHow can i know witch button was click ? Pin
Yanshof27-Jul-07 12:18
Yanshof27-Jul-07 12:18 
AnswerRe: How can i know witch button was click ? Pin
Christian Graus27-Jul-07 12:30
protectorChristian Graus27-Jul-07 12:30 
GeneralRe: How can i know witch button was click ? Pin
Yanshof27-Jul-07 12:33
Yanshof27-Jul-07 12:33 
GeneralRe: How can i know witch button was click ? Pin
Christian Graus27-Jul-07 12:59
protectorChristian Graus27-Jul-07 12:59 

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.