Why so many big structures in managed directx?
I was told to ask this question here to get an answer:
struct Caps 304 bytes struct Material 68 bytes ... These big structures are used as properties and passed here and there. Isn't this a big performance penalty? I checked the generated asm code, and it seems these's no optimization to remove the overhead. So anyone knows why?
[387 byte] By [
qrli] at [2008-2-14]
Well, I admit they do not executes every frame so their drawback can be ignored. But still I wonder the reason to use struct instead of class. Following the design guideline from MSDN (small, value symantic), it should be class, and it would be more efficient also. There should be some reason other than "it's not a performance hit".
E.g. for the Matrix struct, it's way slow for the lack of "const T&" in C#. But I can understand that it will be more slow if it's class because of the allocation stuff.
Just to add to what Tom has said...
You really need to look at some instrumentation before you can decide whether the size (in this case) is actually posing a problem.
If you're really stuck for memory space and your tools are telling you that such-and-such a struct/class is taking up unnecessary space then you should start looking for ways to get rid of it (or reduce it's size). Going the other way around (hunting for problems) rarely provides much reward 
hth
Jack