Questions tagged [parallel-extensions]

Parallel Extensions is a managed concurrency library included in the .NET 4.0 release.

Parallel Extensions is a managed concurrency library included in the .NET 4.0 release. It is composed of two parts: Parallel LINQ (PLINQ) and Task Parallel Library (TPL).

124 questions
3
votes
3 answers

In parallel call, limit executions per second

Using TPL / Parallel.ForEach is there an out-of-the-box way to limit the number of times a method is called per unit of time (i.e. no more than 50 calls per second). This is different than limiting the number of threads. Perhaps there's some…
3
votes
3 answers

Weird behavior when using Parallel.Invoke and static variable

I'm trying to test the C# parallel methods and this is my test program: class Program { static int counter; static void Main(string[] args) { counter = 0; Parallel.Invoke( () => func(1), () =>…
Stasel
  • 1,298
  • 1
  • 13
  • 26
3
votes
1 answer

Parallel inner join

I want to perform inner join between products and categories with using PLINQ. But I'm not sure if I should call AsParallel method for both collections. // PLINQ - Option 1 jointTables = from c in Homework02.categories.AsParallel() …
3
votes
2 answers

Are lambda faster than linq queries?

Iam playing with lambda, linq and parallel and one question arrives. Is lambda faster than linq queries? O write some test code (Fork it in GitHub) and the lambda method seems faster. It is true or i am missing something?
Ewerton
  • 4,046
  • 4
  • 30
  • 56
3
votes
2 answers

Java parallel execution on multicore

i would like to know whether exist a way to parallelize queries in Java (or there is framework or a library) like in C# and Linq: var query = from item in source.AsParallel().WithDegreeOfParallelism(2) where Compute(item) > 42 select…
FrankTan
  • 1,626
  • 6
  • 28
  • 63
3
votes
3 answers

Can I TryTake a group of items from a BlockingCollection?

In an application I'm working on, thousands of updates are being received per second. Reflecting these updates on the UI immediately and one by one is performance overkill. The following code yields very bad performance, because handling each update…
3
votes
4 answers

Parallel Extensions Equivalent in Java

I have some experience using parallel extensions in .Net development, but I was looking at doing some work in Java that would benefit from an easy to use parallelism library. Does the JVM offer any comparable tools to parallel-extensions?
pnewhook
  • 4,048
  • 2
  • 31
  • 49
2
votes
1 answer

How do I execute multiple Tasks using Task Parallel Library and return after the first one to actually return data

I am working on an application in which getting data back to a serial process as fast as possible is important, but there can be multiple sources to get that data from. As well, sometimes one source is faster than the other, but you don't know which…
Royi Hagigi
  • 240
  • 1
  • 10
2
votes
1 answer

Execute single workflow instance in parallel

Let's say I have a workflow, and I want to execute it many times in parallel: System.Threading.Tasks.Parallel.For( 0, 100, i => WorkflowInvoker.Invoke( new Workflow1(), new Dictionary { { "Num", i }…
2
votes
2 answers

VB.NET 4.0 Parallel.ForEach AddressOf Multiple Values?

I am trying change from Delegates to Parallel.ForEach I see the below works fine. Imports System.Threading.Tasks Sub Main() Dim secs() As Integer = {2, 3, 1} Parallel.ForEach(secs, AddressOf Method2) End Sub Sub Method2(ByVal i As…
Jasin
  • 425
  • 1
  • 6
  • 17
2
votes
2 answers

Process a list of items using multiple, limited number of threads

Basically, I want to process a list of items in multiple threads instead of one at a time. I only want a limited number of threads going at a time. Does this approach make sense? Is using a global variable for the thread count the only option? …
Ed Manet
  • 3,118
  • 3
  • 20
  • 23
2
votes
1 answer

Is this PLINQ bug?

Why PLINQ output is different than sequential processing and Parallel.For loop I want to add sum of square root of 10,000,000 numbers.. Here is the code for 3 cases: sequential for loop: double sum = 0.0; for(int i = 1;i<10000001;i++) sum +=…
2
votes
1 answer

Parallel Brute-Force Algorithm

So I was looking at http://codahale.com/how-to-safely-store-a-password/# and became curious how fast different hash could be bruteforced on a somewhat powerful desktop computer and was tempted to test it Most of the algorithms I've seen though are…
Homde
  • 4,246
  • 4
  • 34
  • 50
2
votes
1 answer

Slow Parallel.For interruption

I have the following code inside a bigger loop, after profiling my code I discovered that all the Parallel.For gain in execution speed is lost in the long time the Stop() method takes to complete. Is there any way to improve this? Maybe calling…
abenci
  • 8,422
  • 19
  • 69
  • 134
2
votes
1 answer

(Fluent) Nhibernate lazy loading and affects on Parallel.ForEach

I have several entities configured via FNH to eager load child entities using the FetchMode.Eager syntax when I request instances (from the database). Now I was under the impression this would ignore any lazy loading in the mapping and populate the…
AwkwardCoder
  • 24,893
  • 27
  • 82
  • 152
1 2 3
8 9