skip to main content

Of JavaScript AOT compilation performance

Published:19 August 2021Publication History
Skip Editorial Notes Section

Editorial Notes

A corrigendum was issued for this paper on October 26, 2021. You can download the corrigendum from the supplemental material section of this citation page.

Skip Abstract Section

Abstract

The fastest JavaScript production implementations use just-in-time (JIT) compilation and the vast majority of academic publications about implementations of dynamic languages published during the last two decades focus on JIT compilation. This does not imply that static compilers (AoT) cannot be competitive; as comparatively little effort has been spent creating fast AoT JavaScript compilers, a scientific comparison is lacking. This paper presents the design and implementation of an AoT JavaScript compiler, focusing on a performance analysis. The paper reports on two experiments, one based on standard JavaScript benchmark suites and one based on new benchmarks chosen for their diversity of styles, authors, sizes, provenance, and coverage of the language. The first experiment shows an advantage to JIT compilers, which is expected after the decades of effort that these compilers have paid to these very tests. The second shows more balanced results, as the AoT compiler generates programs that reach competitive speeds and that consume significantly less memory. The paper presents and evaluates techniques that we have either invented or adapted from other systems, to improve AoT JavaScript compilation.

Skip Supplemental Material Section

Supplemental Material

3473575.mp4

Presentation Videos

References

  1. W. Ahn. 2014. Improving javascript performance by deconstructing the type system. In PLDI 2014 - Proceedings of the 2014 ACM SIGPLAN Conference on Programming Language Design and Implementation (Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI)). Association for Computing Machinery, Edinburgh, UK. 496–507. isbn:9781450327848 https://doi.org/10.1145/2594291.2594332 35th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2014 ; Conference date: 09-06-2014 Through 11-06-2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. C. Anderson, P. Giannini, and S. Drossopoulou. 2005. Towards Type Inference for Javascript. In Proceedings of the 19th European Conference on Object-Oriented Programming (ECOOP’05). Springer-Verlag, Heidelberg. https://doi.org/10.1007/11531142_19 Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Apple. 2018. WebKit. https://webkit.org/.Google ScholarGoogle Scholar
  4. Vincenzo Arceri, Isabella Mastroeni, and Sunyi Xu. 2020. Static Analysis for ECMAScript String Manipulation Programs. Applied Sciences, 10, 10 (2020), May, 3525. issn:2076-3417 https://doi.org/10.3390/app10103525 Google ScholarGoogle ScholarCross RefCross Ref
  5. R. Artoul. 2015. Javascript Hidden Classes and Inline Caching in V8. http://richardartoul.github.io/jekyll/update/2015/04/26/hidden-classes.htmlGoogle ScholarGoogle Scholar
  6. Thomas Ball, Peli de Halleux, and Michał Moskal. 2019. Static TypeScript: An Implementation of a Static Compiler for the TypeScript Language. In Proceedings of the 16th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes (MPLR 2019). Association for Computing Machinery, New York, NY, USA. 105–116. isbn:9781450369770 https://doi.org/10.1145/3357390.3361032 Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Spenser Bauman, Carl Friedrich Bolz, Robert Hirschfeld, Vasily Kirilichev, Tobias Pape, Jeremy G. Siek, and Sam Tobin-Hochstadt. 2015. Pycket: A Tracing JIT for a Functional Language. In Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming (ICFP 2015). Association for Computing Machinery, New York, NY, USA. 22–34. isbn:9781450336697 https://doi.org/10.1145/2784731.2784740 Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. H.J. Boehm and M. Weiser. 1988. Garbage Collection in an Uncooperative Environment. Software — Practice and Experience, 18, 9 (1988), Sept., 807–820. https://doi.org/10.1002/spe.4380180902 Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Fraser Brown, John Renner, Andres Nötzli, Sorin Lerner, Hovav Shacham, and Deian Stefan. 2020. Towards a Verified Range Analysis for JavaScript JITs. In Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2020). Association for Computing Machinery, New York, NY, USA. 135–150. isbn:9781450376136 https://doi.org/10.1145/3385412.3385968 Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. C. Chambers and D. Ungar. 1989. Customization: Optimizing Compiler Technology for SELF, A Dynamically-Typed Object-Oriented Programming Language. In Conference Proceedings on Programming Language Design and Implementation (PLDI ’89). ACM, New York, NY, USA. https://doi.org/10.1145/73141.74831 Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. C. Chambers, D. Ungar, and E. Lee. 1989. An Efficient Implementation of SELF a Dynamically-typed Object-oriented Language Based on Prototypes. In Conference Proceedings on Object-oriented Programming Systems, Languages and Applications (OOPSLA ’89). ACM, USA. 49–70. isbn:0-89791-333-7 https://doi.org/10.1145/74878.74884 Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. S. Chandra. 2016. Type Inference for Static Compilation of JavaScript. In Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2016). ACM, New York, NY, USA. isbn:978-1-4503-4444-9 https://doi.org/10.1145/3022671.2984017 Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. M. Chevalier-Boisvert and M. Feeley. 2015. Simple and Effective Type Check Removal through Lazy Basic Block Versioning. In 29th European Conference on Object-Oriented Programming, ECOOP 2015. https://doi.org/10.4230/LIPIcs.ECOOP.2015.101 Google ScholarGoogle ScholarCross RefCross Ref
  14. M. Chevalier-Boisvert and M. Feeley. 2016. Interprocedural Type Specialization of JavaScript Programs Without Type Analysis. In 30th European Conference on Object-Oriented Programming. https://doi.org/10.4230/LIPIcs.ECOOP.2016.7 Google ScholarGoogle ScholarCross RefCross Ref
  15. Jiho Choi, Thomas Shull, and Josep Torrellas. 2019. Reusable Inline Caching for JavaScript Performance. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2019). Association for Computing Machinery, New York, NY, USA. 889–901. isbn:9781450367127 https://doi.org/10.1145/3314221.3314587 Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. W. Choi, S. Chandra, G. Necula, and L. Sen. 2015. SJS: A Type System for JavaScript with Fixed Object Layout. In Static Analysis - 22nd International Symposium, SAS’15. Saint-Malo, France. 181–198. https://doi.org/10.1007/978-3-662-48288-9_11 Google ScholarGoogle ScholarCross RefCross Ref
  17. D. Clifford, H. Payer, M. Stanton, and B. Titzer. 2015. Memento Mori: Dynamic Allocation-site-based Optimizations. In Proceedings of the 2015 ACM SIGPLAN International Symposium on Memory Management. New York, NY, USA. https://doi.org/10.1145/2887746.2754181 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. G. Dot. 2017. Removing Checks in Dynamically Typed Languages through Efficient Profiling. In Proceedings of the 2017 International Symposium on Code Generation and Optimization (CGO ’17). IEEE Press, 257–268. isbn:9781509049318 https://doi.org/10.5555/3049832.3049860Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. ECMA International. 2015. Standard ECMA-262 - ECMAScript Language Specification (6.0 ed.).Google ScholarGoogle Scholar
  20. ECMA International. 2018. ECMAScript 2018 Language Specification (9.0 ed.). https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdfGoogle ScholarGoogle Scholar
  21. David Eder. 2020. a simple BASIC interpreter. http://eder.us/projects/jbasic/Google ScholarGoogle Scholar
  22. D. Flanagan. 2002. JavaScript – The definitive guide (fourth edition). O’Reilly & Associates, USA.Google ScholarGoogle Scholar
  23. A. Gal, B. Eich, M. Shaver, D. Anderson, D. Mandelin, M. Haghighat, B. Kaplan, G. Hoare, B. Zbarsky, J. Orendorff, J. Ruderman, E. Smith, R. Reitmaier, M. Bebenita, M. Chang, and M. Franz. 2009. Trace-based just-in-time type specialization for dynamic languages. In Proceedings of the 2009 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2009, Dublin, Ireland, June 15-21, 2009. https://doi.org/10.1145/1542476.1542528 Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Andreas Gal, Brendan Eich, Mike Shaver, David Anderson, David Mandelin, Mohammad R. Haghighat, Blake Kaplan, Graydon Hoare, Boris Zbarsky, Jason Orendorff, Jesse Ruderman, Edwin W. Smith, Rick Reitmaier, Michael Bebenita, Mason Chang, and Michael Franz. 2009. Trace-Based Just-in-Time Type Specialization for Dynamic Languages. In Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’09). Association for Computing Machinery, New York, NY, USA. 465–478. isbn:9781605583921 https://doi.org/10.1145/1542476.1542528 Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Google. 2018. V8 JavaScript Engine. http://developers.google.com/v8Google ScholarGoogle Scholar
  26. Google. 2019. JIT-less V8. https://v8.dev/blog/jitlessGoogle ScholarGoogle Scholar
  27. A. Guha, C. Saftoiu, and S. Krishnamurthi. 2010. The essence of JavaScript. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP’10). https://doi.org/10.5555/1883978.1883988Google ScholarGoogle Scholar
  28. Andreas Haas. 2017. Bringing the Web up to Speed with WebAssembly. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2017). Association for Computing Machinery, New York, NY, USA. 185–200. isbn:9781450349888 https://doi.org/10.1145/3062341.3062363 Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. B. Hackett and S-Y. Guo. 2012. Fast and Precise Hybrid Type Inference for JavaScript. In Proceedings of the 33rd ACM SIGPLAN Conference on Programming Language Design and Implementation. New York, NY, USA. isbn:978-1-4503-1205-9 https://doi.org/10.1145/2345156.2254094 Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. James Halliday. 2020. Minimist: parse argument options. https://github.com/substack/minimistGoogle ScholarGoogle Scholar
  31. Zoltan Herczeg. 2015. Performance comparison of regular expression engines. https://zherczeg.github.io/sljit/regex_perf.htmlGoogle ScholarGoogle Scholar
  32. U. Hölzle, C. Chambers, and D. Ungar. 1991. Optimizing Dynamically-Typed Object-Oriented Languages With Polymorphic Inline Caches. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP ’91). UK. 21–38. isbn:3-540-54262-0 https://doi.org/10.1.1.126.7745Google ScholarGoogle Scholar
  33. Adobe Systems Incorporated. 2020. jpeg.js, A pure javascript JPEG encoder and decoder for node.js. https://github.com/eugeneware/jpeg-jsGoogle ScholarGoogle Scholar
  34. Isaacs. 2016. https://github.com/isaacs/minimatchGoogle ScholarGoogle Scholar
  35. Christopher Jeffrey. 2020. Marked. https://github.com/markedjs/markedGoogle ScholarGoogle Scholar
  36. S. Jensen, A. Møller, and P. Thiemann. 2009. Type Analysis for JavaScript. In Proceedings of the 16th International Symposium on Static Analysis (SAS). Springer-Verlag, Berlin, Heidelberg. 238–255. isbn:978-3-642-03236-3 https://doi.org/10.1007/978-3-642-03237-0_17 Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Simon Holm Jensen, Anders Møller, and Peter Thiemann. 2009. Type Analysis for JavaScript. In Proc. 16th International Static Analysis Symposium (SAS) (LNCS, Vol. 5673). Springer-Verlag. https://doi.org/10.1007/978-3-642-03237-0_17 Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. S H. Jensen, A. Møller, and P. Thiemann. 2009. Type Analysis for JavaScript. In Proceedings of the 16th International Symposium on Static Analysis (SAS ’09). Springer-Verlag, Berlin, Heidelberg. isbn:978-3-642-03236-3 https://doi.org/10.1007/978-3-642-03237-0_17 Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Vineeth Kashyap, Kyle Dewey, Ethan A. Kuefner, John Wagner, Kevin Gibbons, John Sarracino, Ben Wiedermann, and Ben Hardekopf. 2014. JSAI: A Static Analysis Platform for JavaScript. In Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering (FSE 2014). Association for Computing Machinery, New York, NY, USA. 121–132. isbn:9781450330565 https://doi.org/10.1145/2635868.2635904 Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Arase Kazuhiko. 2009. QRcode.js. http://www.d-project.com/Google ScholarGoogle Scholar
  41. R. Kelsey, W. Clinger, and J. Rees. 1998. The Revised(5) Report on the Algorithmic Language Scheme. Higher-Order and Symbolic Computation, 11, 1 (1998), Sept..Google ScholarGoogle Scholar
  42. Y. Ko, H. Lee, J. Dolby, and S. Ryu. 2015. Practically Tunable Static Analysis Framework for Large-Scale JavaScript Applications. In 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE). 541–551. https://doi.org/10.1109/ASE.2015.28 Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. B. S. Lerner, J. Politz, J.G., A. Guha, and S. Krishnamurthi. 2013. TeJaS: Retrofitting Type Systems for JavaScript. In Proceedings of the 9th Symposium on Dynamic Languages (DLS ’13). ACM, NY, USA. isbn:978-1-4503-2433-5 https://doi.org/10.1145/2578856.2508170 Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. F. Logozzo and H. Venter. 2010. RATA: Rapid Atomic Type Analysis by Abstract Interpretation - Application to JavaScript Optimization. In Compiler Construction, 19th International Conference, CC 2010, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2010, Paphos, Cyprus, March 20-28, 2010. Proceedings. https://doi.org/10.1007/978-3-642-11970-5_5 Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Florian Loitsch. 2005. Javascript to Scheme Compilation. In Proceedings of the Sixth Workshop on Scheme and Functional Programming. 101–116.Google ScholarGoogle Scholar
  46. F. Loitsch and M. Serrano. 2008. Trends in Functional Programming. 8, Seton Hall University, Intellect Bristol, UK/Chicago, USA. 141–158. isbn:978-1-84150-196-3Google ScholarGoogle Scholar
  47. MDN. 2019. SpiderMonkey Internals. https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/InternalsGoogle ScholarGoogle Scholar
  48. B. Meurer. 2016. The truth about traditional JavaScript benchmarks. https://benediktmeurer.de/2016/12/16/the-truth-about-traditional-javascript-benchmarksGoogle ScholarGoogle Scholar
  49. Moment.com. 2020. Moment.js. https://momentjs.com/Google ScholarGoogle Scholar
  50. Raphaël Monat, Abdelraouf Ouadjaout, and Antoine Miné. 2020. Value and Allocation Sensitivity in Static Python Analyses. In Proceedings of the 9th ACM SIGPLAN International Workshop on the State Of the Art in Program Analysis (SOAP 2020). Association for Computing Machinery, New York, NY, USA. 8–13. isbn:9781450379977 https://doi.org/10.1145/3394451.3397205 Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. Mozilla. 2020. SpiderMonkey: The Mozilla JavaScript runtime. https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkeyGoogle ScholarGoogle Scholar
  52. Todd Mytkowicz, Amer Diwan, Matthias Hauswirth, and Peter F. Sweeney. 2009. Producing wrong data without doing anything obviously wrong!. In Proceeding of the 14th international conference on Architectural support for programming languages and operating systems (ASPLOS ’09). ACM, New York, NY, USA. 265–276. isbn:978-1-60558-406-5 https://doi.org/10.1145/1508244.1508275 Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Benjamin Barslev Nielsen and Anders Møller. 2020. Value Partitioning: A Lightweight Approach to Relational Static Analysis for JavaScript. In Proc. 34th European Conference on Object-Oriented Programming (ECOOP). https://doi.org/10.4230/LIPIcs.ECOOP.2020.16 Google ScholarGoogle ScholarCross RefCross Ref
  54. C. Park and S. Ryu. 2015. Scalable and Precise Static Analysis of JavaScript Applications via Loop-Sensitivity. In 29th European Conference on Object-Oriented Programming, ECOOP 2015, Prague, Czech Republic. https://doi.org/10.1145/3093334.2989228 Google ScholarGoogle ScholarDigital LibraryDigital Library
  55. Aleksandar Prokopec, Gilles Duboscq, David Leopoldseder, and Thomas Würthinger. 2019. An Optimization-Driven Incremental Inline Substitution Algorithm for Just-in-Time Compilers. In Proceedings of the 2019 International Symposium on Code Generation and Optimization (CGO 2019). IEEE Press, 164–179. isbn:9781728114361 https://doi.org/10.5555/3314872.3314893Google ScholarGoogle ScholarCross RefCross Ref
  56. M. Qunaibit. 2018. Accelerating Dynamically-Typed Languages on Heterogeneous Platforms Using Guards Optimization. In Proceedings of 32th the European Conference on Object-Oriented Programming (ECOOP’18). https://doi.org/10.4230/LIPIcs.ECOOP.2018.16 Google ScholarGoogle ScholarCross RefCross Ref
  57. Brianna M. Ren and Jeffrey S. Foster. 2016. Just-in-Time Static Type Checking for Dynamic Languages. In Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’16). Association for Computing Machinery, New York, NY, USA. 462–476. isbn:9781450342612 https://doi.org/10.1145/2908080.2908127 Google ScholarGoogle ScholarDigital LibraryDigital Library
  58. V. Saint-Amour and S-Y Guo. 2015. Optimization Coaching for JavaScript. In 29th European Conference on Object-Oriented Programming, ECOOP 2015. https://doi.org/10.4230/LIPIcs.ECOOP.2015.271 Google ScholarGoogle ScholarCross RefCross Ref
  59. Manuel Serrano. 1992. Bigloo, a Practical Scheme Compiler. http://www-sop.inria.fr/indes/fp/Bigloo/Google ScholarGoogle Scholar
  60. M. Serrano. 2018. JavaScript AOT Compilation. In 14th Dynamic Language Symposium (DLS). Boston, USA. https://doi.org/10.1145/3276945.3276950 Google ScholarGoogle ScholarDigital LibraryDigital Library
  61. M. Serrano and M. Feeley. 2019. Property Caches Revisited. In Proceedings of the 28th Compiler Construction Conference (CC’19). Washington, USA. https://doi.org/10.1145/3302516.3307344 Google ScholarGoogle ScholarDigital LibraryDigital Library
  62. M. Serrano and R. Findler. 2020. Dynamic Property Caches, a Step towards Faster JavaScripts Proxy Objects. In Proceedings of the 29th Compiler Construction Conference (CC’20). San Dieo, USA. https://doi.org/10.1145/3377555.3377888 Google ScholarGoogle ScholarDigital LibraryDigital Library
  63. O. Shivers. 1988. Control Flow Analysis in Scheme. In Proceedings of the SIGPLAN ’88 ACM Sigplan Int’l Conference on Programming Language Design and Implementation (PLDI). Atlanta, Georgia. https://doi.org/10.1145/960116.54007 Google ScholarGoogle ScholarDigital LibraryDigital Library
  64. S. Strickland. 2012. Chaperones and Impersonators: Run-time Support for Reasonable Interposition. In Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA’12). Arizona, USA. 943–962. https://doi.org/10.1145/2384616.2384685 Google ScholarGoogle ScholarDigital LibraryDigital Library
  65. 2020. uuid.js, For the creation of RFC4122 UUIDs. https://www.npmjs.com/package/uuidGoogle ScholarGoogle Scholar
  66. V8 Team. 2017. Retiring Octane. https://v8.dev/blog/retiring-octaneGoogle ScholarGoogle Scholar
  67. Jérôme Vouillon. 2020. Js_of_ocaml. https://ocsigen.org/js_of_ocamlGoogle ScholarGoogle Scholar
  68. April W. Wade, Prasad A. Kulkarni, and Michael R. Jantz. 2017. AOT vs. JIT: Impact of Profile Data on Code Quality. In Proceedings of the 18th ACM SIGPLAN/SIGBED Conference on Languages, Compilers, and Tools for Embedded Systems (LCTES 2017). Association for Computing Machinery, New York, NY, USA. 1–10. isbn:9781450350303 https://doi.org/10.1145/3078633.3081037 Google ScholarGoogle ScholarDigital LibraryDigital Library
  69. Wikipedia. 2021. Włand X. https://en.wikipedia.org/wiki/W%5EXGoogle ScholarGoogle Scholar
  70. Christian Wimmer. 2019. Initialize Once, Start Fast: Application Initialization at Build Time. Proc. ACM Program. Lang., 3, OOPSLA (2019), Article 184, Oct., 29 pages. https://doi.org/10.1145/3360610 Google ScholarGoogle ScholarDigital LibraryDigital Library
  71. T. Würthinger. 2017. Practical Partial Evaluation for High-Performance Dynamic Language Runtimes. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2017). Association for Computing Machinery, New York, NY, USA. 662–676. isbn:9781450349888 https://doi.org/10.1145/3062341.3062381 Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Of JavaScript AOT compilation performance

          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

          • Article Metrics

            • Downloads (Last 12 months)497
            • Downloads (Last 6 weeks)31

            Other Metrics

          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!