Parallelization and PLINQ

  Рет қаралды 6,830

Coding Tutorials

Coding Tutorials

Күн бұрын

Пікірлер: 21
@CodingTutorialsAreGo
@CodingTutorialsAreGo 2 жыл бұрын
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 👍.
@finwwwfinwww4669
@finwwwfinwww4669 2 жыл бұрын
Could you please make a video of Task vs thread
@CodingTutorialsAreGo
@CodingTutorialsAreGo 2 жыл бұрын
@@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.
@Praveen.Kumar. 2 жыл бұрын
Happy Friday Sir! Fair and simple into.
@LuciferTheBloody
@LuciferTheBloody 2 жыл бұрын
Good explanation, would be interesting if you went further into performance, as the overhead from Parallel can make it perform slower in many cases.
@paultannenberg4432
@paultannenberg4432 2 жыл бұрын
Great explanation!
@foudilbenouci482
@foudilbenouci482 6 ай бұрын
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
@CodingTutorialsAreGo
@CodingTutorialsAreGo 6 ай бұрын
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.
@foudilbenouci482
@foudilbenouci482 6 ай бұрын
@@CodingTutorialsAreGo clear thank you
@foudilbenouci482
@foudilbenouci482 6 ай бұрын
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
@CodingTutorialsAreGo
@CodingTutorialsAreGo 6 ай бұрын
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.
@foudilbenouci482
@foudilbenouci482 6 ай бұрын
@@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
@abelwodulo7365
@abelwodulo7365 2 жыл бұрын
thanks for the guide.
@davidwhite2011
@davidwhite2011 2 жыл бұрын
Another Friday made better with a Coding Tutorials tutorial.
@benwardle3766
@benwardle3766 2 жыл бұрын
very nice!
@djedsonsantos7582
@djedsonsantos7582 2 жыл бұрын
hard. The soft soft interface is quite friendly
@CodingTutorialsAreGo
@CodingTutorialsAreGo 2 жыл бұрын
What?
@taddeustentakel8598
@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
@CodingTutorialsAreGo Жыл бұрын
Not something I know off the top of my head. I'll take a look if I have time.
@taddeustentakel8598
@taddeustentakel8598 Жыл бұрын
@@CodingTutorialsAreGo thx brother! have a good time
The Dispose Pattern
16:28
Coding Tutorials
Рет қаралды 10 М.
AWS Certified Cloud Practitioner Training 2020 - Full Course
3:58:01
freeCodeCamp.org
Рет қаралды 7 МЛН
А я думаю что за звук такой знакомый? 😂😂😂
00:15
Денис Кукояка
Рет қаралды 4,5 МЛН
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 230 МЛН
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 30 МЛН
Making LINQ Blazing fast with PLINQ (Parallel LINQ) | .NET & C# Essentials
36:26
Multithreading Code - Computerphile
15:54
Computerphile
Рет қаралды 388 М.
.NET Core Garbage Collection
14:54
Coding Tutorials
Рет қаралды 25 М.
8 await async mistakes that you SHOULD avoid in .NET
21:13
Nick Chapsas
Рет қаралды 315 М.