plinq

plinq on large lists taking enormous time

淺唱寂寞╮ 提交于 2019-12-11 06:31:38
问题 I have two in memory lists plays and consumers one having 15 mil objects and the other around 3 mil. the following are a few of queries i'm firing.. consumersn=consumers.AsParallel() .Where(w => plays.Any(x => x.consumerid == w.consumerid)) .ToList(); List<string> consumerids = plays.AsParallel() .Where(w => w.playyear == group_period.year && w.playmonth == group_period.month && w.sixteentile == group_period.group) .Select(c => c.consumerid) .ToList(); int groupcount = plays.AsParallel()

no improvements on the following PLINQ code

时光怂恿深爱的人放手 提交于 2019-12-10 20:32:34
问题 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.

Comparing i4o vs. PLINQ for larger collections

北战南征 提交于 2019-12-10 19:30:54
问题 I have a question for anyone who has experience on i4o or PLINQ. I have a big object collection (about 400K ) needed to query. The logic is very simple and straightforward. For example, there has a collection of Person objects, I need to find the persons matched with same firstName, lastName, datebirth, or the first initial of FirstName/lastname, etc. It is just a time consuming process using LINQ to Object. I am wondering if i4o (http://www.codeplex.com/i4o) or PLINQ can help on improving

How to make PLINQ to spawn more concurrent threads in .NET 4.0 beta 2?

纵然是瞬间 提交于 2019-12-10 16:02:55
问题 In former versions of Parallel Extensions you could set the number of threads: enumerable.AsParallel(numberOfThreads) But now that overload is not available anymore. How to do it now? 回答1: In the new version you can specify it with the extension method ".WithDegreeOfParallelism(int degreeOfParallelism)". IE: enumerable.AsParallel().WithDegreeOfParallelism(numberOfThreads) 回答2: I really have no idea why it changed, so I can't answer the question, but it seems like if the developer specifies

PLINQ AsParallel() with lower priority?

匆匆过客 提交于 2019-12-10 13:35:07
问题 is it possible to run some of my PLINQ AsParallel() - Queries with a lower priority than others? (Or some with a higher priority than others) Is this possible with PLinq or will I have to avoid PLINQ and do all the stuff on my own? EDIT/UPDATE: Would it be possible to call Thread.Sleep(0) inside the parallel executed method when I want to archive a lower priority? Or is that a very bad practice/hack? 回答1: Unfortunately, this is not directly possible in PLINQ. You can do it in most of the rest

Non-linear scaling of .NET operations on multi-core machine

谁说我不能喝 提交于 2019-12-10 03:59:44
问题 I've encountered a strange behavior in a .NET application that performs some highly parallel processing on a set of in-memory data. When run on a multi-core processor (IntelCore2 Quad Q6600 2.4GHz) it exhibits non-linear scaling as multiple threads are kicked off to process the data. When run as a non-multithreaded loop on a single core, the process is able to complete approximately 2.4 million computations per second. When run as four threads you would expect four times as much throughput -

Is PLinq Inherently Faster than System.Threading.Tasks.Parallel.ForEach

跟風遠走 提交于 2019-12-09 11:00:44
问题 Summary : I changed from System.Threading.Tasks.Parallel.ForEach and Concurrent Data structure to a simple plinq (Parallel Linq) query. The speed up was amazing . So is plinq inherently faster than Parallel.ForEach? Or is it specific to the task. // Original Code // concurrent dictionary to store results var resultDict = new ConcurrentDictionary<string, MyResultType>(); Parallel.ForEach(items, item => { resultDict.TryAdd(item.Name, PerformWork(source)); }); // new code var results = items

Parallel ForEach wait 500 ms before spawning

房东的猫 提交于 2019-12-08 07:51:09
问题 I have this situation: var tasks = new List<ITask> ... Parallel.ForEach(tasks, currentTask => currentTask.Execute() ); Is it possible to instruct PLinq to wait for 500ms before the next thread is spawned? System.Threading.Thread.Sleep(5000); 回答1: You are using Parallel.Foreach totally wrong, You should make a special Enumerator that rate limits itself to getting data once every 500 ms. I made some assumptions on how your DTO works due to you not providing any details. private IEnumerator

Make C# ParallelEnumerable.OrderBy stable sort

≯℡__Kan透↙ 提交于 2019-12-07 07:57:19
问题 I'm sorting a list of objects by their integer ids in parallel using OrderBy . I have a few objects with the same id and need the sort to be stable. According to Microsoft's documentation, the parallelized OrderBy is not stable, but there is an implementation approach to make it stable. However, I cannot find an example of this. var list = new List<pair>() { new pair("a", 1), new pair("b", 1), new pair("c", 2), new pair("d", 3), new pair("e", 4) }; var newList = list.AsParallel()

Silverlight 4 PLINQ

◇◆丶佛笑我妖孽 提交于 2019-12-07 03:37:18
问题 I have a very simple question. Is it possible to use PLINQ with Silverlight 4 since it seems that it doesn't exist in the most commonly referenced assemblies? 回答1: It is not supported but you can vote for it here: http://dotnet.uservoice.com/forums/4325-silverlight-feature-suggestions/suggestions/310712-plinq-and-tpl?ref=title 回答2: http://portabletpl.codeplex.com/ PortableTPL is a portable project inspired by the Task Parallel Library. It can be used with .Net 4.0, Silverlight 4.0, XNA 4.0