Binary optimization
   HOME

TheInfoList



OR:

An object code optimizer, sometimes also known as a post pass optimizer or, for small sections of code, peephole optimizer, forms part of a software
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
. It takes the output from the source language compile step - the object code or
binary file A binary file is a computer file that is not a text file. The term "binary file" is often used as a term meaning "non-text file". Many binary file formats contain parts that can be interpreted as text; for example, some computer document files ...
- and tries to replace identifiable sections of the code with replacement code that is more algorithmically efficient (usually improved speed).


Examples

* The earliest "COBOL Optimizer" was developed by
Capex Corporation Capex Corporation was an American computer software company in existence from 1969 through 1982 and based in Phoenix, Arizona. It made a variety of software products, mostly system utilities for the IBM mainframe platform, and was known for its ...
in the mid 1970s for
COBOL COBOL (; an acronym for "common business-oriented language") is a compiled English-like computer programming language designed for business use. It is an imperative, procedural, and, since 2002, object-oriented language. COBOL is primarily ...
. This type of optimizer depended, in this case, upon knowledge of "weaknesses" in the standard IBM COBOL compiler, and actually replaced (or patched) sections of the object code with more efficient code. The replacement code might replace a linear
table lookup In computer science, a lookup table (LUT) is an array that replaces runtime computation of a mathematical function with a simpler array indexing operation, in a process termed as ''direct addressing''. The savings in processing time can be sig ...
with a
binary search In computer science, binary search, also known as half-interval search, logarithmic search, or binary chop, is a search algorithm that finds the position of a target value within a sorted array. Binary search compares the target value to the m ...
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 reduction In compiler construction, strength 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 l ...
. For example, on the
IBM/360 The IBM System/360 (S/360) is a family of mainframe computer systems announced by IBM on April 7, 1964, and delivered between 1965 and 1978. System/360 was the first family of computers designed to cover both commercial and scientific applicati ...
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 re-optimizing existing programs was that the stock of already compiled customer programs (
object code In computing, object code or object module is the product of an assembler or compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' ...
) could be improved almost instantly with minimal effort, reducing
CPU A central processing unit (CPU), also called a central processor, main processor, or just processor, is the primary processor in a given computer. Its electronic circuitry executes instructions of a computer program, such as arithmetic, log ...
resources at a fixed cost (the price of the
proprietary software Proprietary software is computer software, software that grants its creator, publisher, or other rightsholder or rightsholder partner a legal monopoly by modern copyright and intellectual property law to exclude the recipient from freely sharing t ...
). 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
upgrade Upgrading is the process of replacing a product with a newer version of the same product. In computing and consumer electronics, an upgrade is generally a replacement of hardware, software or firmware with a newer or better version, in order to ...
s, 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

Some binary optimizers do
executable compression Executable compression is any means of compressing an executable file and combining the compressed data with decompression code into a single executable. When this compressed executable is executed, the decompression code recreates the original ...
, which reduces the ''size'' of binary files using generic
data compression In information theory, data compression, source coding, or bit-rate reduction is the process of encoding information using fewer bits than the original representation. Any particular compression is either lossy or lossless. Lossless compressi ...
techniques, reducing storage requirements and transfer and loading times, but not improving run-time performance. Actual consolidation of duplicate library modules would also reduce memory requirements. Some binary optimizers utilize run-time metrics ( profiling) to introspectively improve performance using techniques similar to JIT compilers.


Recent developments

More recently developed "binary optimizers" for various platforms, some claiming
novelty Novelty (derived from Latin word ''novus'' for "new") is the quality of being new, or following from that, of being striking, original or unusual. Novelty may be the shared experience of a new cultural phenomenon or the subjective perception of an ...
but, nevertheless, essentially using the same (or similar) techniques described above, include: *
IBM International Business Machines Corporation (using the trademark IBM), nicknamed Big Blue, is an American Multinational corporation, multinational technology company headquartered in Armonk, New York, and present in over 175 countries. It is ...
Automatic Binary Optimizer for z/OS (ABO) (2015) *
IBM International Business Machines Corporation (using the trademark IBM), nicknamed Big Blue, is an American Multinational corporation, multinational technology company headquartered in Armonk, New York, and present in over 175 countries. It is ...
Automatic Binary Optimizer for z/OS (ABO) Trial Cloud Service (2020) * The Sun Studio Binary Code Optimizer — which requires a
profile Profile or profiles may refer to: Art, entertainment and media Music * ''Profile'' (Jan Akkerman album), 1973 * ''Profile'' (Githead album), 2005 * ''Profile'' (Pat Donohue album), 2005 * ''Profile'' (Duke Pearson album), 1959 * '' ''Profi ...
phase beforehand * Design and Engineering of a Dynamic Binary Optimizer — from
IBM International Business Machines Corporation (using the trademark IBM), nicknamed Big Blue, is an American Multinational corporation, multinational technology company headquartered in Armonk, New York, and present in over 175 countries. It is ...
T. J. Watson Res. Center (February 2005) * QuaC: Binary Optimization for Fast Runtime Code Generation in C — (which appears to include some elements of JIT) *
DynamoRIO DynamoRIO is a BSD-licensed dynamic binary instrumentation framework for the development of dynamic program analysis tools. DynamoRIO targets user space applications under the Android, Linux, and Windows operating systems running on the AArch32 ...
* COBRA: An Adaptive Runtime Binary Optimization Framework for Multithreaded Applications * Spike Executable Optimizer (Unix kernel) * "SOLAR" Software Optimization at Link-time And Run-time * Dynimize: CPU Performance Virtualization * BOLT: post-link optimizer built on top of the
LLVM LLVM, also called LLVM Core, is a target-independent optimizer and code generator. It can be used to develop a Compiler#Front end, frontend for any programming language and a Compiler#Back end, backend for any instruction set architecture. LLVM i ...
framework. Utilizing sample-based profiling, BOLT improves the performance of real-world applications even for highly optimized binaries built with both Feedback Directed Optimization and
Link-time optimization Interprocedural optimization (IPO) is a collection of compiler techniques used in computer programming to improve performance in programs containing many frequently used functions of small or medium length. IPO differs from other compiler optimi ...
. For GCC and
Clang Clang () is a compiler front end for the programming languages C, C++, Objective-C, Objective-C++, and the software frameworks OpenMP, OpenCL, RenderScript, CUDA, SYCL, and HIP. It acts as a drop-in replacement for the GNU Compiler ...
compilers, BOLT speeds up their binaries by up to 20.4% on top of FDO and LTO, and up to 52.1% if the binaries are built without FDO and LTO.


See also

*
Binary recompilation A binary recompiler is a compiler that takes executable binary files as input, analyzes their structure, applies transformations and optimizations, and outputs new optimized executable binaries. The foundation to the concepts of binary recompila ...
*
Binary translation In computing, binary translation is a form of binary recompilation where sequences of instruction (computer science), instructions are translated from a source instruction set (ISA) to the target instruction set with respect to the operating syste ...
* Dynamic dead code elimination


References

{{DEFAULTSORT:Object Code Optimizer Compiler optimizations Computer performance Software optimization