问题描述
Herb Sutter的 C ++代码标准表示避免过早优化
和过早隐藏
。但我觉得两者都做同样的事情。所以期待一些帮助澄清这两个概念与他们之间的不同。如果你拿出一些例子,对他人更有好处。
是关于过早优化
。但我找不到任何过早的pessimization
Herb Sutter's C++ coding standards says to avoid Premature optimization
and Premature pessimization
. But I feel both is doing the same thing. So expecting some help to clarify these two concept with the different among them. If you come-up with some examples, It will be more benefit for others.Here is a good explanation about Premature optimization
. But I couldn't find any for Premature pessimization
推荐答案
我认为,过早优化的手段是与提前优化相反的:基本上忽略了使用哪种数据结构和算法。
What he means by premature pessimisation, I think, is just the opposite of premature optimisation: a fundamental disregard of which data structures and algorithms to use.
过早优化通常与微分
过早的pessimisation,相比之下,关注高层次的设计的代码架构:一个基本上无效的接口为你的库例如不能通过优化后固定,因为公共接口是在石头上。
Premature pessimisation, by contrast, concerns the high-level design of code architecture: a fundamentally inefficient interface for your library for instance cannot be fixed later by optimising, since the public interface is pretty much cast in stone.
这篇关于过早优化和与C ++编码标准相关的过早优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!