我需要以“x,y-> 7”的形式为~3-4百万个元组创建一个大索引。 groovy(或任何可导入的外部模块)中最好的数据结构(速度方面)是什么?
答案 0 :(得分:1)
如果你真的被性能困扰,那么使用Java,并从Groovy调用这个Java。
3-4百万不是那么多的物品......
@groovy.transform.Canonical
class Tuple {
def x, y
}
Map<Tuple,Integer> values = [:]
values[ new Tuple( 3, 5 ) ] = 7