The 16-Byte Rule: Unraveling the Performance Mystery of C# Structures
🇬🇧 Many C# developers are familiar with the following statements. By default, when passing to or returning from a method, an instance of a value type is copied, while an instance of a reference type is passed by reference. This has led to a belief that utilizing structures may degrade the overall app performance, especially if the structure has a size greater than 16 bytes. The discussion about this is still ongoing. In this article, we will try to find the truth.
🇷🇺 Многие C# разработчики знакомы со следующим утверждением: по умолчанию, при вызове метода или возврате из него, экземпляр типа значения копируется, а экземпляр ссылочного типа передается по ссылке. В связи с этим распространено убеждение, что использование структур может снизить общую производительность приложения, особенно если размер структуры превышает 16 байт. Дискуссии на этот счёт до сих пор ведутся. В этой статье мы попытаемся докопаться до истины.
Post #49
181

- ✍ 2