|
In computer science, speculative execution is the execution of code whose result may not actually be needed. In the context of functional programming the term "speculative evaluation" is used instead. Computer science (academically, CS, CSC or compsci) encompasses a variety of topics that relates to computation, like abstract analysis of algorithms, formal grammars, and subjects such as programming languages, program design, software and computer hardware. ...
In communications, a code is a rule for converting a piece of information (for example, a letter, word, or phrase) into another form or representation, not necessarily of the same sort. ...
Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions. ...
Speculative execution is an optimization. It is useful only when early execution consumes less time and space than later execution would, and the savings are enough to compensate, in the long run, for the possible wasted effort of computing a value which is never used. In computing, optimization is the process of modifying a system to improve its efficiency. ...
Modern pipelined microprocessors use speculative execution to reduce the cost of conditional branch instructions. When a conditional branch instruction is encountered, the processor guesses which way the branch is most likely to go (this is called branch prediction), and immediately starts executing instructions from that point. If the guess later proves to be incorrect, all computation past the branch point is discarded. The early execution is cheap because the pipeline stages involved would otherwise lie dormant until the next instruction was known. Microprocessors, including an Intel 80486DX2 and an Intel 80386 A microprocessor (abbreviated as µP or uP) is an electronic computer central processing unit (CPU) made from miniaturized transistors and other circuit elements on a single semiconductor integrated circuit (IC) (aka microchip or just chip). ...
A conditional branch is a basic logical structure. ...
In computer architecture, a branch predictor is the part of a processor that determines whether a conditional branch in the instruction flow of a program is likely to be taken or not. ...
Though it's seldom referred to as such, eager evaluation is also a form of speculative execution (although the situation is complicated by the presence of side effects). The early evaluation is often cheaper because values needed for the computation are likely to be available on the stack and need not be stored and later retrieved from the heap. It can also be substantially more expensive, as in the case of generating the list of integers from 1 to 1,000,000. Programmers writing code in a strict programming language avoid these cases by using explicit laziness or by circumlocution (which can become very elaborate). Eager evaluation is the evaluation model in most traditional programming languages. ...
In computer science, a side-effect is a property of a programming language function that it modifies some state other than its return value. ...
A stack is a data structure that works on the principle of Last In First Out (LIFO). ...
A strict programming language is one in which only strict functions may be defined by the user. ...
In computer programming, lazy evaluation is a concept that attempts to minimize the work the computer has to do. ...
Lazy evaluation does not speculate. The incorporation of speculative evaluation into implementations of the Haskell programming language is a current research topic. Eager Haskell is designed around the idea of speculative evaluation. Recent versions of GHC support a kind of speculative evaluation called optimistic evaluation. In computer programming, lazy evaluation is a concept that attempts to minimize the work the computer has to do. ...
Haskell is a standardized functional programming language with non-strict semantics, named after the logician Haskell Curry. ...
The Glasgow Haskell Compiler (or GHC) is an open source Native code Compiler for the functional programming language Haskell which was developed at the University of Glasgow. ...
|