Customization of Java Library Classes Using Type Constraints and Profile Information

  • Bjorn De Sutter
  • Frank Tip
  • Julian Dolby
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3086)


The use of class libraries increases programmer productivity by allowing programmers to focus on the functionality unique to their application. However, library classes are generally designed with some typical usage pattern in mind, and performance may be suboptimal if the actual usage differs. We present an approach for rewriting applications to use customized versions of library classes that are generated using a combination of static analysis and profile information. Type constraints are used to determine where customized classes may be used, and profile information is used to determine where customization is likely to be profitable. We applied this approach to a number of Java applications by customizing various standard container classes and the omnipresent StringBuffer class, and measured speedups up to 78% and memory footprint reductions up to 46%. The increase in application size due to the added custom classes is limited to 12% for all but the smallest programs.


Original Program Class Hierarchy Type Constraint Custom Classis Cache Scheme 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Beckmann, B., Wang, X.: Adaptive prefetching Java objects (manuscript)Google Scholar
  2. 2.
    Cai, J., Paige, R.: Towards increased productivity of algorithm implementation. In: Proc. 1st ACM SIGSOFT symposium on Foundations of software engineering, pp. 71–78 (1993)Google Scholar
  3. 3.
    Calder, B., Feller, P., Eustace, A.: Value profiling. In: Proceedings of the 30th annual ACM/IEEE International Symposium on Microarchitecture (ISCA 1997), pp. 259–269 (1997)Google Scholar
  4. 4.
    Chambers, C., Ungar, D.: Customization: optimizing compiler technology for SELF, a dynamically-typed object-oriented programming language. ACM SIGPLAN Notices 24(7), 146–160 (1989)CrossRefGoogle Scholar
  5. 5.
    Choi, J.-D., Gupta, M., Serrano, M.J., Sreedhar, V.C., Midkiff, S.P.: Stack allocation and synchronization optimizations for java using escape analysis. ACM Transactions on Programming Languages and Systems 25(6), 876–910 (2003)CrossRefGoogle Scholar
  6. 6.
    Chung, E.-Y., Benini, L., De Micheli, G.: Automatic source code specialization for energy reduction. In: Proceedings of the 2001 International Symposium on Low Power Electronics and Design (ISPLED 2001), pp. 80–83 (2001)Google Scholar
  7. 7.
    Cooper, K., Hall, M.W., Kennedy, K.: A methodology for procedure cloning. Computer Languages (may 1995)Google Scholar
  8. 8.
    Czarnecki, K., Eisenecker, U.: Generative Programming: Methods, Techniques, and Applications. Addison-Wesley, Reading (1999)Google Scholar
  9. 9.
    Dewar, R.K., Arthur, L.S.-C., Schwartz, J.T., Schonberg, E.: Programming by refinement, as exemplified by the SETL representation sublanguage. ACM Transactions on Programming Languages and Systems (TOPLAS) 1(1), 27–49 (1979)zbMATHCrossRefGoogle Scholar
  10. 10.
    Fowler, M.: Refactoring. Improving the Design of Existing Code. Addison-Wesley, Reading (1999)Google Scholar
  11. 11.
    Friedman, S., Leidenfrost, N., Brodie, B., Cytron, R.: Hashtables for embedded and real-time systems. In: IEEE Real-Time Embedded System Workshop (2001)Google Scholar
  12. 12.
    Glew, N., Palsberg, J.: Type-safe method inlining. In: Proc. 16th European Conference on Object-Oriented Programming, pp. 525–544 (2002)Google Scholar
  13. 13.
    Hind, M., Pioli, A.: Evaluating the effectiveness of pointer alias analyses. Science of Computer Programming 39(1), 31–55 (2001)zbMATHCrossRefGoogle Scholar
  14. 14.
    Högstedt, K., D., K., Rajan, V., Roth, T., Sreedhar, V., Wegman, M., Wang, N.: The autonomic performance prescription. Available from the author at Google Scholar
  15. 15.
    Kiczales, G., Lamping, J., Menhdhekar, A., Maeda, C., Lopes, C., Loingtier, J.-M., Irwin, J.: Aspect-oriented programming. In: Aksit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 220–242. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  16. 16.
    Lindholm, T., Yellin, F.: The Java Virtual Machine Specification. Addison-Wesley, Reading (1997)Google Scholar
  17. 17.
    Palsberg, J.: Type-based analysis and applications. In: ACM Workshop on Program Analysis for Software Tools and Engineering (PASTE 2001), Snowbird, UT, pp. 20–27 (2001)Google Scholar
  18. 18.
    Palsberg, J., Schwartzbach, M.: Object-Oriented Type Systems. John Wiley & Sons, Chichester (1993)Google Scholar
  19. 19.
    Pavlovic, D., Smith, D.: Software development by refinement. In: UNU/IIST 10th Anniversary Colloqium, Formal Methods at the Crossroads: From Panaea to Foundational Support, Springer, Heidelberg (2003)Google Scholar
  20. 20.
    Rountev, A., Milanova, A., Ryder, B.: Points-to analysis for Java using annotated constraints. In: Proc. 16th Annual Conf. on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA 2001), Tampa Bay, FL, pp. 43–55 (2001)Google Scholar
  21. 21.
    Ryder, B.G.: Dimensions of precision in reference analysis of object-oriented programming languages. In: Proc. 12th International Conference on Compiler Construction (CC 2003), Warsaw, Poland, April 2003, pp. 126–137 (2003)Google Scholar
  22. 22.
    Schonberg, E., Schwartz, J., Sharir, M.: An automatic technique for selection of data representations in SETL programs. ACM Transactions on Programming Languages and Systems 3(2), 126–143 (1981)zbMATHCrossRefGoogle Scholar
  23. 23.
    Schultz, U.P., Lawall, J.L., Consel, C.: Automatic program specialization for java. ACM Transactions on Programming Languages and Systems 25(4), 452–499 (2003)CrossRefGoogle Scholar
  24. 24.
    Sirkin, M., Batory, D., Singhal, V.: Software components in a data structure precompiler. In: Proceedings of the 15th International Conference on Software Engineering (ICSE 1997), pp. 437–446 (1997)Google Scholar
  25. 25.
    Tip, F., Kieżun, A., Bäumer, D.: Refactoring for generalizations using type constraints. In: Proc. 18th Annual Conf. on Object-Oriented Programming Systems, Languages, and Applications, OOPSLA 2003 (2003)Google Scholar
  26. 26.
    Tip, F., Sweeney, P.F., Laffra, C., Eisma, A., Streeter, D.: Practical extraction techniques for Java. ACM Transactions on Programming Languages and Systems 24(6), 625–666 (2002)CrossRefGoogle Scholar
  27. 27.
    Veldhuizen, T.L., Gannon, D.: Active libraries: Rethinking the roles of compilers and libraries. In: Proceedings of the SIAM Workshop on Object Oriented Methods for Inter-operable Scientific and Engineering Computing, OO 1998 (1998)Google Scholar
  28. 28.
    Yellin, D.: Competitive algorithms for the dynamic selection of component implementations. IBM Systems Journal 42(1), 85–97 (2003)CrossRefMathSciNetGoogle Scholar
  29. 29.
    Yotov, K., Li, X., Ren, G., Cibulskis, M., DeJong, G., Garzaran, M., Padua, D., Pingali, K., Stodghill, P., Wu, P.: Comparison of empirical and model-driven optimization. In: Proc. ACM SIGPLAN 2003 conference on Programming language design and implementation, pp. 63–76 (2003)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Bjorn De Sutter
    • 1
  • Frank Tip
    • 2
  • Julian Dolby
    • 2
  1. 1.Electronics and Information Systems DepartmentGhent UniversityGentBelgium
  2. 2.IBM T.J. Watson Research CenterYorktown HeightsUSA

Personalised recommendations