Which way of displaying images offers better performance?

I'm having an issue with performance when displaying a lot of images in a winRT app. So i've come here for some help. For regular bitmaps, which way is better for memory management?

bitmapImage = new BitmapImage(); bitmapImage .UriSource = new Uri(this.BaseUri, pathToImage); 

OR

using (Stream picture = await InstallationFolder.OpenStreamForReadAsync(storageFileOfImage)) { await bitmapImage.SetSourceAsync(picture.AsRandomAccessStream()); picture.Dispose(); } 

Bonus question: what is the best way for displaying animations like gifs? I've tried putting them in a webview and performance was decent, but memory usage would skyrocket with more images until the app crashed. the alternative was to render them using this package: http://ift.tt/1xo15Ee and memory management was ebtter, but cpu usage was out of control and couldnt get as many gifs rendered as just using a webview. I've also tried making them mp4 and rendering them as media elements but, again, performance wasn't great.

by ducttape36 via /r/csharp

Leave a Reply