我是否总是需要考虑性能? [英] Do I always have to think about performance?

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

问题描述

我来自DBA世界,性能一直是困扰.我正在转向发展,我一直都在不停地思考性能.

I come from a DBA world and performance has always been an obsession. I am turning to development and I always think about performance, constantly, all the time.

阅读SO有时似乎对性能没有影响.例如,对于处于休眠状态(或任何其他ORM)的福音传教士.

Reading on SO sometimes seems that performance does not matter. For instance for evangelists on hibernate (or any other ORM).

作为开发人员,我什么时候必须考虑性能,什么时候不考虑?

As a developer, when do I have to think about performance and when not?

推荐答案

通常来说,对性能或优化的痴迷是软件开发中许多弊端的出路.通常,只有大约5%(或更少!)的代码会对整个系统的性能产生任何影响.首先,作为大多数项目的软件开发人员,您的主要目标是获得正确和可靠的功能以及系统的可维护性.然后,一旦实施并正常工作,您就可以评估性能,找出瓶颈所在,并相应地对其进行优化以满足您的总体目标.

Generally speaking, obsessing about performance or optimization is the route to much evil in software development. Usually, only about 5% (or less!) of your code has any impact on the performance of the overall system. Your primary goals, first, as a software developer on most projects is getting to correct and reliable functionality and also of course maintainability of the system. Then, once implemented and working correctly, you evaluate performance, find out where the bottlenecks are, and optimize them accordingly to meet your overall goals.

一个警告 :作为原始系统设计和算法选择的一部分,事先考虑要对您所采用的方法进行O(n)类型评估是合理的事情等等,只是为了让演出充满信心.但是除此之外,大多数在实际测量瓶颈所在之前进行优化的尝试都会导致优化无关紧要的东西,并且通常会使事情难以维护,难以理解等.

One Caveat: Doing O(n) type evaluations of approaches you take to things are reasonable things to consider in advance as part of the original system design and algorithm selection, etc. just to feel confident the performance will be "in the ball park". But beyond that, most attempts to optimize things in advance of actually measuring where the bottlenecks are will result in optimizing things that don't matter and usually make things less maintainable, harder to understand, etc.

这篇关于我是否总是需要考虑性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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