JavaScript Sealed Classes
Résumé
In this work, we study the JavaScript sealed classes, which differ from regular classes in a few constraints 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 JS 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. Do do so, we assembled a new suite of benchmarks that focuses on the efficiency of class implementations. On this suite, we measured that sealed classes provide an average speedup of 19%. The more classes and methods the programs use, the greater the speedup. For the most favorable test that uses them intensively, we measured a speedup of 56%.