Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which scenarios maximize the performance impact of the higher register count in an x64 system for C# code?

From Eric Lippert's blog The truth about value types it is clear that the number of registers may have a major impact on code performance. What are the criterias of code that benefits the most from the higher register count in x64 systems? Are there any good examples?

It is clear to me that the register count is not the only and not even the most important aspect of a x64 platform, but if there are such criterias, should the platform that we plan to run our code on have an impact on how we write our code?

like image 804
Manu Avatar asked Jan 19 '11 08:01

Manu


1 Answers

The short answer to your question is definitely - no.

The biggest benefit when programming in C# (or Java) is that you do not need to worry about things like storage location or unclean pointers.
The CLR is not designed for real-time applications anyway or in other words to give you that type of control over the hardware, it is designed to be a rapid application development tool and that is where its force is - of course in the price of not being able to control the low level behaviors.

There are no coding criteria to benefit from in general but there are exceptions such as using string builder instead of writing string_Result=string_X+string_Y+string_Z in an iteration.
but this is more related to correct coding or optimized coding regardless of CLI or C#.

like image 108
G.Y Avatar answered Oct 13 '22 23:10

G.Y