ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Doc5
In computer science, a space–time or time–memory tradeoff is a situation where
the memory use can be reduced at the cost of slower program execution (and, conversely,
the computation time can be reduced at the cost of increased memory use). As the relative
costs of CPU cycles, RAM space, and hard drive space change—hard drive space has for some
time been getting cheaper at a much faster rate than other components of computers[citation
needed]
       —the appropriate choices for space–time tradeoffs have changed radically. Often, by
exploiting a space–time tradeoff, a program can be made to run much faster.
N COMPUTER SCIENCE, A SPACE-TIME OR TIME-MEMORY TRADEOFF IS A
SITUATION WHERE THE MEMORY USE CAN BE REDUCED AT THE COST OF
SLOWER PROGRAM EXECUTION (OR, VICE VERSA, THE COMPUTATION TIME CAN
BE REDUCED AT THE COST OF INCREASED MEMORY USE). AS THE RELATIVE
COSTS OF CPU CYCLES, RAM SPACE, AND HARD DRIVE SPACE CHANGE HARD
DRIVE SPACE HAS FOR SOME TIME BEEN GETTING CHEAPER AT A MUCH FASTER
RATE THAN OTHER COMPONENTS OF COMPUTERS. THE APPROPRIATE CHOICES
FOR SPACE-TIME TRADEOFFS HAVE CHANGED RADICALLY. OFTEN, BY
EXPLOITING A SPACE-TIME TRADEOFF, A PROGRAM CAN BE MADE TO RUN MUCH
FASTER.
THE MOST COMMON SITUATION IS AN ALGORITHM INVOLVING A LOOKUP TABLE:
AN IMPLEMENTATION CAN INCLUDE THE ENTIRE TABLE, WHICH REDUCES
COMPUTING TIME, BUT INCREASES THE AMOUNT OF MEMORY NEEDED, OR IT
CAN COMPUTE TABLE ENTRIES AS NEEDED, INCREASING COMPUTING TIME, BUT
REDUCING MEMORY REQUIREMENTS. A SPACE-TIME TRADEOFF CAN BE APPLIED
TO THE PROBLEM OF DATA STORAGE. IF DATA IS STORED UNCOMPRESSED, IT
TAKES MORE SPACE BUT LESS TIME THAN IF THE DATA WERE STORED
COMPRESSED (SINCE COMPRESSING THE DATA REDUCES THE AMOUNT OF
SPACE IT TAKES, BUT IT TAKES TIME TO RUN THECOMPRESSION ALGORITHM).
DEPENDING ON THE PARTICULAR INSTANCE OF THE PROBLEM, EITHER WAY IS
PRACTICAL. ANOTHER EXAMPLE IS DISPLAYING MATHEMATICAL FORMULAE ON
PRIMARILY TEXT-BASED WEBSITES, SUCH AS WIKIPEDIA.
Storing only the LaTeX source and rendering it as an image every time the page is
requested would be trading time for space - more time used, but less space. Rendering the
image when the page is changed and storing the rendered images would be trading space
for time - more space used, but less time. Note that there are also rare instances where it is
possible to directly work with compressed data, such as in the case of compressed bitmap
indices, where it is faster to work with compression than without compression. Larger code
size can be traded for higher program speed when applying loop unrolling. This technique
makes the code longer for each iteration of a loop, but saves the computation time required
for jumping back to the beginning of the loop at the end of each iteration. Algorithms that
also make use of space-time tradeoffs include:
BABY-STEP GIANT-STEP ALGORITHM FOR CALCULATING DISCRETE LOGARITHMS.
RAINBOW TABLES IN CRYPTOGRAPHY, WHERE THE ADVERSARY IS TRYING TO DO
BETTER THAN THE EXPONENTIAL TIME REQUIRED FOR A BRUTE FORCE ATTACK.
RAINBOW TABLES USE PARTIALLY PRECOMPUTED VALUES IN THE HASH SPACE
OF A CRYPTOGRAPHIC HASH FUNCTION TO CRACK PASSWORDS IN MINUTES
INSTEAD OF WEEKS. DECREASING THE SIZE OF THE RAINBOW TABLE INCREASES
THE TIME REQUIRED TO ITERATE OVER THE HASH SPACE.
THE MEET-IN-THE-MIDDLE ATTACK USES A SPACE-TIME TRADEOFF TO FIND THE
CRYPTOGRAPHIC KEY IN ONLY 2N + 1 ENCRYPTIONS (AND O(2N) SPACE) VERSUS
THE EXPECTED 22N ENCRYPTIONS (BUT ONLY O(1) SPACE) OF THE NAIVE
ATTACK.
DYNAMIC PROGRAMMING, WHERE THE TIME COMPLEXITY OF A PROBLEM CAN BE
REDUCED SIGNIFICANTLY BY USING MORE MEMORY.

More Related Content

Doc5

  • 2. In computer science, a space–time or time–memory tradeoff is a situation where the memory use can be reduced at the cost of slower program execution (and, conversely, the computation time can be reduced at the cost of increased memory use). As the relative costs of CPU cycles, RAM space, and hard drive space change—hard drive space has for some time been getting cheaper at a much faster rate than other components of computers[citation needed] —the appropriate choices for space–time tradeoffs have changed radically. Often, by exploiting a space–time tradeoff, a program can be made to run much faster.
  • 3. N COMPUTER SCIENCE, A SPACE-TIME OR TIME-MEMORY TRADEOFF IS A SITUATION WHERE THE MEMORY USE CAN BE REDUCED AT THE COST OF SLOWER PROGRAM EXECUTION (OR, VICE VERSA, THE COMPUTATION TIME CAN BE REDUCED AT THE COST OF INCREASED MEMORY USE). AS THE RELATIVE COSTS OF CPU CYCLES, RAM SPACE, AND HARD DRIVE SPACE CHANGE HARD DRIVE SPACE HAS FOR SOME TIME BEEN GETTING CHEAPER AT A MUCH FASTER RATE THAN OTHER COMPONENTS OF COMPUTERS. THE APPROPRIATE CHOICES FOR SPACE-TIME TRADEOFFS HAVE CHANGED RADICALLY. OFTEN, BY EXPLOITING A SPACE-TIME TRADEOFF, A PROGRAM CAN BE MADE TO RUN MUCH FASTER. THE MOST COMMON SITUATION IS AN ALGORITHM INVOLVING A LOOKUP TABLE: AN IMPLEMENTATION CAN INCLUDE THE ENTIRE TABLE, WHICH REDUCES COMPUTING TIME, BUT INCREASES THE AMOUNT OF MEMORY NEEDED, OR IT CAN COMPUTE TABLE ENTRIES AS NEEDED, INCREASING COMPUTING TIME, BUT REDUCING MEMORY REQUIREMENTS. A SPACE-TIME TRADEOFF CAN BE APPLIED TO THE PROBLEM OF DATA STORAGE. IF DATA IS STORED UNCOMPRESSED, IT TAKES MORE SPACE BUT LESS TIME THAN IF THE DATA WERE STORED COMPRESSED (SINCE COMPRESSING THE DATA REDUCES THE AMOUNT OF SPACE IT TAKES, BUT IT TAKES TIME TO RUN THECOMPRESSION ALGORITHM). DEPENDING ON THE PARTICULAR INSTANCE OF THE PROBLEM, EITHER WAY IS PRACTICAL. ANOTHER EXAMPLE IS DISPLAYING MATHEMATICAL FORMULAE ON PRIMARILY TEXT-BASED WEBSITES, SUCH AS WIKIPEDIA. Storing only the LaTeX source and rendering it as an image every time the page is requested would be trading time for space - more time used, but less space. Rendering the image when the page is changed and storing the rendered images would be trading space for time - more space used, but less time. Note that there are also rare instances where it is possible to directly work with compressed data, such as in the case of compressed bitmap indices, where it is faster to work with compression than without compression. Larger code size can be traded for higher program speed when applying loop unrolling. This technique makes the code longer for each iteration of a loop, but saves the computation time required for jumping back to the beginning of the loop at the end of each iteration. Algorithms that also make use of space-time tradeoffs include: BABY-STEP GIANT-STEP ALGORITHM FOR CALCULATING DISCRETE LOGARITHMS. RAINBOW TABLES IN CRYPTOGRAPHY, WHERE THE ADVERSARY IS TRYING TO DO BETTER THAN THE EXPONENTIAL TIME REQUIRED FOR A BRUTE FORCE ATTACK. RAINBOW TABLES USE PARTIALLY PRECOMPUTED VALUES IN THE HASH SPACE OF A CRYPTOGRAPHIC HASH FUNCTION TO CRACK PASSWORDS IN MINUTES INSTEAD OF WEEKS. DECREASING THE SIZE OF THE RAINBOW TABLE INCREASES THE TIME REQUIRED TO ITERATE OVER THE HASH SPACE. THE MEET-IN-THE-MIDDLE ATTACK USES A SPACE-TIME TRADEOFF TO FIND THE CRYPTOGRAPHIC KEY IN ONLY 2N + 1 ENCRYPTIONS (AND O(2N) SPACE) VERSUS THE EXPECTED 22N ENCRYPTIONS (BUT ONLY O(1) SPACE) OF THE NAIVE
  • 4. ATTACK. DYNAMIC PROGRAMMING, WHERE THE TIME COMPLEXITY OF A PROBLEM CAN BE REDUCED SIGNIFICANTLY BY USING MORE MEMORY.