代码性能 [英] Code Performance

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

问题描述

每隔一段时间我都会读到类似的内容:

"使用像File.Exists这样的防御性代码技术代替Try和

Catch因为它少了性能猪


当我编程时,我显然对如何编码

不同部分有不同的想法。那么如何从表演中找出最好的?b
观点?

Every so often I read something like:
"use a defensive code technique like File.Exists instead of a Try and
Catch because it''s less of a performance hog"

And when I program, I obviously have different ideas on how to code
different sections. So how to I findout what''s best from a performance
point-of-view?

推荐答案

测试和阅读。


您是否了解这个

场景中防御性编码技术的含义?


Richard

" koorb" < KO *** @ raidrs.co.uk>在消息中写道

news:bu ******************************** @ 4ax.com ...
Test and read.

Do you understand what they mean by defensive coding techniques in this
scenario?

Richard
"koorb" <ko***@raidrs.co.uk> wrote in message
news:bu********************************@4ax.com...
我经常阅读类似的内容:
使用像File.Exists这样的防御性代码技术而不是Try和
Catch,因为它更少性能营养

当我编程时,我显然对如何编码不同部分有不同的想法。那么如何从表演角度找出最好的东西?
Every so often I read something like:
"use a defensive code technique like File.Exists instead of a Try and
Catch because it''s less of a performance hog"

And when I program, I obviously have different ideas on how to code
different sections. So how to I findout what''s best from a performance
point-of-view?



2004年8月21日星期六12: 40:59 +1200,Richard Myers

< ri ********************* @ basd.co.nz>写道:
On Sat, 21 Aug 2004 12:40:59 +1200, "Richard Myers"
<ri*********************@basd.co.nz> wrote:
测试和阅读。

你明白这个场景中的防御性编码技术是什么意思吗?
Test and read.

Do you understand what they mean by defensive coding techniques in this
scenario?

Richard




是的,但有没有办法找出两组相同代码之间的性能差异?
? br />



Yep, but is there a way of finding out the difference in performance
between two sets of the same code?


* koorb< ko *** @ raidrs.co.uk> scripsit:
* koorb <ko***@raidrs.co.uk> scripsit:
测试和阅读。

你明白这个场景中的防御性编码技术是什么意思吗? />
理查德
Test and read.

Do you understand what they mean by defensive coding techniques in this
scenario?

Richard



是的,但有没有办法找出两组相同代码之间的性能差异?



Yep, but is there a way of finding out the difference in performance
between two sets of the same code?




经验和测试。


-

Herfried K. Wagner [MVP]

< URL:http://dotnet.mvps.org/>



Experience and testing.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>


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

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