[2020-02] Use GArray instead of GList when getting custom attributes from an image...
commitbeccf5ba4386148534467bff03fabe92da6d9705
authormonojenkins <jo.shields+jenkins@xamarin.com>
Fri, 27 Mar 2020 23:38:33 +0000 (27 19:38 -0400)
committerGitHub <noreply@github.com>
Fri, 27 Mar 2020 23:38:33 +0000 (28 00:38 +0100)
treedfdb0fc38d7132d319669d98830eeb782e1804df
parent5bea89d861fb60c53c63a02eba2682f94307ecc2
[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>
mono/metadata/custom-attrs.c