C#. Struct design. Why 16 byte is recommended size?

Posted by maxima120 on Stack Overflow See other posts from Stack Overflow or by maxima120
Published on 2010-03-09T08:56:09Z Indexed on 2010/03/09 9:06 UTC
Read the original article Hit count: 180

I read Cwalina book (recommendations on development and design of .NET apps).

He says that good designed struct has to be less than 16 bytes in size (for performance purpose).

My questions is - why exactly is this?

And (more important) can I have larger struct with same efficiency if I run my .NET 3.5 (soon to be .NET 4.0) 64-bit application on i7 under Win7 x64 (is this limitation CPU / OS based)?

Just to stress again - I need as efficient struct as it is possible. I try to keep it in stack all the time, the application is heavily multi-threaded and runs on sub-millisecond intervals, the current size of the struct is 64 byte.

© Stack Overflow or respective owner

Related posts about c#

Related posts about struct