Hey! Had a coding question:
In improved it's said:
Trace results no longer allocate arrays, reducing GC pressure — use `HasTag()` instead of the now-obsolete `.Tags` property
What does "no longer allocate arrays" means?
How does it help with GC?
What does it have to do with having a function returning what you're looking for instead of a property? :)))
Impatient to learn about it!!! ^^ 😊
It means they modifed the function so it no longer creates arrays. This means memory no longer has to be allocated for the arrays.
Reducing allocations means first... well you're not allocating, so saved work there. Plus those allocations don't need to be cleaned up by the GC later, so saved work there too. With less allocations the GC needs to run less often. All of this can improve memory usage and performance (especially if you have a bunch of these improvements or you run the affected code frequently per frame).
They were probably either unwilling to outright replace the code in Tags (maybe it behaves differently enough to not be 1:1 compatible) or they decided they wanted it to be a function after all (semantically, maybe it behaves like a function. For example properties may not be expected to do a lot of work or have side effects, whereas functions don't have this expectation). Either way, it wasn't possible to simply update Tags in-place. So they made a new function HasTags() which has the new desired behavior and is now a function. Tags is kept so old projects will still work, but it is given an ObsoleteAttribute so developers will see a warning identifying their usages of Tags and instructing them to change it to HasTags().