I think the biggest GC-related performance benefit of value types isn’t that you can allocate them on the stack, since a generational GC will easily eat up those allocations. It’s so that more *long-lived* data can become pointer-free and not scanned at all.
-
-
Of course in Java you would often optimize this as “class Particle { float pX, pY, pZ, vX, vY, vZ; }”. But then you’re in the bad situation of having to choose between having nice methods on vectors and performance. Value types let you have both.
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Caches work a lot better with data structured in this way too. I wonder what parts contribute to what degree.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.