JavaScript Sealed Classes

Author Manuel Serrano

Thumbnail PDF


  • Filesize: 1.24 MB
  • 27 pages

Document Identifiers

Author Details

Manuel Serrano
  • Inria/UCA, Inria Sophia Méditerranée, 2004 route des Lucioles, Sophia Antipolis, France


My gratitude to L. Tratt for his suggestions to improve this paper, and to O. Melançon, E. Rohou, M. Feeley, and R. Findler for their comments, suggestions, and corrections.

Cite AsGet BibTex

Manuel Serrano. JavaScript Sealed Classes. In 36th European Conference on Object-Oriented Programming (ECOOP 2022). Leibniz International Proceedings in Informatics (LIPIcs), Volume 222, pp. 24:1-24:27, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2022)


In this work, we study the JavaScript Sealed Classes, which differ from regular classes in a few ways that allow ahead-of-time (AoT) compilers to implement them more efficiently. Sealed classes are compatible with the rest of the language so that they can be combined with all other structures, including regular classes, and can be gradually integrated into existing code bases. We present the design of the sealed classes and study their implementation in the hopc AoT compiler. We present an in-depth analysis of the speed of sealed classes compared to regular classes. To do so, we assembled a new suite of benchmarks that focuses on the efficiency of the class implementations. On this suite, we found that sealed classes provide an average speedup of 19%. The more classes and methods programs use, the greater the speedup. For the most favorable test that uses them intensively, we measured a speedup of 56%.

Subject Classification

ACM Subject Classification
  • Software and its engineering → Just-in-time compilers
  • Software and its engineering → Source code generation
  • Software and its engineering → Object oriented languages
  • Software and its engineering → Functional languages
  • JavaScript
  • Compiler
  • Dynamic Languages
  • Classes
  • Inline Caches


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Gavin Bierman, Martín Abadi, and Mads Torgersen. Understanding TypeScript. In Proceedings of the 28th European Conference on ECOOP 2014 - Object-Oriented Programming - Volume 8586, pages 257-281, Berlin, Heidelberg, 2014. Springer-Verlag. URL:
  2. Carl Friedrich Bolz. Better JIT Support for Auto-Generated Python Code., September 2021.
  3. C. Chambers and D. Ungar. Customization: Optimizing Compiler Technology for SELF, a Dynamically-Typed Object-Oriented Programming Language. In Conference Proceedings on Programming Language Design and Implementation, PLDI '89, New York, NY, USA, 1989. ACM. URL:
  4. C. Chambers, D. Ungar, and E. Lee. 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, pages 49-70, USA, 1989. ACM. URL:
  5. Avik Chaudhuri, Basil Hosmer, and Gabriel Levi. Flow, a new static type checker for JavaScript, November 2014. URL:
  6. D. Clifford, H. Payer, M. Stanton, and B. Titzer. Memento Mori: Dynamic Allocation-site-based Optimizations. In Proceedings of the 2015 ACM SIGPLAN International Symposium on Memory Management, New York, NY, USA, 2015. URL:
  7. N. Cohen. Type-extension type tests can be performed in constant time. ACM Transactions on Programming Languages and Systems (TOPLAS), 13(4):626-629, 1991. URL:
  8. Jeffrey Dean, David Grove, and Craig Chambers. Optimization of Object-Oriented Programs Using Static Class Hierarchy Analysis. In Proceedings of the 9th European Conference on Object-Oriented Programming, ECOOP '95, pages 77-101, 1995. URL:
  9. Peter L. Deutsch and Allan 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. Association for Computing Machinery. URL:
  10. Sébastien Doeraene. Cross-Platform Language Design in Scala.Js (Keynote). In Proceedings of the 9th ACM SIGPLAN International Symposium on Scala, Scala 2018, page 1, New York, NY, USA, 2018. Association for Computing Machinery. URL:
  11. Roland Ducournau. Implementing statically typed object-oriented programming languages. ACM Comput. Surv., 43(3):18:1-18:48, 2011. URL:
  12. ECMA International. Standard ECMA-262 - ECMAScript Language Specification. ECMA, 6.0 edition, June 2015. Google Scholar
  13. Brendan Gregg. Linux systems performance., October 2019.
  14. M. Hölttä. Super fast super property access., February 2021.
  15. U. Hölzle, C. Chambers, and D. Ungar. Optimizing dynamically-typed object-oriented languages with polymorphic inline caches. In Proceedings of the European Conference on Object-Oriented Programming, ECOOP '91, pages 21-38, UK, 1991. URL:
  16. B. Meurer and M. Bynens. The story of a V8 performance cliff in React., August 2019.
  17. Microsoft. TypeScript, Language Specification, version 0.9.5, November 2013. Google Scholar
  18. Mozilla Developper Network. Classes., November 2021.
  19. Mozilla Developper Network. Public class fields., July 2021.
  20. F. Pizlo. Speculation in JavaScriptCore., July 2020. Google Scholar
  21. Aseem Rastogi, Nikhil Swamy, Cédric Fournet, Gavin Bierman, and Panagiotis Vekris. Safe & Efficient Gradual Typing for TypeScript. In Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL '15, pages 167-180, New York, NY, USA, 2015. Association for Computing Machinery. URL:
  22. Gregor Richards, Francesco Zappa Nardelli, and Jan Vitek. Concrete Types for TypeScript. In John Tang Boyland, editor, 29th European Conference on Object-Oriented Programming (ECOOP 2015), volume 37 of Leibniz International Proceedings in Informatics (LIPIcs), pages 76-100, Dagstuhl, Germany, 2015. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik. URL:
  23. Andreas Rossberg. A Strong Mode for JavaScript (Strawman proposal). URL:
  24. Andreas Rossberg. An update on Strong Mode, February 2016. URL:
  25. M. Serrano. Javascript aot compilation. In 14th Dynamic Language Symposium (DLS), Boston, USA, November 2018. URL:
  26. M. Serrano. Of AOT Compilation Performance. Proceedings of the ACM on Programming Languages, August 2021. URL:
  27. M. Serrano and M. Feeley. Property Caches Revisited. In Proceedings of the 28th Compiler Construction Conference (CC'19), Washington, USA, February 2019. URL:
  28. M. Serrano and R. Findler. Dynamic Property Caches, a Step towards Faster JavaScripts Proxy Objects. In Proceedings of the 29th Compiler Construction Conference (CC'20), San Dieo, USA, February 2020. URL:
  29. V. Stinner et al. The Python Benchmark Suite., 2021.