Program optimization: Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Add: s2cid. Removed proxy/dead URL that duplicated identifier. | Use this bot. Report bugs. | Suggested by Abductive | Category:Software optimization | #UCB_Category 8/61
Automated and manual optimization: remove overlink to the 90/10 law – there is no detailed article about this law of software optimization. 90% of Wikipedians spend 10% of their time flagging links to improper titles; 10% of Wikipedians spent 90% of their time fixing the bad links where used in articles
Line 146:
Performance bottlenecks can be due to language limitations rather than algorithms or data structures used in the program. Sometimes, a critical part of the program can be re-written in a different [[programming language]] that gives more direct access to the underlying machine. For example, it is common for very [[High-level programming language|high-level]] languages like [[Python (programming language)|Python]] to have modules written in [[C (programming language)|C]] for greater speed. Programs already written in C can have modules written in [[assembly language|assembly]]. Programs written in [[D programming language|D]] can use the [[inline assembler]].
 
Rewriting sections "pays off" in these circumstances because of a general "[[rule of thumb]]" known as the [[90/10 law]], which states that 90% of the time is spent in 10% of the code, and only 10% of the time in the remaining 90% of the code. So, putting intellectual effort into optimizing just a small part of the program can have a huge effect on the overall speed{{snd}} if the correct part(s) can be located.
 
Manual optimization sometimes has the side effect of undermining readability. Thus code optimizations should be carefully documented (preferably using in-line comments), and their effect on future development evaluated.