节点文献
一种采用预先编译的V8引擎优化方法
V8 JavaScript Engine Optimization Method Using Ahead-of-Time Compilation
【摘要】 JavaScript作为Web应用的主要编程语言之一,其解释执行、动态类型、面向原型等特性成为限制Web应用性能的主要因素。为了加快JavaScript运行速度,提升Web应用性能,本文提出一种采用预先编译的V8引擎优化方法。该方法将Web应用第一次解释执行过程中热点函数的字节码或机器码进行保存,Web应用下次运行时可以直接运行热点函数已保存的字节码或机器码,避免了热点函数的解释代价和编译代价,而且提出了新的代价模型来确定保存热点函数字节码或机器码带来的时间增益和空间代价。本文在V8引擎最新编译架构上实现了基于字节码的预先编译方法,并使用标准JavaScript引擎测试集进行了性能测试,实验结果表明在Kraken、Octane测试集上分别可以取得11%和13.6%的性能提升。
【Abstract】 As one of the most important program language used in web application, JavaScript’s properties of interpretation execution, dynamic typing, and prototype oriented have become the main factors that restrict the performance of web application. To accelerate the running speed, improve the performance of web application, this paper proposes a V8 JavaScript engine optimization method using ahead-of-time compilation. This method saves the bytecode or native code of hot functions generated in the first running process. The saved code of hot functions can be used in the next run of web application to omit the interpretation and compilation overhead. We also propose a new overhead model to determine the time gain and space overhead when saving the bytecode or native code of hot functions. We implemented bytecode-based ahead-of-time compilation on V8’s new compilation architecture and test it on standard JavaScript test set. The experiment results show that it can achieve 11% and 13.6% performance improvement on Kraken and Octane respectively.
【Key words】 JavaScript; V8 JavaScript Engine; JIT; Ahead-of-time Compilation;
- 【文献出处】 网络新媒体技术 ,Network New Media Technology , 编辑部邮箱 ,2021年03期
- 【分类号】TP312.2
- 【下载频次】87