Fix for #21456 (Regressions in attribute allocations for non-generic attributes)...
authorNick Craver <nrcraver@gmail.com>
Mon, 10 Dec 2018 11:01:52 +0000 (06:01 -0500)
committerAdam Sitnik <adam.sitnik@gmail.com>
Mon, 10 Dec 2018 11:01:52 +0000 (03:01 -0800)
commit130cec3b15815ae023a7aac9dc96aa97b36117a0
tree7824a2fb0775517498c66948267318629c5afd35
parent49ca3db92a48da71d25c607af9716a30bafb3ff8
Fix for #21456 (Regressions in attribute allocations for non-generic attributes) (#21462)

* Fix for #21456 - restrict increased generic attribute allocations to only generic attributes

This is a trivial quick-fix for #21456 where regressions between 2.1 and 3.0 were discovered on most attibute pathways due to the allocation overhead in the generic-supporting pathways. The workaround is to simply not take that slow/expensive path for non-generics.

While I'd like to optimize `RuntimeModule.ResolveMethod` further, there's a public surface area in play there that makes the changes non-trivial. There, we'll have to choose overhead on the public path (which may still be a net win), or duplication in code for another path.

* Update comments
src/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs