当前位置:网站首页>On 'premature optimization'
On 'premature optimization'
2022-07-23 15:50:00 【tiwayDeng】
Premature optimization is the root of all evil.
– Donald Knuth, 1974
Optimization is based on actual business needs , In procedure , Work hard on architecture and deployment , Reduce resource consumption , Improve the efficiency of resource utilization . Effective optimization can save energy and increase efficiency for enterprises , The boss changed Rolls Royce , The magic weapon of purchasing villas , It is programmers who improve themselves , The key to transforming yourself . We advocate optimization , But we should not optimize it too early . We don't deny optimization , Instead, it emphasizes that according to the actual business needs , Achieve timely and appropriate optimization .
There is still a feeling of premature optimization in the modern R & D process . Premature optimization is something developers should always consider , It is something that should be avoided in daily work .
A typical example is a startup company that spends a lot of time trying to figure out how to expand its software to meet millions of users . This is a problem worth considering , But it doesn't have to be done . Before worrying about dealing with millions of users , You need to make sure 100 Users like and want to use your product . You need to verify user feedback first .
Many times, we will optimize too early because we don't distinguish the primary contradiction from the secondary contradiction . In the above example , Mining user needs and improving user experience is obviously in line with the current priority . Performance optimization is important , But it may be something you need to consider in the next few years .
And experience is very important , But we must proceed from reality . From the actual budget and resources , Choose a framework based on experience , Staffing , Resource allocation . Put an end to it ‘ This is how my last company realized ’. First of all, we should realize that the river we crossed today is not the same as the river we crossed yesterday , At least the sand under your feet is different . This feeling is like making you wear other people's clothes as awkward .
Netease cloud may not have thought of it at the beginning , Netease cloud fire is not songs , It's the comments inside . Before we get the feedback from the market, don't take it for granted to increase the horsepower in advance to optimize what you think . The market will let you know what is ‘ Don't you think , I want me to feel ’.
Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.
PrematureOptimizationProgrammers waste a lot of time thinking 、 Worry about the performance of non critical parts of the program , If you consider the overall code Of debug And maintenance time , Then the cost of these performance optimization is not worth the loss . For about 97% Small optimization of spot , We should ignore them : Premature optimization why the root of all evil . And for the rest of the key 3%, I We cannot give up the opportunity of optimization .
How should we do
- Make it work.
- Make it right (the code is readable [uses IntentionRevealingNames] and every idea is expressed OnceAndOnlyOnce).
- Make everything work.
- Make everything right.
- Use the system and find performance bottlenecks.
- Use a profiler in those bottlenecks to determine what needs to be optimized. See ProfileBeforeOptimizing.
- Make it fast. You maintained unit tests, right? Then you can refactor the code mercilessly in order to improve the
-performance.
1. Let it work .
2. Make it right ( The code is readable [ Use IntentionRevealingNames ], Every idea is expressed as OnceAndOnlyOnce).
3. Let everything work .
4. Do everything well .
5. Use the system and identify performance bottlenecks .
6. Use analyzers in these bottlenecks to determine what needs to be optimized . see also ProfileBeforeOptimizing.
7. hurry up . You maintained unit tests , Right ? Then you can ruthlessly refactor the code to improve performance .
—— Guillermoschwatts
Before getting market feedback , Everything is based on empirical assumptions , Excessive optimization will greatly increase the cost of this assumption . Making assumptions right is the essence of optimization
边栏推荐
- The landing process of 800V high-voltage fast charging was accelerated, and Junsheng Electronics was designated for the 500million euro project
- MD5 strong collision, secondary decoding,
- The difference between cookies and sessions
- 【攻防世界WEB】难度三星9分入门题(上):simple_js、mfw
- 老照片上色——DeOldify快速上手
- UmiJs - qiankun主子应用之间,数据的传递
- 数据治理浅析
- 【运维】ssh tunneling 依靠ssh的22端口实现访问远程服务器的接口服务
- aws篇6 aws iot
- md5强碰撞,二次解码,
猜你喜欢

centos7 中彻底卸载mysql
![[ctfhub] the data of JWT header and payload are transmitted in clear text. If sensitive information is contained in it, sensitive information will be leaked. Try to find the flag. Format is flag{}](/img/d0/133d628a304f5c6b5f0d514c9fe222.jpg)
[ctfhub] the data of JWT header and payload are transmitted in clear text. If sensitive information is contained in it, sensitive information will be leaked. Try to find the flag. Format is flag{}

Find a specific number in an ordered array (binary search or half search)

记一次SQL优化

用rpm -e --nodeps进行批量删除

Safe and reasonable use of electricity to harvest a cool "summer"

C语言学习笔记

What is the difference between server hosting and virtual host

超详细MP4格式分析

800V高压快充落地进程加快均胜电子获5亿欧元项目定点
随机推荐
C语言经典例题-逆序打印输入的两位数
Axure advanced
奔驰新能源产品线:豪华新能源市场或将改变格局
第二篇 如何设计一个RBAC权限系统
Six ways of uniapp route jump
BGP routing principle
md5强碰撞,二次解码,
[pyGame actual combat] aircraft shooting masterpiece: fierce battle in the universe is imminent... This super classic shooting game should also be taken out and restarted~
Guangzhou held a competition for quality and safety supervisors of agricultural products in the town and street
[pyGame practice] playing poker? Win or lose? This card game makes me forget to eat and sleep.
Deep understanding of L1 and L2 regularization
16个自动化测试面试问题与解答
BGP basic configuration
深入理解L1、L2正则化
SCA在得物DevSecOps平台上应用
浅谈‘过早优化’
Mercedes Benz new energy product line: luxury new energy market may change the pattern
【云原生】docker环境中安装mysql、redis服务
aws篇3 go语言如何publish message 到iot的MQTT
uniapp路由跳转的六种方式