[2020-02] Use GArray instead of GList when getting custom attributes from an image (#19102)
* Use GArray instead of GList when getting custom attributes from an image
Xamarin.Forms calls this _constantly_ during startup, to the point where the malloc calls were actually showing up in the profile. This should help with that, and gives us some ms back during startup.
There are also a bunch of calls that return empty arrays, which in theory could be created in managed for a perf boost. However, it seems the Xamarin.Android team has mostly gotten rid of those calls and that optimization would complicate the code and require changes to our managed CustomAttribute implemented for both legacy and netcore, so I've opted to not check it in for now. If the empty calls continue to show up down the line, I can dig the code back up from my local branch and PR it separately.
If this is producing huge arrays and malloc continues to show up in the profile, consider https://github.com/dotnet/runtime/issues/32972. Even without that, this is a substantial improvement.
* [metadata] Fix leak in custom attribute lookup (#19279)
https://github.com/dotnet/runtime/commit/
9dec6ae2ea81d46884bf49d2df8b26cc1e28eb12#r37604565
Co-authored-by: CoffeeFlux <CoffeeFlux@users.noreply.github.com>
(cherry picked from commit
9f390a7d8a9fed5e347b253c7616a81382335708)
Co-authored-by: CoffeeFlux <CoffeeFlux@users.noreply.github.com>