Advertisement

Simple, Effective Code-Size Reduction for Functional Programs

  • Ekaterina Stefanov
  • Anthony M. Sloane
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3474)

Abstract

Code-size reduction is an important area of investigation for computer system developers due to the increasing use of technologies such as communication networks and embedded systems for which program size is an important factor. A new software-based method of program compression for languages with interpreter-based runtime systems is described. The method employs a modified version of a standard dictionary-based text compression algorithm to produce a shorter encoding for a given program and a runtime system tailored for it. In comparison with previous software-based code-size reduction methods the new method is simpler to implement and imposes lower overhead at compile time. Its performance on a representative suite of Haskell programs is analysed. Executable space savings of 16–26% are achieved as a result of code compression, exclusion of unused instructions from the runtime, and inclusion of the standard library in the optimisation. To the best of the authors’ knowledge, this is the first work on running compressed code for a purely declarative and functional language.

Keywords

Basic Block Abstract Machine Runtime System Java Virtual Machine Instruction Type 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Lindholm, T., Yellin, F.: The Java Virtual Machine Specification, 2nd edn. Addison-Wesley, Reading (1999)Google Scholar
  2. 2.
    Aït-Kaci, H.: Warren’s Abstract Machine: A Tutorial Reconstruction. MIT Press, Cambridge (1991)Google Scholar
  3. 3.
    Peyton Jones, S.: Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine. Journal of Functional Programming 2, 127–202 (1992)zbMATHCrossRefGoogle Scholar
  4. 4.
    Peyton Jones, S., Lester, D.: Implementing Functional Languages: A Tutorial. Prentice-Hall, Englewood Cliffs (1992)Google Scholar
  5. 5.
    Ziv, J., Lempel, A.: A universal algorithm for sequential data compression. IEEE Transactions of Information Theory 23, 337–343 (1977)zbMATHCrossRefMathSciNetGoogle Scholar
  6. 6.
    Ziv, J., Lempel, A.: Compression of individual sequences via variable-rate coding. IEEE Transactions of Information Theory 24, 530–536 (1978)zbMATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    Welch, T.: A technique for high performance data compression. IEEE Computer 17, 8–19 (1984)Google Scholar
  8. 8.
    Rojemo, N.: Garbage collection, and memory efficiency, in lazy functional languages. PhD Thesis, Chalmers University of Technology, Sweden (1995)Google Scholar
  9. 9.
    Krastev, K.: Prototype implementation of LZW-CC for nhc98 [Online] (2004), Available: http://www.comp.mq.edu.au/~kate/lzw-cc.tar
  10. 10.
    Beszedes, A., Ferenc, R., Gyimothy, T., Dolenc, A., Karsisto, K.: Survey of code-size reduction methods. ACM Computing Surveys 35, 223–267 (2003)CrossRefGoogle Scholar
  11. 11.
    Cooper, K., McIntosh, N.: Enhanced code compression for embedded risk processors. In: Proceedings of ACM SIGPLAN 1999 Conference on Programming Language Design and Implementation, pp. 139–149 (1999)Google Scholar
  12. 12.
    Debray, S., Evans, W., Muth, R., de Sutter, B.: Compiler techniques for code compaction. ACM Transactions on Programming Languages and Systems 22, 378–415 (2000)CrossRefGoogle Scholar
  13. 13.
    Franz, M., Kistler, T.: Slim binaries. Communications of the ACM 40, 87–94 (1997)CrossRefGoogle Scholar
  14. 14.
    Ernst, J., Evans, W., Fraser, C., Lucco, S., Proebsting, T.: Code compression. In: Proceedings of ACM SIGPLAN 1997 Conference on Programming Language Design and Implementation, pp. 358–365 (1997)Google Scholar
  15. 15.
    Fraser, C.W., Proebsting, T.A.: Custom instruction sets for code compression (1995), Available at, http://research.microsoft.com/~toddpro/papers/pldi2.ps
  16. 16.
    Clausen, L.R., Schultz, U.P., Consel, C., Muller, G.: Java bytecode compression for low-end embedded systems. ACM Transactions on Programming Languages and Systems 22, 471–489 (2000)CrossRefGoogle Scholar
  17. 17.
    Aho, A.V., Sethi, R., Ullman, J.: Compilers - Principles, Techniques, and Tools. Addison-Wesley, Reading (1986)Google Scholar
  18. 18.
    Partain, W.: The nofib benchmark suite of Haskell programs. In: Proceedings of the 1992 Glasgow Workshop on Functional Programming, pp. 195–202. Springer, Heidelberg (1992)Google Scholar
  19. 19.
    Garey, M.R., Johnson, D.S.: Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman and Co., New York (1979)Google Scholar
  20. 20.
    Shannon, C.E.: A mathematical theory of communication. Bell System Technology Journal 27, 379–423, 623–656 (1948)Google Scholar
  21. 21.
    Latendresse, M., Feeley, M.: Fast and compact decoding of Huffman-encoded virtual instructions. In: ACM IVME 2003, San Diego, California (2003)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Ekaterina Stefanov
    • 1
  • Anthony M. Sloane
    • 1
  1. 1.Department of ComputingMacquarie University 

Personalised recommendations