skip to main content
research-article

Accelerating iterators in optimizing AST interpreters

Authors Info & Claims
Published:15 October 2014Publication History
Skip Abstract Section

Abstract

Generators offer an elegant way to express iterators. However, their performance has always been their Achilles heel and has prevented widespread adoption. We present techniques to efficiently implement and optimize generators.

We have implemented our optimizations in ZipPy, a modern, light-weight AST interpreter based Python 3 implementation targeting the Java virtual machine. Our implementation builds on a framework that optimizes AST interpreters using just-in-time compilation. In such a system, it is crucial that AST optimizations do not prevent subsequent optimizations. Our system was carefully designed to avoid this problem. We report an average speedup of 3.58x for generator-bound programs. As a result, using generators no longer has downsides and programmers are free to enjoy their upsides.

References

  1. Project Euler: Python Solutions. http://http://www.s-anand.net/euler.html/.Google ScholarGoogle Scholar
  2. Unladen Swallow. http://code.google.com/p/unladen-swallow/, August 2010.Google ScholarGoogle Scholar
  3. R. R. Atkinson, B. H. Liskov, and R. W. Scheifler. Aspects Of Implementing CLU. In Proceedings of the 1978 Annual Conference, ACM '78, pages 123--129, New York, NY, USA, 1978. ACM. ISBN 0-89791-000-1. doi: 10.1145/800127.804079. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. C. F. Bolz, A. Cuni, M. Fijalkowski, and A. Rigo. Tracing the Meta-level: PyPy's Tracing JIT Compiler. In Proceedings of the 4th Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, ICOOOLPS '09, pages 18--25, New York, NY, USA, 2009. ACM. ISBN 978-1-60558-541-3. doi: 10.1145/1565824.1565827. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. S. Brunthaler. Inline Caching Meets Quickening. In T. D'Hondt, editor, ECOOP 2010 - Object-Oriented Programming, volume 6183 of Lecture Notes in Computer Science, pages 429--451. Springer Berlin Heidelberg, 2010 ISBN 978-3-642-14106-5. doi: 10.1007/978-3-642-14107-2_21. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. S. Brunthaler. Efficient Interpretation Using Quickening. In Proceedings of the 6th Symposium on Dynamic Languages, DLS '10, pages 1--14, New York, NY, USA, 2010. ACM. ISBN 978-1-4503-0405-4. doi: 10.1145/1869631.1869633. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. L. P. Deutsch and A. M. Schiffman. Efficient implementation of the smalltalk-80 system. In Proceedings of the 11th ACM SIGACT-SIGPLAN symposium on Principles of programming languages, POPL '84, pages 297--302, New York, NY, USA, 1984. ACM. ISBN 0-89791-125-3. doi: 10.1145/800017.800542. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. ECMA. Standard ECMA-262: ECMAScript Language Specification 6th Edition Draft. http://people.mozilla.org/~jorendorff/es6-draft.html, 2014.Google ScholarGoogle Scholar
  9. D. Eppstein. PADS, a library of Python Algorithms and Data Structures. http://www.ics.uci.edu/~eppstein/PADS/.Google ScholarGoogle Scholar
  10. B. Fulgham. The Computer Language Benchmarks Game. http://shootout.alioth.debian.org/.Google ScholarGoogle Scholar
  11. GitHub. http://github.com/.Google ScholarGoogle Scholar
  12. D. Grune. A View of Coroutines. SIGPLAN Not., 12 (7): 75--81, July 1977. ISSN 0362-1340. doi: 10.1145/954639.954644. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Jython. http://www.jython.org/.Google ScholarGoogle Scholar
  14. B. Liskov, A. Snyder, R. Atkinson, and C. Schaffert. Abstraction Mechanisms in CLU. Communications of the ACM, 20 (8): 564--576, Aug. 1977. ISSN 0001-0782. doi: 10.1145/359763.359789. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. J. Liu, A. Kimball, and A. C. Myers. Interruptible Iterators. In Proceedings of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL '06, pages 283--294, New York, NY, USA, 2006. ACM. ISBN 1-59593-027-2. doi: 10.1145/1111037.1111063. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. A. L. D. Moura and R. Ierusalimschy. Revisiting Coroutines. ACM Transactions on Programming Languages and Systems, 31 (2): 6:1--6:31, Feb. 2009. ISSN 0164-0925. doi: 10.1145/1462166.1462167. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. S. Murer, S. Omohundro, D. Stoutamire, and C. Szyperski. Iteration Abstraction in Sather. ACM Transactions on Programming Languages and Systems, 18 (1): 1--15, Jan. 1996. ISSN 0164-0925. doi: 10.1145/225540.225541. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. PyPI Ranking. PyPI Python modules ranking. http://pypi-ranking.info/.Google ScholarGoogle Scholar
  19. PyPy. http://www.pypy.org/.Google ScholarGoogle Scholar
  20. Python. http://www.python.org/.Google ScholarGoogle Scholar
  21. A. Rigo and S. Pedroni. PyPy's Approach to Virtual Machine Construction. In Companion to the 21st ACM SIGPLAN Symposium on Object-oriented Programming Systems, Languages, and Applications, OOPSLA '06, pages 944--953, New York, NY, USA, 2006. ACM. ISBN 1-59593-491-X. doi: 10.1145/1176617.1176753. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Ruby. http://www.ruby-lang.org/.Google ScholarGoogle Scholar
  23. L. Stadler, T. Würthinger, and C. Wimmer. Efficient Coroutines for the Java Platform. In Proceedings of the 8th International Conference on the Principles and Practice of Programming in Java, PPPJ '10, pages 20--28, New York, NY, USA, 2010. ACM. ISBN 978-1-4503-0269-2. doi: 10.1145/1852761.1852765. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. S. M. Watt. A Technique for Generic Iteration and Its Optimization. In Proceedings of the 2006 ACM SIGPLAN Workshop on Generic Programming, WGP '06, pages 76--86, New York, NY, USA, 2006. ACM. ISBN 1-59593-492-8. doi: 10.1145/1159861.1159872. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. T. Würthinger, A. Wöß, L. Stadler, G. Duboscq, D. Simon, and C. Wimmer. Self-optimizing AST Interpreters. In Proceedings of the 8th Symposium on Dynamic Languages, DLS '12, pages 73--82, New York, NY, USA, 2012. ACM. ISBN 978-1-4503-1564-7. doi: 10.1145/2384577.2384587. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon, and M. Wolczko. One VM to Rule Them All. In Proceedings of the 2013 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software, Onward! '13, pages 187--204, New York, NY, USA, 2013. ACM. ISBN 978-1-4503-2472-4. doi: 10.1145/2509578.2509581. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Accelerating iterators in optimizing AST interpreters

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 49, Issue 10
        OOPSLA '14
        October 2014
        907 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2714064
        • Editor:
        • Andy Gill
        Issue’s Table of Contents
        • cover image ACM Conferences
          OOPSLA '14: Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications
          October 2014
          946 pages
          ISBN:9781450325851
          DOI:10.1145/2660193

        Copyright © 2014 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 15 October 2014

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!