Programming Optimization

来源:互联网 发布:淘宝网店首页海报尺寸 编辑:程序博客网 时间:2024/06/05 00:43
 Introduction


 


This is a page about the elusive subject of program performance optimization.  Before you proceed towards such lofty goals, you should examine your reasons  for doing so.  Optimization is but one of many desirable goals in software  engineering, and is often antagonistic to other important goals such as  stability, maintainability, and portability. At its most cursory level  (efficient implementation, clean non-redundant interfaces) optimization is  beneficial and should always be applied.  But at its most intrusive (inline  assembly, pre-compiled/self-modified code, loop unrolling, bit-fielding,  superscalar and vectorizing) it can be an unending source of time consuming  implementation and bug hunting.  Be cautious and wary of the cost of  optimizing your code.

You will probably notice a large slant towards Intel x86 based optimization techniques, which shouldn't surprise many, since that is where my background is strongest. On the other hand I have used various other architectures, run profilers and debuggers on a variety of non-x86 UNIX boxes; I have tried to be as general as possible where I can. However, many of the recommendations and techniques may simply not work for your processor or environment. In that event, I should emphasize that first hand knowledge is always better than following advice. I would also appreciate any feedback you might have regarding other platforms or other optimization techniques you have experience with.

I have written up this page for a few reasons: (1) I have seen almost nothing of reasonable quality or depth elsewhere (2) I hope to get feedback from others who may know a thing or two, that I don't (3) To enrich the quality of the internet (4) Expensive books on this subject have been getting a bit too much attention (5) To get more hits on my web page :o)

"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!"

   -Michael Abrash

So without further ado, I present to you Programming Optimization

 

http://www.azillionmonkeys.com/qed/optimize.html

原创粉丝点击