Click here to Skip to main content
15,897,518 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionBrowsing website on blackberry Pin
neer112-Mar-10 2:53
neer112-Mar-10 2:53 
AnswerRe: Browsing website on blackberry Pin
Dave Kreskowiak12-Mar-10 3:15
mveDave Kreskowiak12-Mar-10 3:15 
QuestionAnyone know how you can create a screen that looks like the Outlook calendar 2007 Pin
RadyShishi12-Mar-10 1:38
RadyShishi12-Mar-10 1:38 
AnswerRe: Anyone know how you can create a screen that looks like the Outlook calendar 2007 Pin
Eddy Vluggen12-Mar-10 2:26
professionalEddy Vluggen12-Mar-10 2:26 
Questionparallel processing Pin
Tiju John11-Mar-10 23:31
Tiju John11-Mar-10 23:31 
AnswerRe: parallel processing Pin
Eddy Vluggen12-Mar-10 1:01
professionalEddy Vluggen12-Mar-10 1:01 
GeneralRe: parallel processing Pin
Tiju John12-Mar-10 3:16
Tiju John12-Mar-10 3:16 
AnswerRe: parallel processing Pin
Dave Kreskowiak12-Mar-10 2:00
mveDave Kreskowiak12-Mar-10 2:00 
You've run into the little problem of overhead and you've approached your problem incorrectly.

First, finding the primes of the first 100000 integers takes far less time than setting up the range partitioner (by default on IList and arrays) and grabbing an extra thread out of the pool to run your code.

You've also parallelized the outside loop that runs two (3 in this case) copies of the 1 through 100000 range instead of parallelizing the range itself. What you've done is really just forced this into a Task situtation and used Parallel to do it. This is not what Parallel was designed for.

It should look more like:

var primes = from c in Enumerable.Range(1, 10000000).AsParallel Select IsPrime(c)


Sorry, if this doesn't really compile, I'm translating from VB.NET to C# having never done LINQ in C#.

A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008
But no longer in 2009...




GeneralRe: parallel processing Pin
Tiju John12-Mar-10 3:20
Tiju John12-Mar-10 3:20 
GeneralRe: parallel processing Pin
Dave Kreskowiak12-Mar-10 5:09
mveDave Kreskowiak12-Mar-10 5:09 
AnswerRe: parallel processing Pin
frito_burrito12-Mar-10 4:39
frito_burrito12-Mar-10 4:39 
GeneralRe: parallel processing Pin
harold aptroot12-Mar-10 5:15
harold aptroot12-Mar-10 5:15 
GeneralRe: parallel processing Pin
Luc Pattyn12-Mar-10 6:15
sitebuilderLuc Pattyn12-Mar-10 6:15 
GeneralRe: parallel processing Pin
harold aptroot12-Mar-10 6:35
harold aptroot12-Mar-10 6:35 
GeneralRe: parallel processing Pin
Luc Pattyn12-Mar-10 6:49
sitebuilderLuc Pattyn12-Mar-10 6:49 
GeneralRe: parallel processing Pin
harold aptroot12-Mar-10 7:04
harold aptroot12-Mar-10 7:04 
GeneralRe: parallel processing Pin
Luc Pattyn12-Mar-10 7:43
sitebuilderLuc Pattyn12-Mar-10 7:43 
GeneralRe: parallel processing Pin
harold aptroot12-Mar-10 7:47
harold aptroot12-Mar-10 7:47 
GeneralRe: parallel processing Pin
Luc Pattyn12-Mar-10 7:53
sitebuilderLuc Pattyn12-Mar-10 7:53 
GeneralRe: parallel processing Pin
harold aptroot12-Mar-10 8:01
harold aptroot12-Mar-10 8:01 
GeneralRe: parallel processing Pin
Dave Kreskowiak12-Mar-10 8:09
mveDave Kreskowiak12-Mar-10 8:09 
GeneralRe: parallel processing Pin
Luc Pattyn12-Mar-10 8:37
sitebuilderLuc Pattyn12-Mar-10 8:37 
GeneralRe: parallel processing Pin
Dave Kreskowiak12-Mar-10 8:51
mveDave Kreskowiak12-Mar-10 8:51 
GeneralRe: parallel processing Pin
Luc Pattyn12-Mar-10 9:19
sitebuilderLuc Pattyn12-Mar-10 9:19 
Question[vb.net 2008] How get mp3 title,author and lenght ? Pin
nRush11-Mar-10 21:52
nRush11-Mar-10 21:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.