Remove some array allocations from RuntimeType.CreateInstanceImpl (#67148)
- It's commonly used with zero args; we can use Type.EmptyTypes rather than new Type[0] - It calls GetConstructors, which internally uses ListBuilder and then resizes if the created array isn't filled, but since we don't need the correctly sized array, we can just use the ListBuilder and avoid the resize - It creates a List and then ToArray's it, but if none of the constructors are filtered out, it's better to just use the array we built up directly.
Showing
想要评论请 注册 或 登录