简体   繁体   English

C#对象创建性能指标

[英]C# Object Creation Performance Metrics

I'm looking for good performance metrics around the cost of creating objects in C#. 我正在寻找有关在C#中创建对象的成本的良好性能指标。 I am trying to decide if it's best to "denormaise" a number of classes into a single upper-level class in an effort to avoid costly garbage collection efforts. 我试图确定是否最好将多个类“ denormaise”到单个上层类中,以免进行昂贵的垃圾收集工作。 There is an obvious trade-off here in that I will lose a level of readability in-so-far as data that would have previously have been stored in it's own class would be re-factored up to a higher-level class. 这里有一个明显的权衡,就是我将失去一定程度的可读性,因为以前将原本存储在其自身类中的数据重构为更高级别的类。

To add some context - I am dealing with the creation of roughly 500 extra classes per call. 为了增加一些上下文-我正在处理每个调用大约500个额外的类的创建。 Calls will be relatively infrequent. 拨打电话相对较少。

如果您要处理大量相似类,那么您应该考虑使用泛型类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM