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.
Description
Accelerating iterators in optimizing AST interpreters
%0 Conference Paper
%1 Zhang:2014:AIO
%A Zhang, Wei
%A Larsen, Per
%A Brunthaler, Stefan
%A Franz, Michael
%B Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages &\#38; Applications
%D 2014
%I ACM
%K AST implementation interpreter iterators language python truffle
%P 727--743
%R 10.1145/2660193.2660223
%T Accelerating Iterators in Optimizing AST Interpreters
%X 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.
%@ 978-1-4503-2585-1
@inproceedings{Zhang:2014:AIO,
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.},
acmid = {2660223},
added-at = {2014-12-09T13:03:44.000+0100},
author = {Zhang, Wei and Larsen, Per and Brunthaler, Stefan and Franz, Michael},
biburl = {https://www.bibsonomy.org/bibtex/21346dece2dc603d5e6f69233fda6989a/gron},
booktitle = {Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages \&\#38; Applications},
description = {Accelerating iterators in optimizing AST interpreters},
doi = {10.1145/2660193.2660223},
interhash = {cecedcb6e333ab451ef583e42b4eca01},
intrahash = {1346dece2dc603d5e6f69233fda6989a},
isbn = {978-1-4503-2585-1},
keywords = {AST implementation interpreter iterators language python truffle},
location = {Portland, Oregon, USA},
numpages = {17},
pages = {727--743},
publisher = {ACM},
series = {OOPSLA '14},
timestamp = {2014-12-09T13:03:44.000+0100},
title = {{Accelerating Iterators in Optimizing AST Interpreters}},
year = 2014
}