Questions tagged [plinq]
PLINQ is a parallel query execution engine for LINQ. PLINQ supports the data parallelism pattern by adding additional syntax to allow queries to be declared as running in parallel.
plinq
369
questions
-1
votes
1
answer
102
views
How to get results from List<T>.AsParallel() in C#
I have an asynchronous
async static public Task<int> Test(int x, int y)
{
await Task.Delay(1000);
return x;
}
And I try to run it in parallele on a list. I did like that:
var x = new[] { ...
4
votes
2
answers
250
views
Why does ToList() make a sorted order?
When I execute the following code:
using static System.Console;
var numbers = ParallelEnumerable.Range(0, 50);
WriteLine("\nNumbers divisible by 5 are:");
var divisibleBy5 = numbers
....
4
votes
0
answers
105
views
PLINQ behaves differently in .NET 8
Run the following code:
using System;
using static System.Console;
var numbers = Enumerable.Range(0, 31);
WriteLine("\nNumbers divisible by 5 are(using LINQ):");
numbers
.Where(num => ...
0
votes
0
answers
63
views
Is there a way to dynamically change DegreeOfParallelism in a PLINQ query?
I want to convert a large array of objects in parallel using PLINQ.
var outputs = inputs
.AsParallel()
.AsOrdered()
.WithDegreeOfParallelism(8) // make this number dynamic
.Select(...
0
votes
0
answers
49
views
How to trace ETW Events inside Parallel.ForEach in C#
Need your help to understand how can we log ETW events to track Task started & Task completed inside parallel.foreach. I basically need to see when event got fired.
I have gone through few ...
4
votes
3
answers
741
views
Using a partitioner in C# to parallel query a REST-API with pagination
I was wondering if my approach is good to query a REST-API in parallel because there is a limit on how many results can be obtained with one request (1000). To speed up things I want to do this in ...
2
votes
2
answers
242
views
PLINQ ForAll WithCancellation is not working
I wrote a PLINQ query that ends with the ForAll operator, and I used the WithCancellation operator in order to cancel the query midway. Surprisingly the query is not canceled. Here is a minimal ...
3
votes
2
answers
144
views
Exception is lost while consuming a PLINQ query
I observed a weird behavior while experimenting with a PLINQ query. Here is the scenario:
There is a source IEnumerable<int> sequence that contains the two items 1 and 2.
A Parallel LINQ Select ...
1
vote
1
answer
198
views
Find all the child nodes from self referenced DataTable using parent ID and update particular column on a bulk data
I have a self-referenced table like below.
key
parent
Description
A
NULL
B
A
C
B
D
C
And initially having 1 Key value.
Using this key value, I need to find all the child nodes recursively and ...
2
votes
1
answer
218
views
How to create a custom grouped / hashed PLINQ partitioner or parallel query
I am trying to process a list of file paths in parallel using PLINQ.
I have to process all files with the same name, excluding extension, in the same thread, as that thread may be renaming file ...
2
votes
2
answers
288
views
Memory leak in using PLinq AsParallel
I wrote a piece of testing code using AsParallel to concurrently read big files. It causes memory leak. It seems GC doesn’t recycle the unused objects as expected. Please see the code snippet.
...
2
votes
1
answer
244
views
PLINQ vs Sync Over Async: what is the difference?
I love PLINQ. In all of my test cases on various parallelization patterns, it performs well and consistently. But I recently ran into a question that has me a little bothered: what is the functional ...
0
votes
0
answers
31
views
Conditionally use PLINQ with minimal code duplication [duplicate]
I have some LINQ code that under some conditions, which I can test for, benefits from parallelization.
I would like to use PLINQ when such conditions apply, but also avoid to have all the processing ...
0
votes
1
answer
188
views
Converting Parallel ForEach into PLINQ to process list of Tasks [closed]
I am trying to load as many messages into a server fast as possible. I currently have this bit of code and to load 50000 messages to a MessagingServer it takes around 5 minutes. This is a list of ...
0
votes
0
answers
120
views
IQueryable (PLINQ) peek and group Linq methods to run in different tasks
I want to divide a IQueryable into several ones, like the image below, extracted from the explanation of the .AsParallel(). But instead of running all in parallel, I want to run some of them together, ...