Object code optimizer
Encyclopedia
An object code optimizer, sometimes also known as a post pass optimizer or, for small sections of code, peephole optimizer
, takes the output from a source language compile step - the object code or binary file
- and tries to replace identifiable sections of the code with replacement code that is more algorithmically efficient
(usually improved speed).
) could be improved almost 'instantly' with minimum effort, reducing CPU resources at a fixed cost (the price of the proprietary software
). A disadvantage was that new releases of COBOL, for example, would require (charged) maintenance to the optimizer to cater for possibly changed internal COBOL algorithms. However, since new releases of COBOL compilers frequently coincided with hardware
upgrades, the faster hardware would usually more than compensate for the application programs reverting to their pre-optimized versions (until a supporting optimizer was released).
compilers.
but, nevertheless, essentially using the same (or similar) techniques described above, include:-
Peephole optimization
In compiler theory, peephole optimization is a kind of optimization performed over a very small set of instructions in a segment of generated code. The set is called a "peephole" or a "window"...
, takes the output from a source language compile step - the object code or binary file
Binary file
A binary file is a computer file which may contain any type of data, encoded in binary form for computer storage and processing purposes; for example, computer document files containing formatted text...
- and tries to replace identifiable sections of the code with replacement code that is more algorithmically efficient
Algorithmic efficiency
In computer science, efficiency is used to describe properties of an algorithm relating to how much of various types of resources it consumes. Algorithmic efficiency can be thought of as analogous to engineering productivity for a repeating or continuous process, where the goal is to reduce...
(usually improved speed).
Examples
- The "COBOL Optimizer" developed by Capex CorporationCapex CorporationCapex Corporation was a software house based in Phoenix, Arizona founded by three former employees of General Electric. It was subsequently acquired by Computer Associates.-Products:* Autotab - an early batch spreadsheet program...
in the mid 1970's for COBOLCOBOLCOBOL is one of the oldest programming languages. Its name is an acronym for COmmon Business-Oriented Language, defining its primary domain in business, finance, and administrative systems for companies and governments....
. This type of optimizer depended, in this case, upon knowledge of 'weaknesses' in the standard IBM COBOL compiler, and actually replaced (or patchPatch (computing)A patch is a piece of software designed to fix problems with, or update a computer program or its supporting data. This includes fixing security vulnerabilities and other bugs, and improving the usability or performance...
ed) sections of the object code with more efficient code. The replacement code might replace a linear table lookupLookup tableIn computer science, a lookup table is a data structure, usually an array or associative array, often used to replace a runtime computation with a simpler array indexing operation. The savings in terms of processing time can be significant, since retrieving a value from memory is often faster than...
with a binary search for example or sometimes simply replace a relatively 'slow' instruction with a known faster one that was otherwise functionally equivalent within its context. This technique is now known as "Strength reductionStrength reductionStrength reduction is a compiler optimization where expensive operations are replaced with equivalent but less expensive operations. The classic example of strength reduction converts "strong" multiplications inside a loop into "weaker" additions – something that frequently occurs in array...
". For example on the IBM/360 hardware the CLI instruction was, depending on the particular model, between twice and 5 times as fast as a CLC instruction for single byte comparisons.
Advantages
The main advantage of this method was that the stock of already compiled customer programs (object codeObject code
Object code, or sometimes object module, is what a computer compiler produces. In a general sense object code is a sequence of statements in a computer language, usually a machine code language....
) could be improved almost 'instantly' with minimum effort, reducing CPU resources at a fixed cost (the price of the proprietary software
Proprietary software
Proprietary software is computer software licensed under exclusive legal right of the copyright holder. The licensee is given the right to use the software under certain conditions, while restricted from other uses, such as modification, further distribution, or reverse engineering.Complementary...
). A disadvantage was that new releases of COBOL, for example, would require (charged) maintenance to the optimizer to cater for possibly changed internal COBOL algorithms. However, since new releases of COBOL compilers frequently coincided with hardware
Hardware
Hardware is a general term for equipment such as keys, locks, hinges, latches, handles, wire, chains, plumbing supplies, tools, utensils, cutlery and machine parts. Household hardware is typically sold in hardware stores....
upgrades, the faster hardware would usually more than compensate for the application programs reverting to their pre-optimized versions (until a supporting optimizer was released).
Other optimizers using the same concept
Some binary optimizers seek to reduce only the size of binary files by eliminating duplicate library modules - without necessarily also improving their performance, while others utilize run-time metrics to introspectively improve performance using techniques similar to JITJust In Time
Just in time is a production strategy that strives to improve a business return on investment by reducing in-process inventory and associated carrying costs. Just-in-time production method is also called the Toyota Production System...
compilers.
Recent developments
More recently developed 'binary optimizers' for various platforms, some claiming noveltyNovelty (patent)
Novelty is a patentability requirement. An invention is not patentable if the claimed subject matter was disclosed before the date of filing, or before the date of priority if a priority is claimed, of the patent application....
but, nevertheless, essentially using the same (or similar) techniques described above, include:-
- The Sun Studio Binary Code Optimizer http://developers.sun.com/solaris/articles/binopt.html - which requires a profile phase beforehand
- Design and Engineering of a Dynamic Binary Optimizer - from IBMIBMInternational Business Machines Corporation or IBM is an American multinational technology and consulting corporation headquartered in Armonk, New York, United States. IBM manufactures and sells computer hardware and software, and it offers infrastructure, hosting and consulting services in areas...
T. J. Watson Res. Center (Feb 2005) http://ieeexplore.ieee.org/Xplore/login.jsp?url=/iel5/5/30187/01386661.pdf?arnumber=1386661 http://portal.acm.org/citation.cfm?id=1254810.1254831 - QuaC: Binary Optimization for Fast Runtime Code GenerationSelf-modifying codeIn computer science, self-modifying code is code that alters its own instructions while it is executing - usually to reduce the instruction path length and improve performance or simply to reduce otherwise repetitively similar code, thus simplifying maintenance...
in CC (programming language)C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
http://www.eecs.berkeley.edu/Pubs/TechRpts/1994/CSD-94-792.pdf - (which appears to include some elements of JIT) - The Rio project http://dynamorio.org/
- COBRA: An Adaptive Runtime Binary Optimization Framework for Multithreaded Applications http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?tp=&arnumber=4343832&isnumber=4343799
- Spike Executable Optimizer (Unix kernal) http://www.cesr.ncsu.edu/fddo4/papers/spike_fddo4.pdf
- "SOLAR" Software Optimization at Link-time And Run-time