All Topics  
Algorithmic efficiency

 

   Email Print
   Bookmark   Link






 

Algorithmic efficiency



 
 
In computer science
Computer science

Computer science is the study of the theoretical foundations of information and computation, and of practical techniques for their implementation and application in computer systems....
, efficiency is used to describe properties of an algorithm
Algorithm

In mathematics, computing, linguistics and related subjects, an algorithm is a sequence of finite instructions, often used for calculation and data processing....
 relating to how much of various types of resources it consumes. The two most frequently encountered are but also might apply to



and perhaps even

(An extreme example of these metrics might be to consider their values in relation to a repeated simple algorithm for calculating and storing (p+n) to 50 decimal places running for say, 24 hours, either on a "pocket calculator" sized processor such as a 160GB ipod
IPod

iPod is a brand of portable media players designed and marketed by Apple Inc. and launched on . The product line-up includes the hard drive-based iPod Classic, the touchscreen iPod Touch, the video-capable iPod Nano, and the compact iPod Shuffle....
 or an early mainframe
Mainframe computer

Mainframes are computers used mainly by large organizations for critical applications, typically bulk data processing such as census, industry and consumer statistics, Enterprise Resource Planning, and financial transaction processing....
 operating in its own purpose-built heated or air conditioned unit.)

The process of making code more efficient is known as optimization
Optimization (computer science)

In computing, optimization is the process of modifying a system to make some aspect of it work more efficiently or use fewer resources. For instance, a computer program may be optimized so that it executes more rapidly, or is capable of operating with less Computer data storage or other resources, or draw less power....
 and in the case of automatic optimization (i.e.






Discussion
Ask a question about 'Algorithmic efficiency'
Start a new discussion about 'Algorithmic efficiency'
Answer questions from other users
Full Discussion Forum



Encyclopedia


In computer science
Computer science

Computer science is the study of the theoretical foundations of information and computation, and of practical techniques for their implementation and application in computer systems....
, efficiency is used to describe properties of an algorithm
Algorithm

In mathematics, computing, linguistics and related subjects, an algorithm is a sequence of finite instructions, often used for calculation and data processing....
 relating to how much of various types of resources it consumes. The two most frequently encountered are
  • speed or running time - the time it takes for an algorithm to complete, and
  • 'space' - the memory
    Memory

    In psychology, memory is an organism's mental ability to store, retain and recall information. Traditional studies of memory began in the fields of philosophy, including techniques of mnemonic....
     or 'non-volatile storage' used by the algorithm during its operation.
but also might apply to

  • transmission size - such as required bandwidth during normal operation or
  • size of external memory- such as temporary disk space used to accomplish its task


and perhaps even
  • the size of required 'longterm' disk space required after its operation to record its output or maintain its required function during its required useful lifetime (examples: a data table
    Table (information)

    A table is both a mode of visual communication and a means of arranging data. The use of tables is pervasive throughout all communication, research and data analysis....
     , archive
    File archiver

    A file archiver is a computer program that combines a number of computer file together into one archive file, or a series of archive files, for easier transportation or storage....
     or a computer log
    Data logging

    Data logging is the practice of recording sequential data, often Chronology....
    ) and also
  • the performance per watt
    Performance per watt

    In computing, performance per watt is a measure of the energy efficiency of a particular computer architecture or computer hardware. Literally, it measures the rate of computation that can be delivered by a computer for every watt of power consumed....
     and the total energy, consumed by the chosen hardware
    Hardware

    Hardware is a general term that refers to the physical cultural artifacts of a technology. It may also mean the physical components of a computer system, in the form of computer hardware....
     implementation (with its System requirements
    System requirements

    To be used efficiently, all computer software needs certain Computer hardware components or other software resources to be present on a computer system....
    , necessary auxiliary support systems including interfaces, cabling, switching
    Switching center

    A switching center is a node in a telecommunications Circuit switching network which is connected to either another switching center and/or to end user devices....
    , cooling
    Computer cooling

    Computer cooling is the process of removing heat from computer components.A computer system's components produce large amounts of heat during operation, including integrated circuits such as Central processing units, chipset and Video card, along with Hard disk drive....
     and security
    Computer security

    Computer security is a branch of technology known as information security as applied to computers. The objective of computer security can include protection of information from theft or corruption, or the preservation of availability, as defined in the security policy....
    ), during its required useful lifetime. See Total cost of ownership
    Total cost of ownership

    Total cost of ownership is a financial estimate designed to help consumers and enterprise managers assess direct and indirect costs. It is used in many industries and this article...
     for other potential costs that might be associated with any particular implementation.


(An extreme example of these metrics might be to consider their values in relation to a repeated simple algorithm for calculating and storing (p+n) to 50 decimal places running for say, 24 hours, either on a "pocket calculator" sized processor such as a 160GB ipod
IPod

iPod is a brand of portable media players designed and marketed by Apple Inc. and launched on . The product line-up includes the hard drive-based iPod Classic, the touchscreen iPod Touch, the video-capable iPod Nano, and the compact iPod Shuffle....
 or an early mainframe
Mainframe computer

Mainframes are computers used mainly by large organizations for critical applications, typically bulk data processing such as census, industry and consumer statistics, Enterprise Resource Planning, and financial transaction processing....
 operating in its own purpose-built heated or air conditioned unit.)

The process of making code more efficient is known as optimization
Optimization (computer science)

In computing, optimization is the process of modifying a system to make some aspect of it work more efficiently or use fewer resources. For instance, a computer program may be optimized so that it executes more rapidly, or is capable of operating with less Computer data storage or other resources, or draw less power....
 and in the case of automatic optimization (i.e. compiler optimization
Compiler optimization

Compiler optimization is the process of tuning the output of a compiler to minimize or maximize some attribute of an executable computer program....
 - performed by compilers on request or by default), usually focus on space at the cost of speed, or vice versa. There are also quite simple programming techniques and 'avoidance strategies' that can actually improve both at the same time, usually irrespective of hardware, software or language. Even the re-ordering of nested
Nested function

In computer programming, a nested function is a subroutine which is lexically encapsulated within another function. It can only be called by the enclosing function or by functions directly or indirectly nested within the same enclosing function....
 conditional statements - to put the least frequently occurring condition first (example: test patients for blood type
Blood type

A blood type is a classification of blood based on the presence or absence of Inheritance antigenic substances on the surface of red blood cells ....
 ='AB-', before testing age > 18, since this type of blood occurs in only about 1 in 100 of the population - thereby eliminating the second test at runtime
Runtime

In computer science, runtime or run time describes the operation of a computer program, the duration of its execution, from beginning to termination ....
 in 99% of instances), can reduce actual instruction path length
Instruction path length

In computer performance, the Instruction path length is the number of machine code instructions required to execute a section of a computer program....
, something an optimizing compiler would almost certainly not be aware of - but which a programmer can research relatively easily even without specialist medical knowledge.

Speed

The absolute speed of an algorithm for a given input can simply be measured as the duration of execution (or clock time) and the results can be averaged over several executions to eliminate possible random effects. Most modern processors operate in a multi-processing & multi-programming environment so consideration must be made for parallel processes occurring on the same physical machine, eliminating these as far as possible. For superscalar
Superscalar

A superscalar Central processing unit architecture implements a form of parallel computer called instruction level parallelism within a single processor....
 processors, the speed of a given algorithm can sometimes be improved through instruction-level parallelism
Instruction level parallelism

Instruction-level parallelism is a measure of how many of the operations in a computer program can be performed simultaneously. Consider the following program:...
 within a single processor (but, for optimal results, the algorithm may require some adaptation to this environment to gain significant advantage, becoming, in effect, an entirely different algorithm). A relative measure of an algorithms performance can sometimes be gained from the total instruction path length
Instruction path length

In computer performance, the Instruction path length is the number of machine code instructions required to execute a section of a computer program....
 which can be determined by a run time Instruction Set Simulator
Instruction Set Simulator

An instruction set simulator is a simulation model , usually coded in a high-level programming language, which mimics the behavior of a mainframe or microprocessor by "reading" instructions and maintaining internal variables which represent the processor's registers....
 (where available).

An estimate of the speed of an algorithm can be determined in various ways. The most common method uses time complexity to determine the Big-O
Big O notation

In mathematics, big O notation describes the asymptotic analysis of a function when the argument tends towards a particular value or infinity, usually in terms of simpler functions....
 of an algorithm. See Run-time analysis for estimating how fast a particular algorithm may be according to its type (example: lookup unsorted list, lookup sorted list etc) and in terms of scalability
Scalability

In telecommunications and software engineering, scalability is a desirable property of a system, a network, or a process, which indicates its ability to either handle growing amounts of work in a graceful manner, or to be readily enlarged....
 - its dependence on 'size of input', processor power and other factors.

Memory

Often, it is possible to make an algorithm faster at the expense of memory. This might be the case whenever the result of an 'expensive' calculation is cache
Cache

In computer science, a cache is a collection of data duplicating original values stored elsewhere or computed earlier, where the original data is expensive to fetch or to compute, compared to the cost of reading the cache....
d rather than recalculating it afresh each time. The additional memory requirement would, in this case, be considered additional overhead
Computational overhead

In computer science, overhead is generally considered any combination of excess or indirect computation time, memory, bandwidth, or other resources that are required to attain a particular goal....
 although, in many situations, the stored result occupies very little extra space and can often be held in pre-compiled static
Static memory allocation

Static memory allocation refers to the process of allocating memory at Compile time before the associated program is executed, unlike dynamic memory allocation or automatic memory allocation where memory is allocated as required at Runtime....
 storage, reducing not just processing time but also allocation & deallocation of working memory. This is a very common method of improving speed, so much so that some programming languages often add special features to support it, such as C++
C++

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
's 'mutable' keyword.

The memory requirement of an algorithm is actually two separate but related things:-

  • The memory taken up by the compiled executable code (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 numeral system form for computer storage and processing purposes; for example, Document file format containing formatted text....
    ) itself (on disk or equivalent, depending on the hardware and language). This can often be reduced by preferring run-time decision making mechanisms (such as virtual function
    Virtual function

    In object-oriented programming, a virtual function or virtual method is one whose behavior can be Method overriding within an inheriting class by a function with the same Method signature....
    s and run-time type information
    Run-time type information

    In programming, RTTI refers to a C++ system that keeps information about an object's data type in memory at runtime. Run-time type information can apply to simple data types, such as integers and characters, or to generic objects....
    ) over certain compile-time decision making mechanisms (such as macro substitution and templates
    Template (programming)

    Templates are a feature of the C++ programming language that allow functions and classes to operate with Generic programming. This allows a function or class to work on many different datatype without being rewritten for each one....
    ). This, however, comes at the cost of speed.


  • Amount of temporary "dynamic memory" allocated during processing. For example, dynamically pre-caching results, as mentioned earlier, improves speed at the cost of this attribute. Even the depth of sub-routine calls can impact heavily on this cost and increase path length too, especially if there are 'heavy' dynamic memory requirements for the particular functions invoked. The use of copied function parameters (rather than simply using pointers to earlier, already defined, and sometimes static values) actually doubles the memory requirement for this particular memory metric (as well as carrying its own processing overhead
    Computational overhead

    In computer science, overhead is generally considered any combination of excess or indirect computation time, memory, bandwidth, or other resources that are required to attain a particular goal....
     for the copying itself. This can be particularly relevant for quite 'lengthy' parameters such as html
    HTML

    HTML, an Acronym and initialism of HyperText Markup Language, is the predominant markup language for Web pages. It provides a means to describe the structure of text-based information in a document?by denoting certain text as links, headings, paragraphs, lists, and so on?and to supplement that text with interactive forms, embedded '...
     script, javascript
    JavaScript

    JavaScript is a scripting language widely used for client-side web development. It was the originating Programming language dialect of the ECMAScript standard....
     source programs or extensive freeform text such as letters or emails.


(See also sections Choice of instruction or data type and Avoiding costs concerning deliberate 'stretching' of data structures to force them to have a fixed length which then becomes a multiple of 2, 4, 8 etc.)

Rematerialization

It has been argued that Rematerialization
Rematerialization

Rematerialization or remat is a compiler optimization which saves time by recomputing a value instead of loading it from memory. It is typically tightly integrated with register allocation, where it is used as an alternative to spilling registers to memory....
 (re-calculating) may occasionally be more efficient than holding results in cache. This is the somewhat non-intuitive belief that it can be faster to re-calculate from the input - even if the answer is already known - when it can be shown, in some special cases, to decrease "register pressure". Some optimizing compilers have the ability to decide when this is considered worthwhile based on a number of criteria such as complexity and no side effects
Side Effects

Side Effects is an anthology of 17 comical short stories written by Woody Allen between 1975 and 1980, all but one of which were previously published in, variously, The New Republic, The New York Times, The New Yorker, and The Kenyon Review....
, and works by keeping track of the expression used to compute each variable, using the concept of available expression
Available expression

In the field of compiler optimizations, available expressions is an analysis algorithm that determines for each point in the program the set of expression that need not be recomputed....
s.

Transmission size

Data compression
Data compression

In computer science and information theory, data compression or source coding is the process of encoding information using fewer bits than an code representation would use through use of specific encoding schemes....
 algorithms can be useful because they help reduce the consumption of expensive resources, such as hard disk space or transmission bandwidth. This however also comes at a cost - which is additional processing time to compress and subsequently decompress. Depending upon the speed of the data transfer, compression may reduce overall response times which, ultimately, equates to speed - even though processing within the computer itself takes longer. Transmission sizes of high resolution image
Image

An image is an artifact, usually two-dimensional , that has a similar appearance to some subject —usually a physical object or a person....
s for web page
Web page

A web page or webpage is a resource of information that is suitable for the World Wide Web and can be accessed through a web browser.This information is usually in HyperText Markup Language or eXtensible HyperText Markup Language format, and may provide Navigation bar to other web pages via hypertext Hyperlink....
s can sometimes be acceptable at a much lower resolutions and this technique is one of several methods used by such commercial products as ONSPEED
OnSpeed

ONSPEED is a software program designed to accelerate an internet connection using compression techniques.OnSpeed primarily improves the speed of an internet connection, including dial-up, wireless, low-speed broadband, and mobile connections such as 3G, GPRS and UMTS....
. For audio, MP3
MP3

MPEG-1 Audio Layer 3, more commonly referred to as MP3, is a digital audio Encoder format using a form of lossy data compression. It is a common audio format for consumer audio storage, as well as a de facto standard encoding for the transfer and playback of music on digital audio players....
 is a compression method used extensively in portable sound systems. The efficiency of a data compression algorithm relates to the compression factor and speed of achieving both compression and decompression. For the purpose of archiving an extensive database
Database

A database is a structured collection of records or data that is stored in a computer system. The structure is achieved by organizing the data according to a database model....
, it might be considered worthwhile to achieve a very high compression ratio, since decompression is less likely to occur on the majority of the data.

Encoding and decoding methods (compared and contrasted)

When data is encoded for any 'external' use, it is possible to do so in an almost unlimited variety of different formats that are sometimes conflicting. This content encoding
Content format

A content format is an encoding format for converting a specific type of data to information. Content formats are used in recording and data transmission to prepare data for Information processing or interpretation....
 (of the raw data
Raw data

Raw data is a term for unprocessed data, it is also known as primary data. It is a relative term . Raw data can be input to a computer program or used in manual analysis procedures such as gathering statistics from a statistical survey....
) may be designed for:

  • optimal readability – by humans
  • optimal decoding speed – by other computer programs
  • optimal compression – for archiving or data transmission
    Data transmission

    Data transmission is the physical transfer of data from point-to-point often represented as an electro-magnetic Signal over a point-to-point or point-to-multipoint communication channel....
  • optimal compatibility – with "legacy
    Legacy system

    A legacy system is an old computer system or application program that continues to be used, typically because it still functions for the users' needs, even though newer technology is available....
    " or other existing formats or programming language
    Programming language

    A programming language is a machine-readable artificial language designed to express computations that can be performed by a machine, particularly a computer....
    s
  • optimal security – using encryption
    Encryption

    In cryptography, encryption is the process of transforming information using an algorithm to make it unreadable to anyone except those possessing special knowledge, usually referred to as a key ....


(For character level encoding
Character encoding

A character encoding system consists of a code that pairs a sequence of character from a given character set with something else, such as a sequence of natural numbers, octet or electrical pulses, in order to facilitate the transmission of data through telecommunication networks and/or Computer data storage of Character in compute...
, see the various encoding techniques such as EBCDIC
EBCDIC

Extended Binary Coded Decimal Interchange Code is an 8-bit character encoding used on IBM mainframe operating systems such as z/OS, OS/390, VM and VSE , as well as IBM midrange computer operating systems such as OS/400 and i5/OS ....
 or ASCII
ASCII

American Standard Code for Information Interchange , is a coding standard that can be used for interchanging information, if the information is expressed mainly by the written form of English words....
 )

It is unlikely that all of these goals could be met with a single 'generic' encoding scheme and so a compromise will often be the desired goal and will often be compromised by the need for standardization and/or legacy and compatibility issues.

Encoding efficiently

For data encoding whose destination is to be input for further computer processing, readability is not an issue – since the receiving processors algorithm can decode the data to any other desirable form including human readable. From the perspective of algorithmic efficiency, minimizing subsequent decoding (with zero or minimal parsing) should take highest priority. The general rule of thumb is that any encoding system that 'understands' the underlying data structure - sufficiently to encode it in the first place - should be equally capable of easily encoding it in such a way that makes decoding it highly efficient. For variable length data with possibly omitted data values, for instance, this almost certainly means the utilization of declarative notation
String literal

A string literal is the representation of a String value within the source code of a computer program. There are numerous alternate notations for specifying string literals, and the exact notation depends on the individual programming language in question....
 (i.e. including the length of the data item as a prefix to the data so that a de-limiter is not required and parsing completely eliminated). For keyword data items, token
Token

Token may refer to:* Token , a physical object given to a locomotive driver to authorize him to use a particular stretch of single railway track...
izing the key to an index (integer) after its first occurrence not only reduces subsequent data size but, furthermore, reduces future decoding overhead for the same items that are repeated.

For more 'generic' encoding for efficient data compression see Arithmetic encoding and entropy encoding
Entropy encoding

In information theory an entropy encoding is a lossless data compression scheme that is independent of the specific characteristics of the medium....
 articles.

Historically, optimal encoding was not only worthwhile from an efficiency standpoint but was also common practise to conserve valuable memory, external storage and processor resources. Once validated a country name for example could be held as a shorter sequential country code
Country code

Country codes are short alphabetic or numeric geography codes developed to represent country and dependent areas, for use in data processing and communications....
 which could then also act as an index for subsequent 'decoding', using this code as an entry number within a table or record number within a file. If the table or file contained fixed length entries, the code could easily be converted to an absolute memory address or disk address for fast retrieval. The ISBN system for identifying books is a good example of a practical encoding method which also contains a built-in hierachy.

Examples of several common encoding methods
  • Comma separated values (CSV
    CSV

    The abbreviation CSV can have the following meanings:* Certified Server Validation* Clerics of Saint Viator* Comma-separated values, a file format...
     - a list of data values separated by commas
  • Tab separated values (TSV
    TSV

    TSV may refer to:* Tab-separated values, an example of delimiter-separated values* IATA code for Townsville International Airport* Time Space Visualiser, a Doctor Who fanzine...
    ) - a list of data values separated by 'tab
    Tab key

    Tab key on a alphanumeric keyboard is used to advance the cursor to the next tab stop....
    ' characters
  • HyperText Markup Language (HTML
    HTML

    HTML, an Acronym and initialism of HyperText Markup Language, is the predominant markup language for Web pages. It provides a means to describe the structure of text-based information in a document?by denoting certain text as links, headings, paragraphs, lists, and so on?and to supplement that text with interactive forms, embedded '...
    ) - the predominant markup language for Web pages
  • Extensible Markup Language (XML) - a generic framework for storing any amount of text or any data whose structure can be represented as a tree with at least one element - the root element.
  • JavaScript Object Notation (JSON
    JSON

    JSON , short for JavaScript Object Notation, is a lightweight computer data interchange format. It is a text-based, human-readable format for representing simple data structures and associative arrays ....
    ) - human-readable format for representing simple data structures


The last of these, (JSON) is apparently widely used for internet
Internet

The Internet is a global network of interconnected computers, enabling users to share information along multiple channels. Typically, a computer that connects to the Internet can access information from a vast array of available server and other computers by moving information from them to the computer's local memory....
 data transmission
Data transmission

Data transmission is the physical transfer of data from point-to-point often represented as an electro-magnetic Signal over a point-to-point or point-to-multipoint communication channel....
, primarily it seems because the data can be uploaded by a single javascript
JavaScript

JavaScript is a scripting language widely used for client-side web development. It was the originating Programming language dialect of the ECMAScript standard....
 'eval
Eval

In some programming languages, eval is a subroutine which evaluates a string as though it were an expression and returns a result; in others, it executes multiple lines of code as though they had been included instead of the line including the eval....
' statement - without the need to produce what otherwise would likely have been a more efficient purpose built encoder/decoder. There are in fact quite large amounts of repeated (and therefore redundant data
Redundancy (engineering)

In engineering, redundancy is the duplication of critical wikt:Components of a system with the intention of increasing reliability of the system, usually in the case of a backup or fail-safe....
) in this particular format (and also in HTML and XML) that could quite easily be eliminated.

Kolmogorov complexity

The study of encoding techniques has been examined in depth in an area of computer science characterized by a method known as Kolmogorov complexity
Kolmogorov complexity

In algorithmic information theory , the Andrey Kolmogorov complexity of an object such as a piece of text is a measure of the computational resources needed to specify the object....
 where a value known as ('K') is accepted as 'not a computable function'. The Kolmogorov complexity of any computable object is the length of the shortest program that computes it and then halts. The invariance theorem
Invariance theorem

In algorithmic information theory, the invariance theorem, originally proved by Ray Solomonoff, states that a universal Turing machine provides an optimal means of description, up to an additive constant....
 shows that it is not really important which computer is used. Essentially this implies that there is no automated method that can produce an optimum result and is therefore characterized by a requirement for human ingenuity
Ingenuity

The term ingenuity or applied ideas is used in the analysis of Thomas Homer-Dixon, building on that of Paul Romer, to refer to what is usually called instructional capital....
 or Innovation
Innovation

The term innovation means a new way of doing something. It may refer to incremental, radical, and revolutionary changes in thinking, products, processes, or organizations....
. See also Algorithmic probability
Algorithmic probability

Algorithmic probability is a concept in theoretical computer science; it quantifies the idea of theories and predictions with reference to short programs and their output....
.

Effect of Programming paradigms

The effect that different programming paradigm
Programming paradigm

A programming paradigm is a fundamental style of computer programming. . Paradigms differ in the concepts and abstractions used to represent the elements of a program and the steps that compose a computation ....
s have on algorithmic efficiency is fiercely contested, with both supporters and antagonist
Antagonist

An antagonist is a character or group of characters, or, always an institution of a happening who represents the opposition against which the protagonist must contend....
s for each new paradigm. Strong supporters of structured programming
Structured programming

Structured programming can be seen as a subset or subdiscipline of procedural programming, one of the major programming paradigms. It is most famous for removing or reducing reliance on the GOTO Statement ....
, such as Dijkstra
Dijkstra

Dijkstra is a Dutch language family name that may refer to:*Edsger W. Dijkstra , computing scientist*Rineke Dijkstra , photographer*Sjoukje Dijkstra , retired figure skater...
 for instance, who favour entirely goto-less
Structured programming

Structured programming can be seen as a subset or subdiscipline of procedural programming, one of the major programming paradigms. It is most famous for removing or reducing reliance on the GOTO Statement ....
 programs are met with conflicting evidence that appears to nullify its supposed benefits . The truth is, even if the structured code itself contains no goto
GOTO

GOTO is a statement found in many computer programming languages. It is a combination of the English words wiktionary:go and wiktionary:to....
s, the optimizing compiler that creates the binary
Binary

Binary means composed of two parts or two pieces. It contrasts with Unary, Ternary, Quaternary , and so on.Binary may also refer to:* Binary option, also known as digital option OR all-or-nothing option...
 code almost certainly uses them (and not necessarily in the most efficient way)! Similarly, OOP
OOP

OOP may refer to:* Object-oriented programming, a computer programming paradigm* Object-oriented positioning, another name for feature-oriented positioning in microscopy...
 antagonist
Antagonist

An antagonist is a character or group of characters, or, always an institution of a happening who represents the opposition against which the protagonist must contend....
s who claim their paradigm is superior are met with opposition from strong sceptics such as Alexander Stepanov
Alexander Stepanov

Alexander Stepanov is the key person behind the C++ Standard Template Library, which he started to develop around 1993 while employed at HP Labs....
 who suggested that OOP provides a mathematically-limited viewpoint and called it, "almost as much of a hoax as Artificial Intelligence" In the long term, benchmark
Benchmark (computing)

In computing, a benchmark is the act of running a computer program, a set of programs, or other operations, in order to assess the relative performance of an object, normally by running a number of standard tests and trials against it....
s, using real-life examples, provide the only real hope of resolving such conflicts - at least in terms of run-time efficiency.

Optimization techniques


Environment specific

Optimization of algorithms frequently depends on the properties of the machine the algorithm will be executed on as well as the language the algorithm is written in and chosen data type
Data type

A data type in programming languages is an attribute of a data which tells the computer something about the kind of data it is. This involves setting constraints on the datum, such as what values it can take and what operations may be performed upon it....
s. For example, a programmer might optimize code for time efficiency in an application for home computers (with sizable amounts of memory), but for code destined to be embedded in small, "memory-tight" devices, the programmer may have to accept that it will run more slowly, simply because of the restricted memory available for any potential software optimization.

For a discussion of hardware
Hardware

Hardware is a general term that refers to the physical cultural artifacts of a technology. It may also mean the physical components of a computer system, in the form of computer hardware....
 performance, see article on Computer performance
Computer performance

Computer performance is characterized by the amount of useful work accomplished by a computer system compared to the time and resources used.Depending on the context, good computer performance may involve one or more of the following:...
 which covers such things as CPU clock speed, cycles per instruction and other relevant metrics
Metrics

A metric is a standard unit of measure, such as meter or mile for length, or gram or ton for weight, or more generally, part of a system of parameters, or systems of measurement, or a set of ways of quantitatively and periodically measuring, assessing, controlling or selecting a person, process, event, or institution, along with the procedure...
. For a discussion on how the choice of particular instructions available on a specific machine effect efficiency, see later section 'Choice of instruction and data type'.

General techniques

  • Table look-ups in particular can be very expensive in terms of execution time but can be reduced significantly through use of efficient techniques such as indexed arrays and binary searches. Using a look-up on 1st occurrence and indexed thereafter is an obvious compromise.
  • Use of index
    Index (information technology)

    In computer science, an index can be:# an integer which identifies an array element# a pointer data element.# a data structure that enables sublinear-time lookup...
    ed program branching, utilizing branch table
    Branch table

    In computer programming, a branch table is a term used to describe an efficient method of transferring program control to another part of a program using a table of branch Instruction s....
    s (or "threaded code"
    Threaded code

    In computer science, the term threaded code refers to a compiler implementation technique where the generated code has a form that essentially consists entirely of calls to subroutines....
     to control program flow, (rather than using multiple conditional IF statements or unoptimized CASE/SWITCH) can drastically reduce instruction path length
    Instruction path length

    In computer performance, the Instruction path length is the number of machine code instructions required to execute a section of a computer program....
    , simultaneously reduce program size
    Binary file

    A binary file is a computer file which may contain any type of data, encoded in Binary numeral system form for computer storage and processing purposes; for example, Document file format containing formatted text....
     and even also make a program easier to read and more easily maintainable (in effect it becomes a 'decision table
    Decision table

    Decision tables are a precise yet compact way to model complicated logic.Decision tables, like Conditional and Switch statement statements, associate conditions with actions to perform....
    ' rather than repetitive spaghetti code
    Spaghetti code

    Spaghetti code is a pejorative term for source code which has a complex and tangled control structure, especially one using many GOTOs, exceptions, threads, or other "unstructured" Branch constructs....
    ).


Dependency trees and Spreadsheets

Spreadsheet
Spreadsheet

A spreadsheet is a computer application that simulates a paper worksheet. It displays multiple cells that together make up a grid consisting of rows and columns, each cell containing either alphanumeric text or numeric values....
s are a 'special case' of algorithm that self optimize by virtue of their dependency trees that are inherent in the design of spreadsheets in order to reduce re-calculations when a cell changes. The results of earlier calculations are effectively cached within the workbook and only updated if an another cells changed value effects it directly.

Searching strings

Searching for particular text string
String (computer science)

In computer programming and some branches of mathematics, a string is an ordered sequence of symbols. These symbols are chosen from a predetermined set or alphabet....
s in long sequences of characters potentially generates lengthy instruction path
Instruction path length

In computer performance, the Instruction path length is the number of machine code instructions required to execute a section of a computer program....
s. This includes searching for delimiter
Delimiter

A delimiter is a sequence of one or more character s used to specify the boundary between separate, independent regions in plain text or other data stream....
s in comma separated
Comma-separated values

A Comma separated values file is a computer data file used for implementing the tried and true organizational tool, the Comma Separated List....
 files or similar processing which can be very simply and effectively eliminated (using declarative notation
String literal

A string literal is the representation of a String value within the source code of a computer program. There are numerous alternate notations for specifying string literals, and the exact notation depends on the individual programming language in question....
 for instance).

Several methods of reducing the cost for general searching have been examined and the "Boyer–Moore string search algorithm
Boyer–Moore string search algorithm

The Boyer?Moore string search algorithm is a particularly efficient string searching algorithm, and it has been the standard benchmark for the practical string search literature....
" (or Boyer–Moore–Horspool algorithm
Boyer–Moore–Horspool algorithm

In computer science, the Boyer?Moore?Horspool algorithm or Horspool's algorithm is an algorithm for finding substrings in string .It is a simplification of the Boyer-Moore algorithm which is related to the Knuth-Morris-Pratt algorithm....
, a similar but modified version) is one solution that has been proven to give superior results to repetitive comparisons of the entire search string along the sequence.

Hot spot analyzers

Special system software products known as "performance analyzers" are often available from suppliers to help diagnose "hot spots" - during actual execution of computer programs - using real or test data - they perform a Performance analysis
Performance analysis

In software engineering, performance analysis, more commonly today known as profiling, is the investigation of a program's behavior using information gathered as the program executes ....
 under generally repeatable conditions. They can pinpoint sections of the program that might benefit from specifically targeted programmer optimization without necessarily spending time optimizing the rest of the code. Using program re-runs, a measure of relative improvement can then be determined to decide if the optimization was successful and by what amount. Instruction Set Simulator
Instruction Set Simulator

An instruction set simulator is a simulation model , usually coded in a high-level programming language, which mimics the behavior of a mainframe or microprocessor by "reading" instructions and maintaining internal variables which represent the processor's registers....
s can be used as an alternative to measure the instruction path length at the machine code level between selected execution paths or on the entire execution.

Efforts have been made at the University of California
University of California

The University of California is a public university system in the U.S. state of California. Under the California Master Plan for Higher Education, the University of California is a part of the state's three-tier public higher education system, which also includes the California State University system and the California Community Colleges s...
, Irvine
Irvine

Irvine may refer to:...
 to produce dynamic executable code using a combination of hot spot analysis and run-time program trace
Tracing (software)

In software engineering, tracing is a specialized use of Data logging to record information about a program's execution. This information is typically used by programmers for debugging purposes, and additionally, depending on the type and detail of information contained in a trace log, by experienced system administrators or technical suppor...
 tree. A JIT
JIT

JIT may refer to:* Various meanings of Just In Time:** Just-in-time compilation - a technique for improving the performance of virtual machines in computing....
 like dynamic compiler was built by Andreas Gal and others, "in which relevant (i.e., frequently executed) control flows are ...discovered lazily during execution"

Benchmarking & competitive algorithms

For new versions of software or to provide comparisons with competitive systems, benchmark
Benchmark (computing)

In computing, a benchmark is the act of running a computer program, a set of programs, or other operations, in order to assess the relative performance of an object, normally by running a number of standard tests and trials against it....
s are sometimes used which assist with gauging an algorithms relative performance. If a new sort
Sorting algorithm

In computer science and mathematics, a sorting algorithm is an algorithm that puts elements of a List in a certain Total order. The most-used orders are numerical order and lexicographical order....
 algorithm is produced for example it can be compared with its predecessors to ensure that at least it is efficient as before with known data - taking into consideration any functional improvements. Benchmarks can be used by customers when comparing various products from alternative suppliers to estimate which product will best suit their specific requirements in terms of functionality and performance. For example in the mainframe
Mainframe

Mainframe may refer to one of the following:* Mainframe computer, large data processing systems* Mainframe Entertainment, a Canadian computer animation and design company....
 world certain proprietary sort
Mainframe sort merge

The Sort/Merge IBM_mainframe_utility_programs is a mainframe program to sort records in a file into a specified order, merge pre-sorted files into a sorted file, or copy selected records....
 products from independent software companies such as Syncsort
Syncsort

Syncsort Incorporated is a global software company specializing in the development and sale of data integration, data protection, and high-speed sorting products for Windows, Unix, Linux, and mainframe systems....
 compete with products from the major suppliers such as IBM
IBM

International Business Machines Corporation, abbreviated IBM and nicknamed "Big Blue" , is a multinational corporation computer technology and consulting corporation headquartered in Armonk, New York, New York, United States....
 for speed. Some benchmarks provide opportunities for producing an analysis comparing the relative speed of various compiled and interpreted languages for example and The Computer Language Benchmarks Game compares the performance of implementations of typical programming problems in several programming languages.

Compiled versus Interpreted languages

A compiled algorithm will, in general, execute faster than the equivalent interpreted
Interpreter (computing)

In computer science, an interpreter normally means a computer program that execution , i.e. performs, instructions written in a programming language....
 algorithm simply because some processing is required even at run time to 'understand' (i.e. interpret) the instructions to effect an execution. A compiled program will normally output an object or machine code
Machine code

Machine code or machine language is a system of instructions and data executed directly by a computer's central processing unit. Machine code may be regarded as a primitive programming language or as the lowest-level representation of a compiled and/or assembly language computer program....
 equivalent of the algorithm that has already been processed by the compiler into a form more readily executed by microcode
Microcode

Microcode is a layer of lowest-level instructions involved in the implementation of machine code instructions in many computers and other processors; it resides in a special high-speed memory and translates machine instructions into sequences of detailed circuit-level operations....
 or the hardware directly. The popular Perl
Perl

In computer programming, Perl is a high-level programming language, List of programming languages by category, Interpreter , dynamic programming language....
 language is an example of an interpreted language and benchmarks indicate that it executes approximately 24 times more slowly than compiled C.

Just-in-time compilers

'On-the-fly' processors known today as just-in-time
Just-in-time compilation

In computing, just-in-time compilation , also known as dynamic translation, is a technique for improving the runtime performance of a computer program....
 or 'JIT' compilers combine features of interpreted languages with compiled languages and may also incorporate elements of optimization
Optimization

Optimization or optimality is a term that may refer to:* Optimization , trying to find maxima and minima of a function* Optimization , improving a system to reduce runtime, bandwidth, memory requirements, or other property of a system; in particular...
 to a greater or lesser extent. Essentially the JIT compiler can compile small sections of source code statements (or bytecode
Bytecode

Bytecode is a term which has been used to denote various forms of instruction sets designed for efficient execution by a software Interpreter as well as being suitable for further compilation into machine language....
) as they are newly encountered and (usually) retain the result for the next time the same source is processed. In addition, pre-compiled segments of code can be in-lined
Inline function

In computer science, an inline function is a programming language construct used to suggest to a compiler that a particular function be subjected to inline expansion; that is, it suggests that the compiler insert the complete body of the function in every context where that function is used....
 or called as dynamic functions that themselves perform equally fast as the equivalent 'custom' compiled function. Because the JIT processor also has access to run-time information (that a normal compiler can't have) it is also possible for it to optimize further executions depending upon the input and also perform other run-time introspective
Introspection

Introspection is the self-observation and reporting of conscious inner thoughts, Motivation and sensations. It is a conscious mental and usually purposive process relying on thinking, reasoning, and examining one's own thoughts, feelings, and, in more spiritual cases, one's soul....
 optimization as execution proceeds. A JIT processor may, or may not, incorporate self modifying code or its equivalent by creating 'fast path' routes through an algorithm. It may also use such techniques as dynamic Fractional cascading
Fractional cascading

In computer science, fractional cascading is a technique to speed up a sequence of binary searches for the same value in a sequence of related data structures....
 or any other similar runtime
Runtime

In computer science, runtime or run time describes the operation of a computer program, the duration of its execution, from beginning to termination ....
 device based on collected actual runtime metrics
Metrics

A metric is a standard unit of measure, such as meter or mile for length, or gram or ton for weight, or more generally, part of a system of parameters, or systems of measurement, or a set of ways of quantitatively and periodically measuring, assessing, controlling or selecting a person, process, event, or institution, along with the procedure...
. It is therefore entirely possible that a JIT compiler might (counter intuitively) execute even faster than an optimally 'optimized' compiled program.

Self modifying code

As mentioned above, just-in-time compilers often make extensive use of self modifying code
Self-modifying code

In computer science, self-modifying code is Code that alters its own Instruction while it is Execution - usually to reduce the instruction path length and improve performance....
 to generate the actual machine instructions required to be executed. The technique can also be used to reduce instruction path length
Instruction path length

In computer performance, the Instruction path length is the number of machine code instructions required to execute a section of a computer program....
s in application programs where otherwise repetetive conditional tests might otherwise be required within the main program flow. This can be particularly useful where a sub routine may have embedded debugging code that is either active (testing mode) or inactive (production mode) depending upon some input parameter. A simple solution using a form of dynamic dispatch
Dynamic dispatch

In computer science, dynamic dispatch is the process of mapping a Message passing to a specific sequence of code at runtime. This is done to support the cases where the appropriate method cannot be determined at compile-time ....
ing is where the sub routine entry point is dynamically 'swapped' at initialization, depending upon the input parameter. Entry point A) includes the debugging code prologue and entry point B) excludes the prologue; thus eliminating all overhead
Overhead

Overhead may be:* Overhead , the ongoing operating costs of running a business* Engineering overhead, ancillary design features required by a component of a device...
 except the initial 'test and swap' (even when test/debugging is selected, when the overhead is simply the test/debugging code itself).

Genetic algorithm

In the world of performance related algorithms it is worth mentioning the role of genetic algorithm
Genetic algorithm

A genetic algorithm is a Search algorithm wikt:technique used in computing to find exact or approximate solutions to Optimization and Search algorithm problems....
s which compete using similar methods to the natural world in eliminating inferior algorithms in favour of more efficient versions.

Object code optimizers

Some proprietary program optimizers such as the "COBOL Optimizer" developed by Capex Corporation
Capex Corporation

Capex Corporation was a software house based in Phoenix, Arizona founded by three former employees of General Electric.It was subsequently acquired by Computer Associates....
 in the mid 1970's for COBOL
COBOL

COBOL is one of the oldest programming languages still in active use. Its name is an acronym for COmmon Business-Oriented Language, defining its primary domain in business, finance, and administrative systems for companies and governments....
, actually took the unusual step of optimizing 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 numeral system form for computer storage and processing purposes; for example, Document file format containing formatted text....
) after normal compilation. This method depended upon knowledge of 'weaknesses' in the standard IBM COBOL compiler and actually replaced (or patch
Patch (computing)

A patch is a small piece of software designed to fix problems with or update a computer program or its supporting data. This includes fixing computer bug, replacing graphics and improving the usability or performance....
ed) sections of the object code with more efficient code. The replacement code might replace a linear table lookup
Lookup table

In 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....
 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. 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.. The main advantage of this method was that the stock of already compiled customer programs (object code) 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 a term coined by advocates of the free software movement to describe computer software which is the legal property of one party....
). A disadvantage was that new releases of COBOL 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 that refers to the physical cultural artifacts of a technology. It may also mean the physical components of a computer system, in the form of computer 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).

Some binary optimizers seek to reduce only the size of binary files by eliminating duplicate library modules - without necessarily also improving their performance, others utilize run-time metrics to introspectively improve performance using techniques similar to JIT
JIT

JIT may refer to:* Various meanings of Just In Time:** Just-in-time compilation - a technique for improving the performance of virtual machines in computing....
 compilers.

More recently developed 'binary optimizers' (for various platforms), some claiming novelty
Novelty (patent)

Novelty is a patentability requirement. An invention is not patentable if the claim ed subject matter was disclosed before the date of filing, or before the date of priority right 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 - which requires a profile phase beforehand
  • Design and Engineering of a Dynamic Binary Optimizer - from IBM
    IBM

    International Business Machines Corporation, abbreviated IBM and nicknamed "Big Blue" , is a multinational corporation computer technology and consulting corporation headquartered in Armonk, New York, New York, United States....
     T. J. Watson Res. Center (Feb 2005)
  • QuaC: Binary Optimization for Fast Runtime Code Generation in C
    C (programming language)

    C is a general-purpose computer programming language originally developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories to implement the Unix operating system....
      - (which appears to include some elements of JIT
    JIT

    JIT may refer to:* Various meanings of Just In Time:** Just-in-time compilation - a technique for improving the performance of virtual machines in computing....
    )
  • The Rio project
  • COBRA: An Adaptive Runtime Binary Optimization Framework for Multithreaded Applications
  • Spike Executable Optimizer (Unix kernal)


Alignment of data

Most processors execute faster if certain data values are aligned on word, doubleword or page
Page (computing)

In a context of computer virtual memory, a page, memory page, or virtual page is a fixed-length block of main memory, that is contiguous in both physical memory addressing and virtual memory addressing....
 boundaries . If possible design/specify structures to satisfy appropriate alignments. This avoids exceptions.

Locality of reference

To reduce Cache miss exceptions by providing good spatial locality of reference
Locality of reference

In computer science, locality of reference, also known as the principle of locality, is the phenomenon of the same value or related computer storage locations being frequently accessed....
, specify 'high frequency'/volative working storage data within defined structure(s) so that they are also allocated from contiguous sections of memory (rather than possibly scattered over many pages).Group closely related data values also 'physically' close together within these structures. Consider the possibility of creating an 'artificial' structure to group some otherwise unrelated, but nevertheless frequently referenced, items together.

Choice of instruction or data type

Particularly in an Assembler language (although also applicable to HLL
HLL

HLL Can have several meanings:* Hertford Loop Line* High-level programming language* hll - The Old Testament Hebrew lexicon hll may refer to the Original Word Transliterated Word hll) translating to allah, el-leh, and also the Aramaic translated word as elleh....
 statements), the choice of a particular 'instruction' or data type
Data type

A data type in programming languages is an attribute of a data which tells the computer something about the kind of data it is. This involves setting constraints on the datum, such as what values it can take and what operations may be performed upon it....
, can have a large impact on execution efficiency. In general, instructions that process variables such as signed or unsigned 16-bit
16-bit

16-bit architectureThe HP 2100#Descendants and variants , introduced in 1975, was the world's first 16-bit microprocessor.Prominent 16-bit processors include the PDP-11, Intel 8086, Intel 80286 and the WDC 65C816....
 or 32-bit
32-bit

The range of integer values that can be stored in 32 bits is 0 through 4,294,967,295 or -2,147,483,648 through 2,147,483,647 using two's complement encoding....
 integer
Integer

The integers are natural numbers including 0 and their negative and non-negative numberss . They are numbers that can be written without a fractional or decimal component, and fall within the set ....
s are faster than those that process floating point
Floating point

In computing, floating point describes a system for numerical representation in which a String of digits represents a rational number.The term floating point refers to the fact that the radix point can "float": that is, it can be placed anywhere relative to the Significant figures of the number....
 or packed decimal. Modern processors are even capable of executing multiple 'fixed point' instructions in parallel with the simultaneous execution of a floating point instruction. If the largest integer to be encountered can be accommodated by the 'faster' data type, defining the variables as that type will result in faster execution - since even a non-optimizing compiler will, in-effect, be 'forced' to choose appropriate instructions that will execute faster than would have been the case with data types associated with 'slower' instructions. Assembler programmers (and optimizing compiler writers) can then also benefit from the ability to perform certain common types of arithmetic for instance - division by 2, 4, 8 etc by performing the very much faster binary shift right operations (in this case by 1, 2 or 3 bits).

If the choice of input data type is not under the control of the programmer, although prior conversion (outside of a loop for instance) to a faster data type carries some overhead
Computational overhead

In computer science, overhead is generally considered any combination of excess or indirect computation time, memory, bandwidth, or other resources that are required to attain a particular goal....
, it can often be worthwhile if the variable is then to be used as a loop
Loop

A loop is generally something that closes back on itself such as a circle. The closing can appear in time or in space....
 counter, especially if the count could be quite a high value or there are many input values to process. As mentioned above, choice of individual assembler instructions (or even sometimes just their order of execution) on particular machines can effect the efficiency of an algorithm. See for one quite numerous arcane
Esotericism

Esotericism or Esoterism is a term with two basic meanings. In the dictionary sense of the term, it signifies the holding of esoteric opinions, and derives from the Greek ' ', a compound of ' ': "wikt:within", thus "pertaining to the more inward", mystic....
 list of various technical (and sometimes non-intuitive) considerations for choice of assembly instructions on different processors that also discusses the merits of each case. Sometimes microcode
Microcode

Microcode is a layer of lowest-level instructions involved in the implementation of machine code instructions in many computers and other processors; it resides in a special high-speed memory and translates machine instructions into sequences of detailed circuit-level operations....
 or hardware
Hardware

Hardware is a general term that refers to the physical cultural artifacts of a technology. It may also mean the physical components of a computer system, in the form of computer hardware....
 quirk
Quirk

The word quirk is used to describe an odd habituation, and is used as a surname.Most dictionaries list this word's origin as "unknown". However, as the surname arises from the Isle of Man in the Irish Sea, and because the island is somewhat notorious for Idiosyncrasy behaviors, this may be the place of origin.....
s can result in unexpected performance differences between processors that assembler programmers can actively code for - or else specifically avoid if penalties result - something even the best optimizing compiler may not be designed to handle.

Choice of language / mixed languages

Some computer languages can execute algorithms more efficiently than others. As stated already, interpreted languages often perform less efficiently than compiled languages. In addition, where possible, 'high-use' , and time-dependent sections of code may be written in a language such as assembler that can usually execute faster and make better use of resources on a particular platform than the equivalent HLL
HLL

HLL Can have several meanings:* Hertford Loop Line* High-level programming language* hll - The Old Testament Hebrew lexicon hll may refer to the Original Word Transliterated Word hll) translating to allah, el-leh, and also the Aramaic translated word as elleh....
 code on the same platform. This section of code can either be statically call
Call

Call may refer to:* A type of Betting * Bird call, part of a bird song* A command in square dancing, delivered by a Caller * Call , often specifically a telephone call...
ed or dynamically invoked (external function) or embedded within the higher level code (eg. Assembler instructions embedded in a 'C
C (programming language)

C is a general-purpose computer programming language originally developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories to implement the Unix operating system....
' language program). The effect of higher levels of abstraction when using a HLL
HLL

HLL Can have several meanings:* Hertford Loop Line* High-level programming language* hll - The Old Testament Hebrew lexicon hll may refer to the Original Word Transliterated Word hll) translating to allah, el-leh, and also the Aramaic translated word as elleh....
 has been described as the Abstraction penalty Programmers who are familiar with assembler language (in addition to their chosen HLL) and are also familiar with the code that will be generated by the HLL, under known conditions, can sometimes use HLL language primitive
Language primitive

In computing, language primitives are the simplest elements available in a programming language. It can be defined as the smallest 'unit of processing' available to a programmer of a particular computer....
s of that language to generate code almost identical to assembler language. This is most likely to be possible only in languages that support pointers such as PL/1 or C
C

C or c is a consonant in Esperanto orthography, representing a voiceless postalveolar affricate , and is equivalent to the voiceless postalveolar affricate, , or the voiceless retroflex affricate, ...
. This is facilitated if the chosen HLL compiler provides an optional assembler listing as part of its printout so that various alternatives can be explored without also needing specialist knowledge of the compiler internals.

Software validation versus hardware validation

An optimization technique that was frequently taken advantage of on 'legacy
Legacy system

A legacy system is an old computer system or application program that continues to be used, typically because it still functions for the users' needs, even though newer technology is available....
' platforms was that of allowing the hardware (or microcode
Microcode

Microcode is a layer of lowest-level instructions involved in the implementation of machine code instructions in many computers and other processors; it resides in a special high-speed memory and translates machine instructions into sequences of detailed circuit-level operations....
) to perform validation on numeric
Numeric

Numeric may refer to:* of, or relating to, numbers* NumPy or Numerical Python* floating point data type...
 data fields such as those coded in (or converted to) packed decimal (or packed BCD). The choice was to either spend processing time checking each field for a valid numeric content in the particular internal representation chosen or simply assume the data was correct and let the hardware
Hardware

Hardware is a general term that refers to the physical cultural artifacts of a technology. It may also mean the physical components of a computer system, in the form of computer hardware....
 detect the error upon execution. The choice was highly significant because in order to check for validity on multiple fields (for sometimes many millions of input records), it could occupy valuable computer resources. Since input data fields were in any case frequently built from the output of earlier computer processing, the actual probability of a field containing invalid data was exceedingly low and usually the result of some 'corruption'. The solution was to incorporate an 'event handler' for the hardware detected condition ('data exception
Exception handling

Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of exceptions - special conditions that change the normal flow of execution....
)' that would intercept the occasional errant data field and either 'report, correct and continue' or, more usually, abort
Abort (computing)

In a computer or data transmission system, to abort means to Wiktionary:terminate, usually in a controlled manner, a processing activity because it is impossible or undesirable for the activity to proceed....
 the run with a core dump
Core dump

In computing, a core dump consists of the recorded state of the working Computer storage of a computer program at a specific time, generally when the program has terminated abnormally ....
 to try to determine the reason for the bad data.

Similar event handlers are frequently utilized in today's web based applications to handle other exceptional conditions but repeatedly parsing data input, in order to ensure its validity before execution, has nevertheless become much more commonplace - partly because processors have become faster (and the perceived need for efficiency in this area less significant) but, predominantly - because data structure
Data structure

A data structure in computer science is a way of storing data in a computer so that it can be used efficiently. It is an organization of mathematical and logical concepts of data....
s have become less 'formalized' (eg. .csv and .tsv files) or uniquely identifiable (eg. packed decimal). The potential savings using this type of technique may have therefore fallen into general dis-use as a consequence and therefore repeated data validations and repeated data conversions have become an accepted overhead
Overhead

Overhead may be:* Overhead , the ongoing operating costs of running a business* Engineering overhead, ancillary design features required by a component of a device...
. Ironically, one consequence of this move to less formalized data structures is that a corruption of say, a numeric binary integer
Integer

The integers are natural numbers including 0 and their negative and non-negative numberss . They are numbers that can be written without a fractional or decimal component, and fall within the set ....
 value, will not be detected at all by the hardware upon execution (for instance: is an ASCII
ASCII

American Standard Code for Information Interchange , is a coding standard that can be used for interchanging information, if the information is expressed mainly by the written form of English words....
 hexadecimal
Hexadecimal

In mathematics and computer science, hexadecimal is a numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 09 to represent values zero to nine, and A, B, C, D, E, F to represent values ten to fifteen....
 value '20202020' a valid signed or unsigned binary value - or simply a string of blanks that has corrupted it?)

Algorithms for Vector & superscalar processors

Algorithms for vector processor
Vector processor

A vector processor, or array processor, is a Central processing unit design where the instruction set includes operations that can perform mathematical operations on multiple data elements simultaneously....
s are usually different than those for scalar processor
Scalar processor

Scalar processors represent the simplest class of computer processors. A scalar processor processes one data item at a time . In a vector processor, by contrast, a single instruction operates simultaneously on multiple data items....
s since they can process multiple instructions and/or multiple data elements in parallel (for examples of these differences see 'description' in the main article). The process of converting an algorithm from a scalar to a vector process is known as vectorization and methods for automatically performing this transformation as efficiently as possible are constantly sought. There are intrinsic limitations for implementing instruction level parallelism
Instruction level parallelism

Instruction-level parallelism is a measure of how many of the operations in a computer program can be performed simultaneously. Consider the following program:...
 in Superscalar
Superscalar

A superscalar Central processing unit architecture implements a form of parallel computer called instruction level parallelism within a single processor....
 processors (which are discussed in the 'limitations' section in the main article) but, in essence, the overhead
Overhead

Overhead may be:* Overhead , the ongoing operating costs of running a business* Engineering overhead, ancillary design features required by a component of a device...
 in deciding for certain if particular instruction sequences can be processed in parallel can sometimes exceed the efficiency gain in so doing. Algorithms designed for this class of processor therefore require more care if they are not to unwittingly disrupt the potential gains.

Avoiding costs

  • Defining variables as integer
    Integer

    The integers are natural numbers including 0 and their negative and non-negative numberss . They are numbers that can be written without a fractional or decimal component, and fall within the set ....
    s for indexed arrays instead of floating point
    Floating point

    In computing, floating point describes a system for numerical representation in which a String of digits represents a rational number.The term floating point refers to the fact that the radix point can "float": that is, it can be placed anywhere relative to the Significant figures of the number....
     will result in faster execution (see above).
  • Defining structures whose structure length is a multiple of a power of 2 (2,4,8,16 etc), will allow the compiler to calculate array
    Array

    In computer science, an array is a data structure consisting of a group of element s that are accessed by index . In most programming languages each element has the same data type and the array occupies a contiguous area of computer memory....
     indexes by shifting a binary index by 1, 2 or more bits to the left, instead of using a multiply instruction will result in faster execution. Adding an otherwise redundant short filler variable to 'pad out' the length of a structure element to say 8 bytes when otherwise it would have been 6 or 7 bytes may reduce overall processing time by a worthwhile amount for very large arrays. See for generated code differences for C
    C (programming language)

    C is a general-purpose computer programming language originally developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories to implement the Unix operating system....
     as for example.
  • Storage defined in terms of bits, when bytes would suffice, may inadvertently involve extremely long path lengths involving bitwise operation
    Bitwise operation

    In computer programming, a bitwise operation operates on one or two bit patterns or Binary numeral system at the level of their individual bits....
    s instead of more efficient single instruction 'multiple byte' copy instructions. (This does not apply to 'genuine' intentional bitwise operations - used for example instead of multiplication or division by powers of 2 or for TRUE/FALSE flags.)
  • Unnecessary use of allocated dynamic storage when static storage
    Static memory allocation

    Static memory allocation refers to the process of allocating memory at Compile time before the associated program is executed, unlike dynamic memory allocation or automatic memory allocation where memory is allocated as required at Runtime....
     would suffice, can increase the processing overhead substantially - both increasing memory requirements and the associated allocation/deallocation path length
    Path length

    In chemistry, the path length is defined as the distance that light travels through a sample in an analytical cell. Typically, a sample cell is made of quartz, glass, or a plastic rhombic cuvette with a volume typically ranging from 0.1 mL to 10 mL or larger used in a spectrophotometer....
     overheads for each function call.
  • Excessive use of function calls for very simple functions, rather than in-line statements, can also add substantially to instruction path length
    Instruction path length

    In computer performance, the Instruction path length is the number of machine code instructions required to execute a section of a computer program....
    s and stack
    Stack (data structure)

    In computer science, a stack is an abstract data type and data structure based on the principle of LIFO . Stacks are used extensively at every level of a modern computer system....
    /unstack overheads. For particularly time critical systems that are not also code size sensitive, automatic or manual inline expansion
    Inline expansion

    In computing, inline expansion, or inlining, is a compiler optimization that replaces a function call site with the body of the callee. This optimization may improve time and space usage at runtime, at the possible cost of increasing the size of the final program....
     can reduce path length by eliminating all the instructions that call the function and return from it. A conceptually similar method, loop unwinding
    Loop unwinding

    Loop unwinding, also known as loop unrolling, is a loop transformation technique that attempts optimize a program's execution speed at the expense of its size....
    , eliminates the instructions required to set up and terminate a loop
    Control flow

    In computer science control flow refers to the order in which the individual statement , Instruction or function calls of an imperative programming or functional programming computer program are execution or evaluated....
     by, instead; repeating the instructions inside the loop multiple times. This of course eliminates the branch back instruction but also increases the size of the binary file
    Binary file

    A binary file is a computer file which may contain any type of data, encoded in Binary numeral system form for computer storage and processing purposes; for example, Document file format containing formatted text....
     or, in the case of JIT
    Just-in-time compilation

    In computing, just-in-time compilation , also known as dynamic translation, is a technique for improving the runtime performance of a computer program....
     built code, dynamic memory. Care must be taken with this method also, that re-calculating addresses for each statement for an unwound indexed loop is not more expensive than incrementing pointers within the former loop would have been.
  • Array processing
    Array processing

    Array processing is signal processing of the outputs of an array of sensors to:* Enhance the signal-to-interference-plus-noise ratio compared to that of a single sensor using conventional or adaptive beamforming....
     may simplify programming but use of separate statements to sum different elements of the same array(s) may produce code that is not easily optimized and that requires multiple passes of the arrays that might otherwise have been processed in a single pass. It may also duplicate data if array slicing
    Array slicing

    In computer programming, array slicing is an operation that extracts certain elements from an array and packages them as another array, possibly with different number of indices and different index ranges....
     is used, leading to increased memory
    Memory

    In psychology, memory is an organism's mental ability to store, retain and recall information. Traditional studies of memory began in the fields of philosophy, including techniques of mnemonic....
     usage and copying overhead
    Computational overhead

    In computer science, overhead is generally considered any combination of excess or indirect computation time, memory, bandwidth, or other resources that are required to attain a particular goal....
    .


Readability, trade offs and trends

One must be careful, in the pursuit of good coding style, not to over-emphasize efficiency. Frequently, a clean, readable and 'usable' design is much more important than a fast, efficient design that is hard to understand. There are exceptions to this 'rule' (such as embedded system
Embedded system

An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions, often with real-time computing constraints....
s, where space is tight, and processing power minimal) but these are rarer than one might expect.

However, increasingly, for many 'time critical' applications such as air line reservation systems, point-of-sale applications, ATMs
Automated teller machine

An automated teller machine is a computerized telecommunications device that provides the customers of a financial institution with access to financial transactions in a public space without the need for a human clerk or bank teller....
 (cash-point machines), Airline Guidance system
Guidance system

A guidance system is a device or group of devices used to navigation a ship, aircraft, missile, rocket, satellite, or other craft. Typically, this refers to a system that navigates without direct or continuous human control....
s, Collision avoidance systems
Collision avoidance systems

Intelligent Transportation Systems is a technology that allows cars to ?think.? Within this broad field, there are many subdivisions like freeway management, Electronic_toll_collection, and road and weather management....
 and numerous modern web based applications - operating in a real-time environment where speed of response is fundamental - there is little alternative.

Determining if optimization is worthwhile

The essential criteria for using optimized code are of course dependent upon the expected use of the algorithm. If it is a new algorithm and is going to be in use for many years and speed is relevant, it is worth spending some time designing the code to be as efficient as possible from the outset. If an existing algorithm is proving to be too slow or memory is becoming an issue, clearly something must be done to improve it.

For the average application, or for one-off applications, avoiding inefficient coding techniques and encouraging the compiler to optimize where possible may be sufficient.

One simple way (at least for mathematicians) to determine whether an optimization is worthwhile is as follows: Let the original time and space requirements (generally in Big-O notation) of the algorithm be and . Let the new code require and time and space respectively. If , the optimization should be carried out. However, as mentioned above, this may not always be true.

Implications for algorithmic efficiency

A recent report, published in December 2007, from Global Action Plan, a UK-based environmental organisation found that computer server
Server (computing)

A server is a computer program that provides services to other computer programs , in the same or other computer. The physical computer that runs a server program is also often referred to as server....
s are "at least as great a threat to the climate
Climate

Climate encompasses the temperatures, humidity, atmospheric pressure, winds, rainfall, atmospheric particle count and numerous other Meteorology elements in a given region over long periods of time, as opposed to the term weather, which refers to current activity of these same elements....
 as SUVs or the global aviation
Aviation

File:Norwegian military Bell 412SP helicopters.jpgAviation refers to activities involving man-made flying devices , including the people, organizations, and regulatory bodies involved with them....
 industry" drawing attention to the carbon footprint of the IT
Information technology

Information technology , as defined by the Information Technology Association of America , is "the study, design, development, implementation, support or management of computer-based information systems, particularly software applications and computer hardware." IT deals with the use of electronic computers and computer software to data conv...
 industry in the UK. According to an Environmental Research Letters
Environmental Research Letters

Environmental Research Letters is an open-access, electronic-only journal publishing peer-reviewed research across the whole of environmental science....
 report published in September 2008, "Total power used by information technology equipment in data centers represented about 0.5% of world electricity consumption in 2005. When cooling and auxiliary infrastructure are included, that figure is about 1%. The total data center power demand in 2005 is equivalent (in capacity terms) to about seventeen 1000 MW power plants for the world."

Some media reports claim that performing two Google search
Google search

Google search is a Web search engine owned by Google, and is the most used search engine on the World Wide Web. Google receives several hundred million queries each day through its various services....
es from a desktop computer
Desktop computer

A desktop computer is a personal computer in a form intended for regular use at a single location, as opposed to a mobile laptop or portable computer....
 can generate about the same amount of carbon dioxide
Carbon dioxide

Carbon dioxide is a chemical compound composed of two oxygen atoms covalent bond to a single carbon atom. It is a gas at standard temperature and pressure and exists in Earth's atmosphere in this state....
 as boiling a kettle for a cup of tea, according to new research ; however, the factual accuracy of this comparison is disputed, and the author of the study in question asserts that the two-searches-tea-kettle statistic is a misreading of his work.

Computers having become increasingly more powerful over the past few decades, emphasis was on a 'brute force
Brute force

Brute force may refer to:* Brute-force search, a trivial computer problem-solving technique* Brute force attack, a method of defeating a cryptographic scheme by trying a large number of possibilities...
' mentality. This may have to be reconsidered in the light of these reports and more effort placed in future on reducing carbon footprint
Carbon footprint

A carbon footprint is ?the total set of GHG emissions caused directly and indirectly by an individual,organization, event or product? . An individual, nation or organization's carbon footprint is measured by undertaking a GHG emissions assessment....
s through optimization. It is a timely reminder that algorithmic efficiency is just another aspect of the more general thermodynamic efficiency. The genuine economic benefits of an optimized algorithm are, in any case, that more processing can be done for the same cost or that useful results can be shown in a more timely manner and ultimately, acted upon sooner.

Criticism of the current state of programming

  • David May FRS a British
    United Kingdom

    The United Kingdom of Great Britain and Northern Ireland, commonly known as the United Kingdom , the UK or Britain,is a sovereign state located off the northwestern coast of continental Europe....
     computer scientist
    Computer scientist

    A computer scientist is a person who has acquired knowledge of computer science, the study of the theoretical foundations of information and computation and their application in computer systems....
     and holder of more than 34 patents , currently Professor
    Professor

    The meaning of the word professor varies. In some English-speaking countries, it refers to a senior academic who holds a departmental chair, especially as head of the Academic department, or a personal chair awarded specifically to that individual....
     of Computer Science
    Computer science

    Computer science is the study of the theoretical foundations of information and computation, and of practical techniques for their implementation and application in computer systems....
     at University of Bristol
    University of Bristol

    The University of Bristol is a university in Bristol, England. It received its Royal Charter in 1909, although its predecessor institution, University College, Bristol, had been in existence since 1876....
     and founder and CTO
    CTO

    CTO may refer to:* Chinese Trademark Office* Central Telegraph Office, London UK* Cancelled-to-order, a postage stamp that was cancelled by the postal administration before being sold to stamp collectors...
     of XMOS Semiconductor
    XMOS

    XMOS is a fabless semiconductor company that manufactures multi-core multi-threaded processors designed to execute several real-time tasks, DSP, and control flow all at once....
    , believes one of the problems is that there is a reliance on Moore’s law to solve inefficiences. He has advanced an 'alternative' to Moore's law (May's law) stated as follows:
"Software efficiency halves every 18 months, compensating Moore’s Law" He goes on to state "In ubiquitous systems, halving the instructions executed can double the battery life and big data sets bring big opportunities for better software and algorithms: "Reducing the number of operations from N x N to N x log(N) has a dramatic effect when N is large... for N = 30 billion, this change is as good as 50 years of technology improvements"

  • Software author Adam N. Roseburg in his blog "The failure of the Digital computer", has described the current state of programming as nearing the "Software event horizon
    Software event horizon

    The software event horizon is a fictitious event described by Adam N. Rosenberg [] that satire the failure of computer programming since the 1980s - comparing it to the "Places in The Hitchhiker's Guide to the Galaxy" described by Douglas Adams in his book The Hitchhiker's Guide to the Galaxy []....
    ", (eluding to the fictitious "shoe event horizon" described by Douglas Adams
    Douglas Adams

    Douglas Noel Adams was an England author, dramatist and musician. He is best known as the author of the The Hitchhiker's Guide to the Galaxy series....
     in his Hitchhiker's Guide to the Galaxy book ). He estimates there has been a 70 dB factor loss of productivity or "99.99999 percent, of its ability to deliver the goods", since the 1980s - "When Arthur C. Clarke
    Arthur C. Clarke

    Sri Lankabhimanya Sir Arthur Charles Clarke, Order of the British Empire was a British people science fiction author, inventor, and Futurology, most famous for the novel 2001: A Space Odyssey , written in collaboration with director Stanley Kubrick, a collaboration which also produced the 2001: A Space Odyssey ; and as a host and comment...
     compared the reality of computing in 2001 to the computer HAL
    HAL 9000

    HAL 9000 is a fictional computer in Arthur C. Clarke's Space Odyssey saga. The novels, along with two films, begin with 2001: A Space Odyssey, released in 1968....
     in his book 2001: A Space Odyssey, he pointed out how wonderfully small and powerful computers were but how disappointing computer programming had become".
  • Conrad Weisert gives examples, some of which were published in ACM SIGPLAN (Special Interest Group on Programming Languages) Notices, December, 1995 in: "Atrocious Programming Thrives"


See also

  • Arithmetic coding
    Arithmetic coding

    Arithmetic coding is a method for lossless data compression. Normally, a string of characters such as the words "hello there" is represented using a fixed number of bits per character, as in the American Standard Code for Information Interchange code....
     - a form of variable-length
    Variable-length code

    In coding theory a variable-length code is a code which maps source symbols to a variable number of bits.Variable-length codes can allow sources to be data compression and decompressed with zero error and still be read back symbol by symbol....
     entropy encoding
    Entropy encoding

    In information theory an entropy encoding is a lossless data compression scheme that is independent of the specific characteristics of the medium....
     for efficient data compression
  • Associative array
    Associative array

    An associative array is an abstract data type composed of a Collection of unique keys and a collection of values, where each key is associated with one value ....
     - a data structure that can be made more efficient using Patricia trees or Judy array
    Judy array

    In computer science and software engineering, a Judy array is a complex but very fast associative array data structure for storing and looking up values using integer or string keys....
    s
  • Binary search algorithm
    Binary search algorithm

    In computer science, a binary search algorithm is a technique for locating a particular value in a Collation. The method makes progressively better guesses, and closes in on the location of the sought value by selecting the middle element in the span , comparing its value to the target value, and determining if it is greater than, less than,...
     - a simple and efficient technique for searching sorted array
    Array

    In computer science, an array is a data structure consisting of a group of element s that are accessed by index . In most programming languages each element has the same data type and the array occupies a contiguous area of computer memory....
    s
  • Benchmark
    Benchmark (computing)

    In computing, a benchmark is the act of running a computer program, a set of programs, or other operations, in order to assess the relative performance of an object, normally by running a number of standard tests and trials against it....
     - a method for measuring comparative execution times in defined cases
  • Best, worst and average case
    Best, worst and average case

    In computer science, best, worst and average cases of a given algorithm express what the Resource usage is at least, at most and on average, respectively....
     - considerations for estimating execution times in three scenarios
  • Branch table
    Branch table

    In computer programming, a branch table is a term used to describe an efficient method of transferring program control to another part of a program using a table of branch Instruction s....
     - a technique for reducing instruction path-length, size of machine code
    Machine code

    Machine code or machine language is a system of instructions and data executed directly by a computer's central processing unit. Machine code may be regarded as a primitive programming language or as the lowest-level representation of a compiled and/or assembly language computer program....
    , (and often also memory}
  • Compiler optimization
    Compiler optimization

    Compiler optimization is the process of tuning the output of a compiler to minimize or maximize some attribute of an executable computer program....
     - compiler-derived optimization
  • also Optimizing compiler
    Compiler optimization

    Compiler optimization is the process of tuning the output of a compiler to minimize or maximize some attribute of an executable computer program....
     - a specifically designed compiler for optimization
    Optimization (computer science)

    In computing, optimization is the process of modifying a system to make some aspect of it work more efficiently or use fewer resources. For instance, a computer program may be optimized so that it executes more rapidly, or is capable of operating with less Computer data storage or other resources, or draw less power....
     at compile time
  • Computational complexity theory
    Computational complexity theory

    Computational complexity theory, as a branch of the theory of computation in computer science, investigates the problems related to the Computational resource required for the execution of algorithms , and the inherent difficulty in providing efficient algorithms for specific computational problems....
  • Computer performance
    Computer performance

    Computer performance is characterized by the amount of useful work accomplished by a computer system compared to the time and resources used.Depending on the context, good computer performance may involve one or more of the following:...
    , - computer hardware metrics
  • Data compression
    Data compression

    In computer science and information theory, data compression or source coding is the process of encoding information using fewer bits than an code representation would use through use of specific encoding schemes....
     - reducing transmission bandwidth and disk storage
  • Entropy encoding
    Entropy encoding

    In information theory an entropy encoding is a lossless data compression scheme that is independent of the specific characteristics of the medium....
     - encoding data efficiently using frequency of occurrence of strings as a criterion for substitution
  • Green computing
    Green computing

    Green computing is the study and practice of using computing resources efficiently. The primary objective of such a program is to account for the triple bottom line, an expanded spectrum of values and criteria for measuring organizational success....
     - a move to implement 'greener' technologies, consuming less resources
  • Huffman algorithm - an algorithm for efficient data encoding
  • Index (information technology)
    Index (information technology)

    In computer science, an index can be:# an integer which identifies an array element# a pointer data element.# a data structure that enables sublinear-time lookup...
     - a technique for fast lookup using indexes
    Index (information technology)

    In computer science, an index can be:# an integer which identifies an array element# a pointer data element.# a data structure that enables sublinear-time lookup...
  • Locality of reference
    Locality of reference

    In computer science, locality of reference, also known as the principle of locality, is the phenomenon of the same value or related computer storage locations being frequently accessed....
     - for avoidance of caching delays caused by non-local memory access
  • Loop optimization
    Loop optimization

    In compiler theory, loop optimization plays an important role in improving cache performance, making effective use of parallel processing capabilities, and reducing overheads associated with executing Control flow#Loops....
  • Optimization (computer science)
    Optimization (computer science)

    In computing, optimization is the process of modifying a system to make some aspect of it work more efficiently or use fewer resources. For instance, a computer program may be optimized so that it executes more rapidly, or is capable of operating with less Computer data storage or other resources, or draw less power....
  • Performance analysis
    Performance analysis

    In software engineering, performance analysis, more commonly today known as profiling, is the investigation of a program's behavior using information gathered as the program executes ....
     – methods of measuring actual performance of an algorithm at run-time
  • Real-time computing
    Real-time computing

    In computer science, real-time computing is the study of Computer hardware and computer software systems that are subject to a "real-time constraint"?i.e., operational deadlines from event to system response....
     – further examples of time-critical applications
  • Run-time analysis – estimation of expected run-times and an algorithm's scalability
  • Super-threading
    Super-threading

    Super-threading is a multithreading approach that weaves together the execution of different threads on a single processor without truly executing them at the same time....
  • Simultaneous multithreading
    Simultaneous multithreading

    Simultaneous multithreading, often abbreviated as SMT, is a technique for improving the overall efficiency of superscalar Central processing unit with Multithreading ....
  • Speculative execution
    Speculative execution

    In computer science, speculative execution is the execution of Code , the result of which may not be needed. In the context of functional programming, the term "speculative evaluation" is used instead....
     or Eager execution
  • Threaded code
    Threaded code

    In computer science, the term threaded code refers to a compiler implementation technique where the generated code has a form that essentially consists entirely of calls to subroutines....
     - similar to virtual method table or branch table
  • Virtual method table
    Virtual method table

    A virtual method table, virtual function table, dispatch table, or vtable, is a mechanism used in programming language to support dynamic dispatch ....
     - branch table with dynamically assigned pointers for dispatching