在性能上,Guava图书馆有多好? [英] Performance-wise, how good is the Guava library?

查看:150
本文介绍了在性能上,Guava图书馆有多好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过 Google Guava 图书馆发现了很多好的,可用的数据结构在其中。



如果有其他人使用过,那么您可以提供有关在使用巨大数据集时执行的反馈?基本上我正在寻找BigO符号进行操作。



提前感谢

解决方案>

这里的Guava贡献者。



嗯,有什么可说的?所有基于哈希(和基于枚举的)集合都具有恒定时间的单输入操作,正如您所期望的那样。 ( HashMultiset LinkedHashMultiset ConcurrentHashMultiset HashBiMap HashBasedTable ImmutableSet ImmutableMap EnumMultiset EnumBiMap 等都属于该类别。)所有基于树的/排序的集合具有单输入操作的对数时间,包括 TreeMultiset ImmutableSortedMap ImmutableSortedSet



在多图中,文档基本上告诉您 Map 和价值收集实现,你可以从中找出它。 HashMultimap 基本上是一个 HashMap HashSet s, LinkedHashMultimap 是一个 LinkedHashMap LinkedHashSet s, ArrayListMultimap 是一个 HashMap ArrayList s, LinkedListMultimap 是一个 LinkedHashMap LinkedList (性能方面,如果不是技术上的话) code> TreeMultimap 是一个 TreeMap TreeSet s, ImmutableSetMultimap 是一个 ImmutableMap ImmutableSet s, ImmutableListMultimap ImmutableMap ImmutableList s。



唯一可能不明确的事情可能是 SortedMultiset 实现提供 subMultiset()。size()操作在 O(log n)时间,您不能仅使用JDK TreeMap< E,Integer>



所有v收藏的视图(我们喜欢观点很多)返回恒定时间,并具有您期望的渐近。



有什么更特别的你担心吗?



(一般来说,Guava基本上是核心图书馆谷歌在生产中使用,我想认为这是非常有力的证据表明,公用事业在重型环境中表现令人满意。此外,番石榴不断改进,您基本上免费获得了这些改进。)


I have been through the Google Guava library and founds lots of good, usable data structures in it.

If anyone else has used it then can you provide feedback on how it performed when used with huge data sets? Basically I am looking for BigO notation for its operations.

Thanks in advance

解决方案

Guava contributor here.

Um, what's there to say? All hash-based (and enum-based) collections have the single-entry operations in constant time, exactly as you'd expect. (HashMultiset, LinkedHashMultiset, ConcurrentHashMultiset, HashBiMap, HashBasedTable, ImmutableSet, ImmutableMap, EnumMultiset, EnumBiMap, etc. all fall into that category.) All tree-based/sorted collections have logarithmic time for their single-entry operations, including TreeMultiset, ImmutableSortedMap, and ImmutableSortedSet.

Among multimaps, well, the documentation basically tells you the Map and the value-collection implementations, and you can figure it out from there. HashMultimap is basically a HashMap to HashSets, LinkedHashMultimap is a LinkedHashMap to LinkedHashSets, ArrayListMultimap is a HashMap to ArrayLists, LinkedListMultimap is a LinkedHashMap to LinkedLists (performance-wise, if not technically true), TreeMultimap is a TreeMap to TreeSets, ImmutableSetMultimap is an ImmutableMap to ImmutableSets, ImmutableListMultimap is an ImmutableMap to ImmutableLists.

The only thing that might not be self-evident is probably that the SortedMultiset implementations provide subMultiset().size() operations in O(log n) time, which you couldn't do just with a JDK TreeMap<E, Integer>.

All the views of collections (we like views a lot) return in constant time and have the asymptotics you'd expect.

Is there anything more specific you were concerned about?

(In general, Guava is basically the core libraries Google uses in production, which I'd like to think is pretty strong evidence that the utilities perform satisfactorily in heavy-duty environments. Additionally, Guava is constantly being improved, and you get those improvements basically for free.)

这篇关于在性能上,Guava图书馆有多好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆