Parallelization and PLINQ

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

Coding Tutorials

Coding Tutorials

Жыл бұрын

Modern processors achieve speed through multiple cores. It's up to developers to exploit them properly.
Source code available at github.com/JasperKent/Paralle...
Topics include:
- Parallelization in C# and .NET
- Parallel.For
- Parallel.ForEach
- ConcurrentDictionary
- ConcurrentBag
- AsParallel()
- Multithreading
- Parallel processing

Пікірлер: 21
@CodingTutorialsAreGo
@CodingTutorialsAreGo Жыл бұрын
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 Жыл бұрын
Could you please make a video of Task vs thread
@CodingTutorialsAreGo
@CodingTutorialsAreGo Жыл бұрын
@@finwwwfinwww4669 I'll put it on the list.
@user-rd2dy4bs4h
@user-rd2dy4bs4h 8 ай бұрын
Thank you very much for adding subtitles! It's very helpful for non-native speakers💛
@paultannenberg4432
@paultannenberg4432 Жыл бұрын
Great explanation!
@Praveen.Kumar.
@Praveen.Kumar. Жыл бұрын
Happy Friday Sir! Fair and simple into.
@LuciferTheBloody
@LuciferTheBloody Жыл бұрын
Good explanation, would be interesting if you went further into performance, as the overhead from Parallel can make it perform slower in many cases.
@abelwodulo7365
@abelwodulo7365 Жыл бұрын
thanks for the guide.
@benwardle3766
@benwardle3766 Жыл бұрын
very nice!
@foudilbenouci482
@foudilbenouci482 21 күн бұрын
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 19 күн бұрын
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 19 күн бұрын
@@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
@foudilbenouci482
@foudilbenouci482 21 күн бұрын
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 19 күн бұрын
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 19 күн бұрын
@@CodingTutorialsAreGo clear thank you
@davidwhite2011
@davidwhite2011 Жыл бұрын
Another Friday made better with a Coding Tutorials tutorial.
@djedsonsantos7582
@djedsonsantos7582 Жыл бұрын
hard. The soft soft interface is quite friendly
@CodingTutorialsAreGo
@CodingTutorialsAreGo Жыл бұрын
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
Configuring PLINQ
21:56
Coding Tutorials
Рет қаралды 1,8 М.
What Are You Awaiting For?
21:39
Coding Tutorials
Рет қаралды 4 М.
Is it Cake or Fake ? 🍰
00:53
A4
Рет қаралды 17 МЛН
WHY IS A CAR MORE EXPENSIVE THAN A GIRL?
00:37
Levsob
Рет қаралды 21 МЛН
Китайка и Пчелка 4 серия😂😆
00:19
KITAYKA
Рет қаралды 3,6 МЛН
She ruined my dominos! 😭 Cool train tool helps me #gadget
00:40
Go Gizmo!
Рет қаралды 22 МЛН
Making LINQ Blazing fast with PLINQ (Parallel LINQ) | .NET & C# Essentials
36:26
8 await async mistakes that you SHOULD avoid in .NET
21:13
Nick Chapsas
Рет қаралды 308 М.
Stackalloc and Spans
30:17
Coding Tutorials
Рет қаралды 9 М.
Master C# async/await with Concurrency Like a Senior
42:54
Tural Suleymani
Рет қаралды 7 М.
C# Covariance
17:27
Coding Tutorials
Рет қаралды 7 М.
Multithreading Code - Computerphile
15:54
Computerphile
Рет қаралды 378 М.
Use Arc Instead of Vec
15:21
Logan Smith
Рет қаралды 134 М.
C# async, await and Task
16:26
Coding Tutorials
Рет қаралды 6 М.
i love you subscriber ♥️ #iphone #iphonefold #shortvideo
0:14
Si pamerR
Рет қаралды 2,8 МЛН
Хотела заскамить на Айфон!😱📱(@gertieinar)
0:21
Взрывная История
Рет қаралды 851 М.
Купил этот ваш VR.
37:21
Ремонтяш
Рет қаралды 154 М.
i like you subscriber ♥️♥️ #trending #iphone #apple #iphonefold
0:14