Тёмный

Understanding how to use Task and ValueTask 

Microsoft Developer
Подписаться 537 тыс.
Просмотров 27 тыс.
50% 1

Understanding the Whys, what’s, and when’s of ValueTask
devblogs.microsoft.com/dotnet...
ValueTask reference docs
docs.microsoft.com/en-us/dotn...
NuGet package for ValueTask
www.nuget.org/packages/System...
In this episode, Stephen Toub chats with Rich about ValueTask and how it might help reduce allocations and memory usage for your asynchronous .NET code.
[00:34] - What is ValueTask and why do we need it?
[05:22] - What is a good scenario for ValueTask?
[10:00] - What is IValueTask?
[12:14] - Why was the non-generic ValueTask introduced?
[13:54] - Does ValueTask offer cancellation?
[14:42] - What can you do with Task vs ValueTask?
[16:28] - What’s the uptake with ValueTask usage?
[18:28] - How does IAsyncEnumerable task advantage of ValueTask?
[21:11] - What other performance work is happening around allocations?

Наука

Опубликовано:

 

1 июл 2019

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 15   
@Jason_Shave
@Jason_Shave 5 лет назад
I generally learn most from these when you have some code examples to go along with the discussion. It's very difficult to understand the examples without any reference. Consider doing another video with the various code scenarios Rich has provided (there are many!).
@AdamsTaiwan
@AdamsTaiwan 5 лет назад
I agree. You might like this video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-nK54s84xRRs.html
@AnitShrestha
@AnitShrestha 4 года назад
@@AdamsTaiwan I had just went through the video and was going to mentioned it. The presentation by Matt is excellent!
@guibirow
@guibirow 5 лет назад
Amazing stuff! This is the kind of topic you have to watch and re-watch a few times to grasp very well. I have read the blog post previously and the video helped a lot to understand some grey areas that I haven't understand properly. The video probably would be 1h long or more to talk through everything. Thanks again!
@philipmrch8326
@philipmrch8326 5 лет назад
This is exactly what I needed haha, thanks for the great content as always!
@CrazySpin3
@CrazySpin3 5 лет назад
I subscribed! Nice video and very informative
@saadbinsami4801
@saadbinsami4801 2 года назад
Hi, Can you guys do a comparative analysis on Memory and T [ ] ?
@mAcCoLo666
@mAcCoLo666 2 года назад
How can the data be already there without a cache? If I make the same httpcall twice, the call will be async both times, will it not?
@AdamsTaiwan
@AdamsTaiwan 5 лет назад
Would like to see more examples. I have an app that takes a snapshot of folders/files(with hash codes) on an external drive, saves it to a DataSet then saves it to file or DB. To update I have 2 passes , first pass looks for files in the dataset that have been removed. Second pass checks file system for new or modified files. When I don't have access to the external drive, I can load the DataSet and perform searches or check to see if a set of files on my local drive exist in the DataSet. I'm looking for ways to speed up the process wherever I can.
@MorningSire
@MorningSire 2 года назад
Oh I get it, so ValueTask means value/vask, not a value (type) task :\ I was damn confused about this name for a while
@ZintomV1
@ZintomV1 3 года назад
I don't understand, why provide an Async method that returns ValueTask if you know it's always going to return Synchronously? Why not just use a synchronous method instead.
@ehsanehsani2809
@ehsanehsani2809 2 года назад
Imagine your ValueTask is run 99% sync and 1% async. for example you read a file once and after that others use it synchronously, you may not want to block your thread for that 1% time.
@kenichimori8533
@kenichimori8533 5 лет назад
Multi Value Tasks.
@georgechakhidze8698
@georgechakhidze8698 4 года назад
Marc Gravel of StackOverflow disagrees, "Prefer ValueTask to Task": blog.marcgravell.com/2019/08/prefer-valuetask-to-task-always-and.html
@nenadvicentic
@nenadvicentic 3 года назад
That blog post did not consider all edge cases (e.g. `Task.WaitAny/WaitAll`, unknown `IValueTaskSource` implementation). And even with it's narrow analysis, conclusion is lame "always use, even when breaking API, but don't await twice". I'm sure Stephen Toub who wrote most of the TPL and `ValueTask` knows a bit more about the topic.
Далее
Working with Channels in .NET
27:41
Просмотров 30 тыс.
Task vs ValueTask: When Should I use ValueTask?
10:43
치토스로 체감되는 요즘 물가
00:16
Просмотров 3,7 млн
КАКОЙ У ТЕБЯ ЛЮБИМЫЙ МАРМЕЛАД?
00:40
Stephen Cleary - Asynchronous streams
56:53
Просмотров 12 тыс.
What is Span in C# and why you should be using it
15:15