Columnar databases are an established way to speed up online analytical processing (OLAP) queries. Nowadays, data processing (e.g., storage, visualization, and analytics) is often performed at the programming language level, hence it is desirable to also adopt columnar data structures for common language runtimes. While there are frameworks, libraries, and APIs to enable columnar data stores in programming languages, their integration into applications typically requires developer interference. In prior work, researchers implemented an approach for *automated* transformation of arrays into columnar arrays in the GraalVM JavaScript runtime. However, this approach suffers from performance issues on smaller workloads as well as on more complex nested data structures. We find that the key to optimizing accesses to columnar arrays is to identify queries and apply specific optimizations to them. In this paper, we describe novel compiler optimizations in the GraalVM Compiler that optimize queries on columnar arrays. At JIT compile time, we identify loops that access potentially columnar arrays and duplicate them in order to specifically optimize accesses to columnar arrays. Additionally, we describe a new approach for creating columnar arrays from arrays consisting of complex objects by performing **multi-level storage transformation**. We demonstrate our approach via an implementation for JavaScript `Date` objects. [ full abstract at https://doi.org/10.22152/programming-journal.org/2023/7/9 ]
翻译:列式数据库是加速在线分析处理(OLAP)查询的成熟方法。当前,数据处理(如存储、可视化与分析)通常在编程语言层面执行,因此在通用语言运行时中采用列式数据结构具有重要价值。尽管已有框架、库和应用程序接口支持编程语言中的列式数据存储,但其与应用程序的集成通常需要开发人员干预。在先前工作中,研究人员在GraalVM JavaScript运行时中实现了将数组*自动*转换为列式数组的方法。然而,该方法在处理较小规模负载及更复杂的嵌套数据结构时存在性能问题。我们发现,优化列式数组访问的关键在于识别查询并对其应用特定优化。本文描述了GraalVM编译器中针对列式数组查询的新型编译器优化方案。在即时编译阶段,我们通过识别可能访问列式数组的循环并对其进行复制,从而专门优化列式数组的访问路径。此外,我们提出了一种通过执行**多级存储转换**将复杂对象数组创建为列式数组的新方法,并通过JavaScript `Date`对象的实现验证了该方法的有效性。[完整摘要见 https://doi.org/10.22152/programming-journal.org/2023/7/9 ]