对象类型的性能 [英] Performance of Object Typecasting

查看:106
本文介绍了对象类型的性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对象类型在性能方面的代价是多少?

我应该尽量避免类型转换吗?

How costly is Object Typecasting in terms of performance?
Should I try to avoid Typecasting when possible?

推荐答案

它足够便宜,属于过早优化的范畴。不要浪费时间甚至思考或提出问题,除非你已经剖析你的应用程序,并确定这是一个问题,最重要的是:不要妥协你的设计,以避免它。

It is cheap enough that it falls into the category of premature optimization. Don't waste time even thinking or asking questions about it unless you have profiled your application and determined that it's a problem, and most importantly: don't compromise your design to avoid it.

这篇关于对象类型的性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆