Space–time tradeoff

In computer science,

A space-time or time-memory tradeoff is therefore a case where an algorithm or program trades increased space for decreased time. The utility of a given space-time tradeoff is affected by related fixed and variable costs (of, e.g., CPU speed, RAM space, hard-drive space), and is subject to diminishing returns.

History

Biological usage of time–memory tradeoffs can be seen in the earlier stages of animal behavior. Using stored knowledge or encoding stimuli reactions as "instincts" in the DNA avoids the need for "calculation" in time-critical situations. More specific to computers, look-up tables have been implemented since the very earliest operating systems.

In 1980 Martin Hellman first proposed using a time–memory tradeoff for cryptanalysis.[1]

Types of tradeoff

Lookup tables vs. recalculation

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.

Compressed vs. uncompressed data

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 the decompression algorithm). Depending on the particular instance of the problem, either way is practical. 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.

Re-rendering vs. stored images

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. This technique is more generally known as caching.

Smaller code vs. loop unrolling

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.

Other examples

Algorithms that also make use of space–time tradeoffs include:

See also

References

  1. Hellman, Martin (July 1980). "A Cryptanalytic Time-Memory Tradeoff". IEEE Transactions on Information Theory 26 (4): 401–406. doi:10.1109/tit.1980.1056220.

External links

This article is issued from Wikipedia - version of the Friday, November 13, 2015. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.