Want more on PLINQ? Leave a message. Source code available at: github.com/JasperKent/Parallelization Remember to subscribe at kzbin.info/door/qWQzlUDdllnLmtgfSgYTCA And if you liked the video, click the 👍.
@finwwwfinwww46692 жыл бұрын
Could you please make a video of Task vs thread
@CodingTutorialsAreGo2 жыл бұрын
@@finwwwfinwww4669 I'll put it on the list.
@根本花里子 Жыл бұрын
Thank you very much for adding subtitles! It's very helpful for non-native speakers💛
@Praveen.Kumar.2 жыл бұрын
Happy Friday Sir! Fair and simple into.
@LuciferTheBloody2 жыл бұрын
Good explanation, would be interesting if you went further into performance, as the overhead from Parallel can make it perform slower in many cases.
@paultannenberg44322 жыл бұрын
Great explanation!
@foudilbenouci4826 ай бұрын
Parallel.ForEach(values, (value, _) => { results[value] = Factoriel(value % 20 + 1); usage.AddOrUpdate(Environment.CurrentManagedThreadId, 1, (_, count) => count + 1); } ); is working fine (value is the index) i didn't understand why you introduced the concurentBag collection for this loop
@CodingTutorialsAreGo6 ай бұрын
The 'results' array has to be pre-allocated to the number of results, which in this case, we happen to know. In other circumstances, we might not know the final size, and if we want the collection to expand to fit, it has to be thread safe.
@foudilbenouci4826 ай бұрын
@@CodingTutorialsAreGo clear thank you
@foudilbenouci4826 ай бұрын
The parellisation of the average() method doesn't give the same result : with parallelisation the result is 228150401,23158336 without parallelisation the method the result is 228150401,3512809.So an error is introduced
@CodingTutorialsAreGo6 ай бұрын
I think that's related to the rounding errors one can get with doubles. Without parallelization, the rounding error is consistent, whereas with parallelization there is a degree of randomization, but neither is correct. If you do this with decimals instead of doubles, you consistently get the result 228,150,401.25. This is because the decimal type is explicitly designed to avoid rounding errors. We can verify this is the correct result by looking at the Sum() and Count() of the results, which are: 114,075,200,625,000,000 500,000,000 Cancelling the zeros gives: 114,075,200,625 500 I'm not going to do the full long division, but it's evident this ends in exactly .25.
@foudilbenouci4826 ай бұрын
@@CodingTutorialsAreGo Yes it is related the rounding errors one can get with doubles . If you chunk the list depending on the chunks and their order you wont get nécessarily the exact same result . Thank you
@abelwodulo73652 жыл бұрын
thanks for the guide.
@davidwhite20112 жыл бұрын
Another Friday made better with a Coding Tutorials tutorial.
@benwardle37662 жыл бұрын
very nice!
@djedsonsantos75822 жыл бұрын
hard. The soft soft interface is quite friendly
@CodingTutorialsAreGo2 жыл бұрын
What?
@taddeustentakel8598 Жыл бұрын
Hey great video man! I would only love to ask something in addition, is it SOMEHOW possible to use "Paralell.ForEach(..)" with the newly added "RegexSrcGenerator" so because when i do this code here: Paralell.ForEach(regex.EnumerateMatches(mySpan), (match, _) => { //error cant do that because of it returning an "ValueMatchEnumerator".... });
@CodingTutorialsAreGo Жыл бұрын
Not something I know off the top of my head. I'll take a look if I have time.
@taddeustentakel8598 Жыл бұрын
@@CodingTutorialsAreGo thx brother! have a good time