基于Hash-Array映射Tries的JVM上快速精简的不可变多重映射
Fast and Lean Immutable Multi-Maps on the JVM based on Heterogeneous Hash-Array Mapped Tries
摘要:
不可变多映射是一种多对多线程友好的映射数据结构,具有预期的快速插入和查找操作。这种数据结构用于处理图形或多对多关系的应用程序,如在面向对象系统的静态分析中所应用的。当处理这样的大数据集时,数据结构编码本身的存储器开销是存储器使用瓶颈。出于重用和类型安全的考虑,Java、Scala和Clojure的库通常通过将集合嵌套为带有trie映射键的值来实现不可变的多重映射。像这样,根据我们的测量,每个存储条目的稀疏多映射的预期字节开销总计约为65 B,这使得在JVM上进行有效计算变得不可行。在本文中,我们提出了一个通用的框架,哈希数组映射的Tries在JVM上,可以存储类型异构的关键字和值:异构哈希数组映射的Trie(HHAMT)。在其他应用中,这允许通过(a)不为空值集保留空间以及(b)内联单例集的值同时维护(c)类型安全API来实现高效的多映射编码。我们详细介绍了必要的编码和优化,以减轻存储和检索异构数据在哈希树的开销。此外,我们专门针对多重映射的应用程序评估HHAMT,将其与Java,Scala和Clojure中最先进的多重映射编码进行比较。我们隔离使用微基准测试的关键差异,并验证了在静态分析的真实世界的情况下得出的结论。新的编码将每个键值的存储开销降低到30 B:2倍的改进。通过对原始值的额外内联,它达到了4倍的改进。
英文摘要:
An immutable multi-map is a many-to-many thread-friendly map data structure with expected fast insert and lookup operations. This data structure is used for applications processing graphs or many-to-many relations as applied in static analysis of object-oriented systems. When processing such big data sets the memory overhead of the data structure encoding itself is a memory usage bottleneck. Motivated by reuse and type-safety, libraries for Java, Scala and Clojure typically implement immutable multi-maps by nesting sets as the values with the keys of a trie map. Like this, based on our measurements the expected byte overhead for a sparse multi-map per stored entry adds up to around 65B, which renders it unfeasible to compute with effectively on the JVM. In this paper we propose a general framework for Hash-Array Mapped Tries on the JVM which can store type-heterogeneous keys and values: a Heterogeneous Hash-Array Mapped Trie (HHAMT). Among other applications, this allows for a highly efficient multi-map encoding by (a) not reserving space for empty value sets and (b) inlining the values of singleton sets while maintaining a (c) type-safe API. We detail the necessary encoding and optimizations to mitigate the overhead of storing and retrieving heterogeneous data in a hash-trie. Furthermore, we evaluate HHAMT specifically for the application to multi-maps, comparing them to state-of-the-art encodings of multi-maps in Java, Scala and Clojure. We isolate key differences using microbenchmarks and validate the resulting conclusions on a real world case in static analysis. The new encoding brings the per key-value storage overhead down to 30B: a 2x improvement. With additional inlining of primitive values it reaches a 4x improvement.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。