以下代码PLINQ没有改善 [英] no improvements on the following PLINQ code

查看:155
本文介绍了以下代码PLINQ没有改善的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不使用下面的代码看到处理速度的任何改进:

I do not see any improvements in processing speed using the following code:

IEnumerable<Quote> sortedQuotes = (from x in unsortedQuotes.AsParallel()
                                           orderby (x.DateTimeTicks)
                                           select x);



在连续的版本:

over the sequential version:

IEnumerable<Quote> sortedQuotes = (from x in unsortedQuotes
                                           orderby (x.DateTimeTicks)
                                           select x);



我失去了一些东西在这里?我在不同从几千源收集的项目数到几千万的,也没有表现出大小水货版本来出人头地。

Am I missing something here? I varied the number of items in the source collections from thousands to several tens of millions and no size showed the Parallel version coming out ahead.

任何提示赞赏。通过如果任何人更快地知道要有效地对更多的方式(给我的指示项变量类型(含该项目集合中排序的长DateTimeTicks),这也将是升值。

Any tips appreciated. By the way if anyone knows of a faster way to sort more efficiently (given my indicated item variable type (containing a long DateTimeTicks by which the items are sorted in the collection) that would also be appreciate.

编辑:有效的排序 - >为尽快

"sorting efficiently" -> As fast as possible.

感谢

推荐答案

根据此页面

如果你在你的查询排序,走走停停将被用来代替,因为流水线排序的输出是一种浪费。一个类的展品非常高延迟[...]等PLINQ更愿意付出全部处理能力,尽快完成排序。

If you have a sort in your query, stop-and-go will be used instead because pipelining the output of a sort is wasteful. A sort exhibits extremely high latency [...], and so PLINQ prefers to devote all processing power to completing the sort as quickly as possible.

您查询的只有的包含了一个排序,选择不计。因此,PLINQ引擎将执行它的顺序。

Your query only contains a Sort, the select doesn't count. So the PLINQ engine will execute it as sequential.

您只能期待一些当改善排序是一个较大查询的一部分。

You can only expect some improvement when the sorting is a part of a larger query.

这篇关于以下代码PLINQ没有改善的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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