dbrizov / NaughtyAttributes

Attribute Extensions for Unity
MIT License
4.53k stars 464 forks source link

GC allocs for rendering #367

Open lucasmontec opened 1 year ago

lucasmontec commented 1 year ago

I'm getting around half mb of GC allocs when rendering a component with just a few attributes. The asset also seems to be making assembly reloading sometimes slow, scaling somewhat badly as it grows in numbers. Have you checked performance issues with a very large amount of attributes?

image

lucasmontec commented 1 year ago

Its getting worse. I had to abandon the asset for 2 projects in my company. Unfortunately, it's blowing up with allocations (around 7MB per frame) on certain cases. I’ve tracked it down to something with the serialized reference elements using PropertyField with showChildElements=true causing it to blow up. Its something around the PropertyHandler.GetHeight() and the UseReorderabelListControl(). Its calling RuntimeFieldInfo.GetValue() lots of times. There's a string format call that is called a lot and allocs a lot. There's also a runtimeType.ToString allocation around .6MB per frame.

My team member reported over 100mb per frame.

profiler snapshot: https://mega.nz/file/AA13wLbD#u_eao9JWr2eemvLwrORIIUkleapeIDe55eG2x8qQm4k