I understand the concept but using task.delay() isn't a very good example here. using a discard _ = with Task.Delay() should cause the code to move to the next line immediately because it's not being awaited and the delay should spawn on another thread if there is one available in the thread pool. This should not contribute to the elapsed time of the calling function at all nor should it hold up a thread in the thread pool because Task.Delay() simply returns the execution back to the thread pool until the delay time has elapsed. maybe if you had Task.Delay().Wait() that would block the thread but a more obvious way to block a function and the thread it is running on would be to use System.Threading.Thread.Sleep(). Task.Delay() was designed to be a non-blocking operation so forcing it to deliberately block may end up confusing people..
I don't completely understand why the Task.Delay wasn't awaited. Wouldn't it must skip the whole Task and continue to Task.FromResult? It might keep a thread in use in the background I guess, but not a direct problem for that single request.
Its a good effort to make it understand but I guess sample code should be more realistic and informative as using delay is quite obvious to slow up the things.
Great tool!! Thanks for sharing
I understand the concept but using task.delay() isn't a very good example here.
using a discard _ = with Task.Delay() should cause the code to move to the next line immediately because it's not being awaited and the delay should spawn on another thread if there is one available in the thread pool. This should not contribute to the elapsed time of the calling function at all nor should it hold up a thread in the thread pool because Task.Delay() simply returns the execution back to the thread pool until the delay time has elapsed.
maybe if you had Task.Delay().Wait() that would block the thread but a more obvious way to block a function and the thread it is running on would be to use System.Threading.Thread.Sleep(). Task.Delay() was designed to be a non-blocking operation so forcing it to deliberately block may end up confusing people..
I don't completely understand why the Task.Delay wasn't awaited. Wouldn't it must skip the whole Task and continue to Task.FromResult? It might keep a thread in use in the background I guess, but not a direct problem for that single request.
Could you please help me how to find out front end performance issues in .NET desktop application ??
Is there any chance this tool will be available for Xamarin apps?
Its a good effort to make it understand but I guess sample code should be more realistic and informative as using delay is quite obvious to slow up the things.