Arrays.sort()和Arrays.parallelSort之间差() [英] Difference between Arrays.sort() and Arrays.parallelSort()
问题描述
正经历的Java 8
的功能,提到的此处。弄不明白什么 parallelSort()
正是这么做。有人能解释什么是之间的实际相差排序()
和 parallelSort()
?
Was going through Java 8
features, mentioned here. Couldn't understand what parallelSort()
does exactly. Can someone explain what is the actual difference between sort()
and parallelSort()
?
推荐答案
并行排序使用的线程的。它的速度更快,当有元素的大量。并行化开销变大上过得去的阵列小,但它是太大较小。
Parallel sort uses threading. It's faster when there are a lot of elements. The overhead for parallelization becomes tolerably small on larger arrays, but it is too big for smaller ones.
看看这个表(当然,其结果取决于对CPU等):
Take a look at this table (of course, the results depend on the CPU, etc):
从这个链接摘自:<一href=\"http://www.java$c$cgeeks.com/2013/04/arrays-sort-versus-arrays-parallelsort.html\">http://www.java$c$cgeeks.com/2013/04/arrays-sort-versus-arrays-parallelsort.html
这篇关于Arrays.sort()和Arrays.parallelSort之间差()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!