Peephole optimization
Compiler optimization technique / From Wikipedia, the free encyclopedia
Dear Wikiwand AI, let's keep it short by simply answering these key questions:
Can you list the top facts and stats about Peephole optimization?
Summarize this article for a 10 year old
SHOW ALL QUESTIONS
Peephole optimization is an optimization technique performed on a small set of compiler-generated instructions, known as a peephole or window,[1] that involves replacing the instructions with a logically equivalent set that has better performance.
For example:
- Instead of pushing a register onto the stack and then immediately popping the value back into the register, remove both instructions
- Instead of multiplying x by 2, do
x + x
- Instead of multiplying a floating point register by 8, add 3 to the floating point register's exponent
The term peephole optimization was introduced by William Marshall McKeeman in 1965.[2]