skip to main content
research-article
Open access

World age in Julia: optimizing method dispatch in the presence of eval

Published: 13 November 2020 Publication History

Abstract

Dynamic programming languages face semantic and performance challenges in the presence of features, such as eval, that can inject new code into a running program. The Julia programming language introduces the novel concept of world age to insulate optimized code from one of the most disruptive side-effects of eval: changes to the definition of an existing function. This paper provides the first formal semantics of world age in a core calculus named juliette, and shows how world age enables compiler optimizations, such as inlining, in the presence of eval. While Julia also provides programmers with the means to bypass world age, we found that this mechanism is not used extensively: a static analysis of over 4,000 registered Julia packages shows that only 4-9% of packages bypass world age. This suggests that Julia's semantics aligns with programmer expectations.

Supplementary Material

Auxiliary Presentation Video (oopsla20main-p384-p-video.mp4)
Dynamic programming languages face semantic and performance challenges in the presence of features, such as eval, that can inject new code into a running program. The Julia programming language introduces the novel concept of world age to insulate optimized code from one of the most disruptive side-effects of eval: changes to the definition of an existing function. This paper provides the first formal semantics of world age in a core calculus named juliette, and shows how world age enables compiler optimizations, such as inlining, in the presence of eval. While Julia also provides programmers with the means to bypass world age, we found that this mechanism is not used extensively: a static analysis of over 4,000 registered Julia packages shows that only 4-9% of packages bypass world age. This suggests that Julia's semantics aligns with programmer expectations.

References

[1]
Julia Belyakova, Benjamin Chung, Jack Gelinas, Jameson Nash, Ross Tate, and Jan Vitek. 2020. World Age in Julia: Optimizing Method Dispatch in the Presence of Eval (Extended Version). arXiv:2010.07516
[2]
Jef Bezanson, Jiahao Chen, Ben Chung, Stefan Karpinski, Viral B. Shah, Jan Vitek, and Lionel Zoubritzky. 2018. Julia: Dynamism and Performance Reconciled by Design. Proc. ACM Program. Lang. 2, OOPSLA ( 2018 ). https://doi.org/10. 1145/3276490
[3]
Jef Bezanson, Alan Edelman, Stefan Karpinski, and Viral B. Shah. 2017. Julia: A Fresh Approach to Numerical Computing. SIAM Rev. 59, 1 ( 2017 ). https://doi.org/10.1137/141000671
[4]
Daniel G. Bobrow, Kenneth Kahn, Gregor Kiczales, Larry Masinter, Mark Stefik, and Frank Zdybel. 1986. CommonLoops: Merging Lisp and Object-oriented Programming. In Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA). https://doi.org/10.1145/28697.28700
[5]
Robert P. Cook and Insup Lee. 1983. DYMOS: A Dynamic Modification System. In Proceedings of the Symposium on High-Level Debugging. https://doi.org/10.1145/1006147.1006188
[6]
David Detlefs and Ole Agesen. 1999. Inlining of Virtual Methods. In European Conference on Object-Oriented Programming (ECOOP). https://doi.org/10.5555/646156.679839
[7]
Matthias Felleisen, Robert Bruce Findler, and Matthew Flatt. 2009. Semantics Engineering with PLT Redex. MIT Press. http://mitpress.mit.edu/catalog/item/default.asp? ttype=2&tid=11885
[8]
Olivier Flückiger, Gabriel Scherer, Ming-Ho Yee, Aviral Goel, Amal Ahmed, and Jan Vitek. 2018. Correctness of speculative optimizations with dynamic deoptimization. Proc. ACM Program. Lang. 2, POPL ( 2018 ). https://doi.org/10.1145/3158137
[9]
Neal Glew. 2005. Method Inlining, Dynamic Class Loading, and Type Soundness. Journal of Object Technology 4, 8 ( 2005 ). https://doi.org/10.5381/jot. 2005. 4.8.a2
[10]
Urs Hölzle, Craig Chambers, and David Ungar. 1992. Debugging Optimized Code with Dynamic Deoptimization, In Conference on Programming Language Design and Implementation (PLDI). https://doi.org/10.1145/143103.143114
[11]
Sheng Liang and Gilad Bracha. 1998. Dynamic class loading in the Java virtual machine. In Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA). https://doi.org/10.1145/286936.286945
[12]
Jacob Matthews and Robert Bruce Findler. 2008. An operational semantics for Scheme. Journal of Functional Programming 18 ( 2008 ). Issue 1. https://doi.org/10.1017/S0956796807006478
[13]
John McCarthy. 1978. History of LISP. In History of programming languages (HOPL). https://doi.org/10.1145/960118.808387
[14]
Phung Hua Nguyen and Jingling Xue. 2005. Interprocedural side-efect analysis and optimisation in the presence of dynamic class loading. In Australasian Conference on Computer Science (ACSC). https://doi.org/10.5555/1082161.1082163
[15]
Joe Gibbs Politz, Matthew J. Carroll, Benjamin S. Lerner, Justin Pombrio, and Shriram Krishnamurthi. 2012. A Tested Semantics for Getters, Setters, and Eval in JavaScript. In Symposium on Dynamic Languages (DLS). https://doi.org/10. 1145/2384577.2384579
[16]
Gareth Stoyle, Michael Hicks, Gavin Bierman, Peter Sewell, and Iulian Neamtiu. 2007. Mutatis Mutandis: Safe and Predictable Dynamic Software Updating. ACM Trans. Program. Lang. Syst. 29, 4 ( 2007 ). https://doi.org/10.1145/1255450.1255455
[17]
Julia Language Manual v1. 2020. Redefining Methods. https://docs.julialang.org/en/v1/manual/methods/#RedefiningMethods-1
[18]
Francesco Zappa Nardelli, Julia Belyakova, Artem Pelenitsyn, Benjamin Chung, Jef Bezanson, and Jan Vitek. 2018. Julia Subtyping: A Rational Reconstruction. Proc. ACM Program. Lang. 2, OOPSLA ( 2018 ). https://doi.org/10.1145/3276483

Cited By

View all
  • (2023)Come for syntax, stay for speed, understand defects: an empirical study of defects in Julia programsEmpirical Software Engineering10.1007/s10664-023-10328-528:4Online publication date: 14-Jun-2023
  • (2021)Metatheory.jl: Fast and Elegant Algebraic Computation in Julia with Extensible Equality SaturationJournal of Open Source Software10.21105/joss.030786:59(3078)Online publication date: Mar-2021
  • (2021)Type stability in Julia: avoiding performance pathologies in JIT compilationProceedings of the ACM on Programming Languages10.1145/34855275:OOPSLA(1-26)Online publication date: 15-Oct-2021
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image Proceedings of the ACM on Programming Languages
Proceedings of the ACM on Programming Languages  Volume 4, Issue OOPSLA
November 2020
3108 pages
EISSN:2475-1421
DOI:10.1145/3436718
Issue’s Table of Contents
This work is licensed under a Creative Commons Attribution International 4.0 License.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 13 November 2020
Published in PACMPL Volume 4, Issue OOPSLA

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. compilation
  2. dynamic languages
  3. eval
  4. method dispatch

Qualifiers

  • Research-article

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)251
  • Downloads (Last 6 weeks)38
Reflects downloads up to 21 Sep 2024

Other Metrics

Citations

Cited By

View all
  • (2023)Come for syntax, stay for speed, understand defects: an empirical study of defects in Julia programsEmpirical Software Engineering10.1007/s10664-023-10328-528:4Online publication date: 14-Jun-2023
  • (2021)Metatheory.jl: Fast and Elegant Algebraic Computation in Julia with Extensible Equality SaturationJournal of Open Source Software10.21105/joss.030786:59(3078)Online publication date: Mar-2021
  • (2021)Type stability in Julia: avoiding performance pathologies in JIT compilationProceedings of the ACM on Programming Languages10.1145/34855275:OOPSLA(1-26)Online publication date: 15-Oct-2021
  • (2021)What we eval in the shadows: a large-scale study of eval in R programsProceedings of the ACM on Programming Languages10.1145/34855025:OOPSLA(1-23)Online publication date: 15-Oct-2021

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media