C#非常优化 [英] C# very optimisation

查看:50
本文介绍了C#非常优化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




你知道我在哪里可以找到一些关于C#

优化的电子书或网站吗?


例如,我刚刚得知++ i比i ++快。我想

了解更多可以使代码快于快速的事情。


谢谢。



do you know where i can find some ebooks or websites talking about C#
optimisation ?

for exemple, i just learned that ++i is faster than i++. i would like to
know more about the things that can make code faster than fast.

thank you.

推荐答案

Ennixo< en **** @ free.fr>写道:
Ennixo <en****@free.fr> wrote:
你知道我在哪里可以找到一些关于C#
优化的电子书或网站吗?

例如,我刚学会了++我更快比我+ ++。


在C#中?我不这么认为。它*可以*在*某些*语言中更快,但

它很少会产生显着差异。

i想知道更多关于能使代码快于快速的事情。
do you know where i can find some ebooks or websites talking about C#
optimisation ?

for exemple, i just learned that ++i is faster than i++.
In C#? I don''t think so. It *can* be faster in *some* languages, but
it''s rarely going to make a significant difference.
i would like to
know more about the things that can make code faster than fast.




必要时进行适当的设计和分析。微观优惠
优化很少会对整体性能产生显着影响 - 即使调整代码使得代码段的一部分增加了5倍b / b
倍,除非在该部分花费了大量时间

的代码,否则它不会产生太大的影响。显然它是b / b
取决于应用程序,但在许多应用程序中,最重要的

性能瓶颈来自网络/数据库访问,

糟糕的线程选择等。


此外,微优化往往以牺牲

代码为代价,尽可能可读,哪个IMO应该是主要的
目标。


如果你的应用程序表现不佳,请找一个分析器并找出

确切地说是瓶颈所在。那时,只有在那一点,

你真的担心微观优化吗。


-

Jon Skeet - < sk *** @ pobox.com>
http:/ /www.pobox.com/~skeet

如果回复小组,请不要给我发邮件



Proper design and profiling when necessary, basically. Micro-
optimisations rarely make a significant difference to overall
performance - even if tweaking your code makes one section of code five
times faster, unless a significant amount of time is spent in that part
of the code, it''s not going to make much difference. Obviously it
depends on the app, but in many apps these days the most significant
performance bottlenecks come from things like network/database access,
bad choice of threading, etc.

Furthermore, micro-optimisations tend to come at the expense of the
code being as readable as it can be, which IMO should be the primary
goal.

If your app isn''t performing well enough, get a profiler and find out
exactly where the bottleneck is. At that point, and only at that point,
should you be really worried about micro-optimisations.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Jon Skeet [C#MVP]aécrit:
Jon Skeet [C# MVP] a écrit :
此外,微观优化往往以代码的可读性为代价,IMO应该是主要的目标。
Furthermore, micro-optimisations tend to come at the expense of the
code being as readable as it can be, which IMO should be the primary
goal.




一般是的,但这是用于图像处理,所以我需要尽可能地优化为

,即使代码变得大10倍且难以理解



generaly yes, but this is for image processing, so i need to optimize as
much as i can, even if the code becomes 10x bigger and unreadable


在谈论图像处理时,使用非托管(不安全)时可获得非常大的性能奖励

代码和指针。我记得一篇

的文章说非托管图像处理的速度比

托管的速度快28倍。

这里是
< a rel =nofollowhref =http://tinyurl.com/3sux8target =_ blank> http://tinyurl.com/3sux8

" Ennixo" <恩**** @ free.fr>在消息中写道

news:42 ********************* @ news.wanadoo.fr ...
When talking about image processing, a VERY big performance bonus can be
gained when using unmanaged (unsafe) code and pointers. I remember an
article saying unmanaged image processing can be up to 28 times faster than
managed.
Here it is
http://tinyurl.com/3sux8
"Ennixo" <en****@free.fr> wrote in message
news:42*********************@news.wanadoo.fr...
Jon Skeet [C#MVP]aécrit:
Jon Skeet [C# MVP] a écrit :
>此外,微观优化往往以代码的可读性为代价,IMO应该是主要的目标。
> Furthermore, micro-optimisations tend to come at the expense of the
code being as readable as it can be, which IMO should be the primary
goal.



通常是的,但这是用于图像处理,所以我需要尽可能优化,即使代码变得大10倍且不可读



generaly yes, but this is for image processing, so i need to optimize as
much as i can, even if the code becomes 10x bigger and unreadable



这篇关于C#非常优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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