Struct vs Class

Hi there,

We’re aware about the color issue. We are trying to adjust the color palette but it’s a bit slower going than we’d hope as design wise that turns out to be a bit trickier than expected to find alignment on.

In the meantime, you could turn on Color Blind mode in the top right hand options menu of the Profiler window. That might make the colors clearer.

(And btw, because I also saw[ your post in the other thread]( Workflow Case Study - Show us your pain! page-13#post-7961172), the current goal is to have one set of colors that contrasts wise works out for all forms of color vision deficiencies while also looking estheticial and fitting into the rest of the Editor and ideally not being too far off the current palette as to be confusing “muscle memory”, also in the community when e.g. seeing a profiler screenshot with the legend cropped out. So, not as trivial as it might seem)

As for the optimization with ref and the cost of bigger structs: struct’s are passed by value so every time you hand them to a function, all values are copied. A bigger struct will eventually take so long to copy that the advantage of it costing less to allocate on the stack vs a class instance getting allocated on the heap and passed by pointer becomes less relevant.

The ref keyword takes care of the copying cost and the newer C# addition of ref returns also allows for the optimization of removing the struct value copy on return.

3 Likes