Power Pages

Optimising the performance of Dataverse Image columns in Power Pages

First of all, I love the idea of Dataverse image columns in Power Pages. Having structured data around our images, being able to easily output in lists and forms or retrieve with fetch XML / the entities object for custom UI work, etc. All good… in theory. See my post here for why I think they’re so awesome

Gotcha!

via GIPHY

The main drawback has always been the slow performance compared to the other image sources available to us; note attachments, Azure blob or even images hosted on an external service like ImageKit.

Why so slow?
Using the image URL provided in liquid gets the image from a download.aspx endpoint and that round-trip is typically slow.

The experiment

My goal
Find the fastest performance for minimal effort in a way that’s beginner-friendly and easily reusable between projects.

I experimented with various things;

  • Lazy loading
  • Decoding asynchronously
  • Retrieving with the web API and JavaScript and then appending to the page
  • Retrieving the image as a file vs base64

Test results – for the nerdy among us…

144px x 144px thumbnails with download.aspx
A total of 8.37 seconds. The worst performance there being 2.98s for a 144px x 144px image!

Screenshot of browser developer tools for experiment 1

144px x 144px thumbnails with direct links and the web API
A total of 3.78 seconds… less than half the time to retrieve the exact same images

Screenshot of browser developer tools for experiment 2

Full size images with download.aspx
10.24 seconds

Full size images with direct links and the web API
5.36 seconds

Screenshot of browser developer tools for experiment 4

And the winner is…

Using the web API URL, we can link directly to the image without the delay of download.aspx. This is what proved to be the fastest in my testing.

Here’s an example of the image source format:
Before (as provided by Fetch XML or entities object and used in form / list output):
https://propilot-prep.powerappsportals.com/Image/download.aspx?Entity=pp_pilots&Attribute=pp_picture&Id=a2959f59-e56e-ef11-a670-0022480a94ca

After
/_api/pp_pilotses(a2959f59-e56e-ef11-a670-0022480a94ca)/pp_picture/$value?size=full

With that, I found that the API and using direct links could serve me full sized images faster than download.aspx could serve me the 144px x 144px thumbnail! 😎

Conclusion

Although it’s slightly more effort including the web API and crafting the URLs ourselves, the performance gains are well worth it. (See here for how to include and authenticate with the web API)

Looking for more pro Power Pages tips and techniques?
Check out our pre-day workshop on 15th September at Power Platform Community Conference, Vegas where I join forces with Ulrikke Akerbaek, Victor Dantas, Nick Doelman to bring you a 1 day intensive designed to get you from zero to hero in record time.
Later in September, where joining forces again for a pre-day workshop at Nordic Summit
Finally, check out my flagship course at https://francomusso.com/power-pages-course for the ultimate hands-on project-based most actionable Power Pages course known to man or AI!
Franco Musso

You may also like

Leave a reply

Your email address will not be published.

More in Power Pages