Energy-Aware Lossless Data Compression
Total Page:16
File Type:pdf, Size:1020Kb
Energy-Aware Lossless Data Compression KENNETH C. BARR and KRSTE ASANOVIC´ MIT Computer Science and Artificial Intelligence Laboratory Wireless transmission of a single bit can require over 1000 times more energy than a single 32-bit computation. It can therefore be beneficial to perform additional computation to reduce the number of bits transmitted. If the energy required to compress data is less than the energy required to send it, there is a net energy savings and an increase in battery life for portable computers. This article presents a study of the energy savings possible by losslessly compressing data prior to transmission. A variety of algorithms were measured on a StrongARM SA-110 processor. This work demonstrates that, with several typical compression algorithms, there is a actually a net energy increase when compression is applied before transmission. Reasons for this increase are explained and suggestions are made to avoid it. One such energy-aware suggestion is asymmetric compression, the use of one compression algorithm on the transmit side and a different algorithm for the receive path. By choosing the lowest-energy compressor and decompressor on the test platform, overall energy to send and receive data can be reduced by 11% compared with a well-chosen symmetric pair, or up to 57% over the default symmetric zlib scheme. Categories and Subject Descriptors: C.4 [Performance of Systems]—Performance attributes General Terms: Algorithms, Measurement, Performance Additional Key Words and Phrases: Compression, energy-aware, lossless, low-power, power-aware 1. INTRODUCTION Wireless communication is an essential component of mobile computing, but the energy required for transmission of a single bit has been measured to be over 1000 times greater than for a single 32-bit computation. Thus, if 1000 computa- tion operations can compress data by even 1 bit, energy should be saved. Com- pression algorithms which once seemed too resource- or time-intensive might be valuable for saving energy.Implementations which made concessions in com- pression ratio to improve performance might be modified to provide an overall energy savings. Ideally, the effort exerted to compress data should be variable to allow a flexible tradeoff between speed and energy. Earlier work has considered lossy compression techniques which sacrifice the quality of compressed audio This work was supported by MIT Project Oxygen, DARPA PAC/C award F30602-00-2-0562, NSF CAREER award CCR-0093354, and an equipment grant from Intel. Authors’ addresses: The Stata Center, Building 32-G776, 32 Vassar Street, Cambridge, MA 02139; email: {kbarr,krste}@mit.edu. Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or direct commercial advantage and that copies show this notice on the first page or initial screen of a display along with the full citation. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, to republish, to post on servers, to redistribute to lists, or to use any component of this work in other works requires prior specific permission and/or a fee. Permissions may be requested from Publications Dept., ACM, Inc., 1515 Broadway, New York, NY 10036 USA, fax: +1 (212) 869-0481, or [email protected]. C 2006 ACM 0734-2071/06/0800-0250 $5.00 ACM Transactions on Computer Systems, Vol. 24, No. 3, August 2006, Pages 250–291. Energy-Aware Lossless Data Compression • 251 or video data streams to reduce the bit rate and energy required [Flinn 2001; Sinha et al. 2000; Taylor and Dey 2001; Noble and Satyanarayanan 1999]. In this work, we consider the challenge of reducing wireless communication energy for data that must be transmitted faithfully. We provide an in-depth examination of the energy requirements of several lossless data compression schemes. We take energy measurements using the StrongARM-based Skiff platform developed by Compaq Cambridge Research Labs, which allows energy consumption of the CPU, memory, network card, and peripherals to be measured separately. The platform is similar to the popular iPAQ handheld computer, so the results are relevant to designers of embedded and mobile systems. Several families of compression algorithms are analyzed and characterized, and it is shown that compression prior to transmission may actually cause an overall energy increase. We highlight behaviors and resource- usage patterns which allow for energy-efficient lossless compression of data. Finally, a new energy-aware data compression scheme composed of these be- haviors is presented and measured. Section 2 contains a brief overview of important lossless compression con- cepts, algorithms, and the implementations that we study. Section 3 describes the experimental setup including benchmark selection and methodology. Section 4 begins with the measurement of an encouraging communication- computation gap, but shows that modern compression tools do not exploit the the low relative energy of computation versus communication. Factors which limit energy reduction are presented. Section 5 applies an understanding of these factors to reduce overall energy of transmission though hardware- conscious optimizations and asymmetric compression choices. Section 6 discusses related work, and Section 7 concludes the article. 2. LOSSLESS COMPRESSION OVERVIEW In this section, we review the concepts and terminology of data compression to provide background for our discussion on what constitutes energy-aware loss- less data compression. The descriptions in this section are simplified versions of those that appear in Lelewer and Hirschberg [1987] and Sayood [2002], each of which contains bibliographic references to seminal articles. Particular im- plementations of algorithms will be discussed as each algorithm is introduced in Section 2.3. 2.1 Terminology In applications where some loss or degradation of data can be tolerated (such as the transmission of images or sounds) much work has been done to exploit this tolerance in order to reap higher lossy compression ratios. When transmitting text or a binary executable, one must be able to reconstruct every bit perfectly— hence the need for lossless data compression. Compression is usually broken into two steps: modeling and coding. With a perfect, concise model that describes the generation of the input source which is to be compressed, one could reproduce the data without transmitting the source data. (i.e., if the sequence 1 1 2 3 5 ···6765 were to be transmitted, one ACM Transactions on Computer Systems, Vol. 24, No. 3, August 2006. 252 • K. C. Barr and K. Asanovi´c could express it with a “model” of Fibonacci numbers). In practice, one must approximate and construct an approximate mathematical model for the data. In English text, for example, one can model the probability of a letter occurring as a probability conditioned on letters that have already been transmitted. This probabilistic model is transmitted with a description of how the data differs from the model. In a coding step, information is mapped to compact codewords. Obviously, a codeword must decode to a unique value so there can be no doubt of the original message. Prefix codes are used so that no codeword is the prefix of any other codeword. It has been proved [McEliece 1977] that, for any nonprefix code that may be uniquely decoded, a prefix code can be found with the same codeword lengths. Often the modeling and coding steps are tightly coupled. For instance, Lempel-Ziv codes can be constructed as an input source is parsed into a “dictionary” model. When it is difficult to extricate the coding from the modeling, the two will be discussed together. 2.2 Coding Methods Coding maps symbols from the input alphabet into compact binary sequences. Discussion in this section is based on an alphabet made up of the set of 256 symbols that can be represented in an 8-bit byte. Though many coding schemes exist, we focus on the most popular schemes for data compression tools. 2.2.1 Huffman Coding. If the probability of each source symbol is known a priori (perhaps by scanning through the source), a procedure known as static Huffman coding can be used to build an optimal code in which the most fre- quently occurring symbols are given the shortest codewords. Huffman codes are established by storing the symbols of the alphabet in a binary tree according to their probability. As the tree is traversed from root to leaf, the code grows in length. When visiting the right child, a 0 is appended to the code. When visit- ing the left child,a1isappended. Thus, symbols which occur frequently are stored near the root of the tree and have the shortest codes. Since data com- pression tools rarely have the luxury of a priori knowledge and cannot afford two passes through the data source, variants of the Huffman algorithm have been developed that work dynamically and update the tree as source symbols are encountered. 2.2.2 Arithmetic Coding. Optimal compression ratio for a data source is traditionally described with respect to Claude Shannon’s definition of source entropy [Shannon 1948]: a measure of the source’s information and therefore the average number of bits required to represent it. Sometimes the most frequently occurring symbol can contain so little information that it would be ideal to represent it with less than 1 bit. Huffman codes are restricted to using an integral number of bits per symbol, increasing the coding overhead. Arithmetic codes have been designed to support a fractional number of bits per symbol to bring the average length of a codeword much closer to the optimal. Knowing the probability of occurrence for each symbol, a unique identifier can be established for a series of symbols. This identifier is a binary fraction in ACM Transactions on Computer Systems, Vol.