Record data structures in racket: usage analysis and optimization

Built-in data structures are a key contributor to the performance of dynamic languages. Record data structures, or records, are one of the common advanced, but not easily optimizable built-in data structures supported by those languages. Records may be used in an object-oriented fashion or to implement object orientation itself. In this paper, we analyze how records are used in different applications in the Scheme dialect Racket. Based on the data obtained, we suggest the application of existing optimization techniques for records and devise a new one for immutable boolean fields. Most of them can be applied to a wide range of record implementations in dynamic languages. We apply these optimizations to records in Pycket, an implementation of Racket. With one exception, micro-benchmarks show a two- to ten-fold speed-up of our implementation over plain Racket.

[1]  Debashis Kushary,et al.  Bootstrap Methods and Their Application , 2000, Technometrics.

[2]  Samuele Pedroni,et al.  PyPy's approach to virtual machine construction , 2006, OOPSLA '06.

[3]  Marc Feeley,et al.  Structure Vectors and their Implementation , 2014 .

[4]  Anthony C. Davison,et al.  Bootstrap Methods and Their Application , 1998 .

[5]  James C. McKim,et al.  Design by Contract, By Example , 2001, TOOLS.

[6]  Richard P. Gabriel Lisp : Good News Bad News How to Win Big , 1990 .

[7]  Michael Leuschel,et al.  Towards a jitting VM for prolog execution , 2010, PPDP.

[8]  Christian Wimmer,et al.  One VM to rule them all , 2013, Onward!.

[9]  Davide Ancona,et al.  RPython: a step towards reconciling dynamically and statically typed OO languages , 2007, DLS '07.

[10]  Jeremy G. Siek,et al.  Meta-tracing makes a fast Racket , 2014 .

[11]  John Maloney,et al.  Back to the Future The Story of Squeak, A Practical Smalltalk Written in Itself , 1997 .

[12]  Matthias Felleisen,et al.  Scheme with Classes, Mixins, and Traits , 2006, APLAS.

[13]  Hanspeter Mössenböck,et al.  An object storage model for the truffle language implementation framework , 2014, PPPJ '14.

[14]  Carl Friedrich Bolz,et al.  Tracing the meta-level: PyPy's tracing JIT compiler , 2009, ICOOOLPS@ECOOP.

[15]  Gerald J. Sussman,et al.  Scheme: A Interpreter for Extended Lambda Calculus , 1998, High. Order Symb. Comput..

[16]  David F. Bacon,et al.  Space- and Time-Efficient Implementation of the Java Object Model , 2002, ECOOP.

[17]  Alan Borning,et al.  Exploding java objects for performance , 2003 .

[18]  R. Kent Dybvig,et al.  A run-time representation of scheme record types , 2014, J. Funct. Program..

[19]  Oscar Nierstrasz,et al.  Back to the Future in One Week - Implementing a Smalltalk VM in PyPy , 2008, S3.

[20]  Sam Tobin-Hochstadt,et al.  Pycket: a tracing JIT for a functional language , 2015, ICFP.

[21]  Martin Odersky,et al.  Late data layout: unifying data representation transformations , 2014, OOPSLA.

[22]  Laurence Tratt,et al.  Storage strategies for collections in dynamically typed languages , 2013, OOPSLA.

[23]  Robert Hirschfeld,et al.  Adaptive just-in-time value class optimization: transparent data structure inlining for fast execution , 2015, SAC.

[24]  Matthias Felleisen,et al.  Control operators, the SECD-machine, and the λ-calculus , 1987, Formal Description of Programming Concepts.