Premature optimization is the root of all evil.
For all of we programmers,we should always remember that "Premature optimization is the root of all evil". (Ref)
When again,I come back to the 'Data Structure and Algorithm',following the algorithms that the .net provides,using the '.net reflector',I realise that I was too much care about something(for i am not work strict to memory and CPU circle limits).
The issue I posted "Would it cost any extra performance if multiple invoke methods that are overload?" on the forum "Stackoverflow" shows the issue that confused me before.
That issue comes from .net ArrayList class,such as the code below:
public static void Copy(Array sourceArray, Array destinationArray, int length)
{
if (sourceArray == null)
{
throw new ArgumentNullException("sourceArray");
}
if (destinationArray == null)
{
throw new ArgumentNullException("destinationArray");
}
Copy(sourceArray, sourceArray.GetLowerBound(), destinationArray, destinationArray.GetLowerBound(), length, false);
}
it actually calls
Copy(sourceArray, sourceArray.GetLowerBound(), destinationArray, destinationArray.GetLowerBound(), length, false);
internal static extern void Copy(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length, bool reliable);
as it is obvious.
The method call between themselves can be 'inlined',or the opitimized by jitter.
And remember that "Premature optimization is the root of all evil". Take much time to think about our own algorithms.
Premature optimization is the root of all evil.的更多相关文章
- JavaScript性能优化
如今主流浏览器都在比拼JavaScript引擎的执行速度,但最终都会达到一个理论极限,即无限接近编译后程序执行速度. 这种情况下决定程序速度的另一个重要因素就是代码本身. 在这里我们会分门别类的介绍J ...
- NoSQL数据库笔谈(转)
NoSQL数据库笔谈 databases , appdir , node , paper颜开 , v0.2 , 2010.2 序 思想篇 CAP 最终一致性 变体 BASE 其他 I/O的五分钟法则 ...
- python笔记-python编程优化:常用原则和技术介绍
本人翻译自<Exper Python Programming> 'Premature optimization is the root of all evil in programming ...
- 一个超复杂的间接递归——C语言初学者代码中的常见错误与瑕疵(6)
问题: 问题出处见 C语言初学者代码中的常见错误与瑕疵(5) . 在该文的最后,曾提到完成的代码还有进一步改进的余地.本文完成了这个改进.所以本文讨论的并不是初学者代码中的常见错误与瑕疵,而是对我自己 ...
- GPU 优化总结
前面说了对我这一年多的工作进行一个总结,由于工作比较紧,加上本人比较懒,一直没能抽出时间来写,最近稍微闲下来了.先写一篇GPU优化的,后续的文章希望能慢慢补齐.这些基本都是我个人优化的实际经验,也参考 ...
- Thinking Clearly about Performance
http://queue.acm.org/detail.cfm?id=1854041 The July/August issue of acmqueue is out now acmqueue is ...
- [翻译]HTML中不知名的语义标签
原文:http://docs.webplatform.org/wiki/tutorials/Lesser_-_known_semantic_elements HTML5中比较常用的语义元素有heade ...
- Code Complete阅读笔记(二)
2015-03-06 328 Unusual Data Types ——You can carry this technique to extremes,putting all the ...
- 侯捷C++ Type traits(类型萃取
泛型編程編出來的代碼,適用於任何「吻合某種條件限制」的資料型別.這已成為撰寫可復用代碼時的一個重要選擇.然而,總有一些時候,泛型不夠好 — 有時候是因為不同的型別差距過大,難以產生一致的泛化實作版本. ...
随机推荐
- [topcoder]CoinReversing
http://community.topcoder.com/stat?c=problem_statement&pm=11473&rd=14543 简单的概率题.那道题想了想就出来了.每 ...
- [wikioi]数字三角形
http://wikioi.com/problem/1220/ 最基本经典的DP题目,唯一有点意思的是,自底向上计算会更简洁.另外对这种+方式累计的DP,可以直接把原来的存进去,然后再加,本质是不用在 ...
- I2C总线之(二)---时序
一.协议 1.空闲状态 I2C总线总线的SDA和SCL两条信号线同时处于高电平时,规定为总线的空闲状态.此时各个器件的输出级场效应管均处在截止状态,即释放总线,由两条信号线各自的上拉电阻把电平拉高. ...
- 一个漂亮的DIV搜索条
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- BZOJ1610: [Usaco2008 Feb]Line连线游戏
1610: [Usaco2008 Feb]Line连线游戏 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 1301 Solved: 571[Submit ...
- 根据SimpleScheduleBuilder配置不同的SimpleTrigger触发器
Job代码: [java] view plaincopy package cn.zto.job; import java.text.SimpleDateFormat; import java.ut ...
- MySQL安装没有弹出配置向导
安装MySQL过程中一切都正常只是没有弹出MySQL配置向导对话框,即出现"launch the MySQL Instance Configuration Wizard" fini ...
- orace owi介绍
第1章 OWI介绍记录和观察进程所经历的等待现象的功能和界面以及方法论,统称为OWI,也就是Oracle Wait Interface.等待事件的P1.P2.P3值可以通过v$session_wait ...
- test、exec、match区别
test.exec.match的简单区别 1.test test 返回 Boolean,查找对应的字符串中是否存在模式. var str = "1a1b1c"; var reg = ...
- Eclipse Code Template 设置自动加注释(转)
Eclipse Code Template 设置自动加注释 设置注释模板的入口: Window->Preference->Java->Code Style->Code Temp ...