在C#中的优化技术 [英] Optimization techniques in C#

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

问题描述

我想知道什么样的优化技术,人们经常使用时下。我所看到的人都缓存所有字典和所有的时间。是对速度的交易空间,唯一的出路?

I am wondering what kind of optimization techniques people often use nowadays. I have seen people do caching all the time with dictionary and all. Is the trading space for speed the only way to go?

推荐答案

有经常与算法的问题,以及,通常在一些昂贵的东西在一个循环内完成。通常情况下,你要做的第一件事就是配置您的应用程序,它会告诉你应用程序的最慢的部分(S)。通常情况下,你做什么,以加快应用程序取决于你发现了什么。例如,如果你的应用程序模仿一个文件系统,它可能是你调用数据库递归前往了树(例如)。您可以通过改变这些递归调用到一个平坦的数据库调用返回的所有数据在一个呼叫优化的情况下。

There are often problems with algorithms as well, usually when something expensive is done inside of a loop. Generally, the first thing you do is profile your application, which will tell you the slowest part(s) of the application. Generally, what you do to speed up your application depends upon what you find. For example, if your application mimics a file system, it may be that you're calling the database recursively to travel up the tree (for instance). You may optimise that case by changing those recursive calls into one flattened database call that returns all of the data in one call.

再次答案一如既往,这取决于'。然而,更多的例子和建议,可在波多黎各马里亚尼的博客找到(浏览回到几年作为他的重心已经转移):

Again, the answer is, as always, 'it depends'. However, more examples and advice can be found in Rico Mariani's blog (browse back a few years, as his focus has shifted):

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

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