• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

计算机工程与科学 ›› 2022, Vol. 44 ›› Issue (12): 2091-2101.

• 高性能计算 • 上一篇    下一篇

基于即时编译的GNU Octave性能优化

莫舒恒1,卢圣有2,黄聃2,卢宇彤2   

  1. (1.中山大学系统科学与工程学院,广东 广州 510006;2.中山大学计算机学院,广东 广州 510006)

  • 收稿日期:2021-01-24 修回日期:2022-03-22 接受日期:2022-12-25 出版日期:2022-12-25 发布日期:2022-12-26

GNU Octave performance optimization based on Just-In-Time compilation

MO Shu-heng1,LU Sheng-you2,HUANG Dan2,LU Yu-tong2    

  1. (1.School of Systems Science and Engineering,Sun Yat-sen University,Guangzhou 510006;
    2.School of Computer Science and Engineering,Sun Yat-sen University,Guangzhou 510006,China)
  • Received:2021-01-24 Revised:2022-03-22 Accepted:2022-12-25 Online:2022-12-25 Published:2022-12-26

摘要: GNU Octave是一款数值计算软件,具有免费、开源以及几乎完全兼容MATLAB语言的优点。然而,Octave内置的基于LLVM的实验性即时编译器仅支持对少部分代码进行即时编译,无法有效解决Octave效率低下的问题。基于Octave即时编译器探究对Octave的性能优化方案,从工作原理角度出发,对该即时编译器整体工作原理和其中的类型推断系统进行分析;从工作现状角度出发,评估该即时编译器对Octave代码的适用范围和性能提升效果;针对该即时编译器的内置函数调用、索引运算与算术逻辑运算进行特性修复和功能新增,使Octave获得性能提升。实验结果表明,基于即时编译器的优化方案有效扩展了即时编译器的适用范围,为Octave代码执行带来56~283倍不等的性能提升。此外,总结了该即时编译器中存在的16类缺陷,对进一步优化Octave性能具有参考意义。

关键词: GNU Octave, 即时编译, LLVM, 性能优化

Abstract: GNU Octave is a numerical computing software that is free, open source, and almost fully compatible with MATLAB. However, its experimental LLVM-based Just-In-Time (JIT) compiler built into Octave only supports the JIT compilation of a small number of codes, and cannot effectively overcome the performance inefficiency of Octave. This paper explores the performance optimization of Octave based on its JIT compiler. From the perspective of working principle, the whole working principle of the JIT compiler and its type inference system are analyzed. From the perspective of current work status, the application scope and performance improvement of the JIT compiler for Octave code are eva- luated. Aiming at the built-in function calls, indexing operations, and arithmetic-logic operations, feature repairment and function enhancement are carried out to improve Octaves performance. The experimental results show that the optimization scheme based on the JIT compiler not only effectively expands the application scope of the JIT compiler, but also brings 56x-283x performance improvement for the Octave code execution. In addition, 16 types of defects in the JIT compiler, which are summarized to practical significance on further optimizing the performance of Octave.


Key words: GNU Octave, just-in-time compilation, LLVM, performance optimization