0

I'm working on a UWP app that is showing videos, images & XAML animations. The content displayed is being updated from time to time by pushing updates from the server to the app through grpc.

When updates happen the app will need to download new assets like potentially big video files. While this happens it is important that the UI does not get any negative impact and the fps remain stable.

From what I've read so far it can help to wrap the download operation inside a Task.Run() instead simply awaiting the HttpClient call to not affect the UI thread.

Would there be any additional performance improvements if I'd move the download operation to a background service altogether? Or would this be unnecessary overhead? (I don't need downloads to work while the app is not running.)

Thomas
  • 4,030
  • 4
  • 40
  • 79
  • 1
    `HttpClient` is `async`, i.e. it won't block the calling thread during the time it takes to fetch the remote data. There is no reason to use a background thread to make a RPC call. – mm8 Nov 04 '19 at 14:19
  • From this post "Using async await does not block the UI, but still it is running on the UI thread, so it is making it laggy." https://stackoverflow.com/questions/18013523/when-correctly-use-task-run-and-when-just-async-await Not sure if downloading big files puts a noticable amout of load on the CPU though – Thomas Nov 04 '19 at 16:12
  • Our team member has replied your same case in Microsoft [Q&A](https://learn.microsoft.com/answers/questions/835/uwp-performance-taskrun-vs-background-service.html), please pay a attention to that case following update. – Nico Zhu Nov 06 '19 at 07:06

0 Answers0