What scenarios maximize the effect of higher case performance on x64 for C # code?

From Eric Lippert blog The truth about value types is clear that the number of registers can have a significant impact on code performance. What are the code criteria that benefit most from the higher number of registers on x64 systems? Are there any good examples?

It is clear to me that the number of registers is not the only and not even the most important aspect of the x64 platform, but if there are such criteria, should the platform on which we plan to run our code affect how we write our code?

+8
c # 64bit cpu-registers
source share
1 answer

The short answer to your question is definitely no.

The biggest advantage when programming in C # (or Java) is that you don’t have to worry about things like storage location or unclean pointers.
The CLR is not designed for real-time applications in any case, or, in other words, to provide this type of control over equipment, it is intended for a quick application development tool, and it is there that its strength - of course, the price is the inability to control behavior at a low level.

In general, there are no encoding criteria, but there are exceptions, such as using a string builder instead of writing string_Result = string_X + string_Y + string_Z in an iteration.
but it has more to do with proper coding or optimized coding regardless of CLI or C #.

+1
source share

Source: https://habr.com/ru/post/651236/


All Articles