Sunday, 23 October 2016

程序员修炼之道读书笔记 39

It's unlikely that you'll spend much time during your career writing sort routines. The ones in the libraries available to you will probably outperform anything you may write without substantial effort.  现在的程序开发已经到了,完善高效库函数触手可及的地步,你的职业生涯你不需要自己写排序算法,即使你写,不花上洪荒之力的努力,你不太可能写出比库函数更优秀的算法。所以不要reinvent wheels. 把精力花在其他更高效的事情上,总是记住80/20原则。

Estimate the order of your algorithm and test it.
预估你算法的阶,并测试验证。

Be wary of premature optimization. It is always a good idea to make sure an algorithm really is  a bottleneck before investigating time trying to improving it.

总是警惕早期优化。 首先要确保你做了正确的事情,能够完成你的设计功能。才考虑优化。优化之前,找出花费时间最多的瓶颈,然后优化,这样才最经济。而不是把时间花在不是瓶颈的模块,效果可能不理想。

No comments:

Post a Comment