Udostępnij za pośrednictwem


Performance best practices for Windows Store apps using C++, C#, and Visual Basic

Windows 8 users expect their apps to remain responsive and feel natural when they use them. Therefore, good performance is a must for a Windows Store app using C++, C#, or Visual Basic. One way to think of performance is in terms of user experiences. For example, a common experience is app startup performance. You might consider a start time of less than one second to be excellent, less than 5 seconds to be good, and greater than 5 seconds to be poor.

We describe some common user experiences and list the performance topics that are important to consider for each experience. If you find that you need to improve the performance of your app during one of the experiences listed, consult the topics for that experience. Note that a topic can be listed under multiple experiences.

Be sure to read General best practices for performance to learn how to plan for and test your app's performance.

Startup

We already mentioned that an app's startup time is a common user experience. In fact, users go through this experience with any app. The time your app takes to start gives your users the first impression of its performance. You can improve the startup experience of your app by focusing on these goals.

Animation

When used well, animations make an app seem richer and more natural. Even subtle animations, which the user barely notices, can enhance an app's experience. But it's important that animations don't get in the way of the user interacting with the app. For example, a user shouldn't have to wait for an animation to complete to perform a task. Keep these goals in mind to ensure that the animations in your app are pleasant to experience.

Panning and scrolling the UI

It's common to have scrollable parts of the UI so that a user can view more info. In Windows Store apps, it's important that panning and scrolling appears smooth and natural to the user. For example, if the user pans with a finger, the UI should appear to follow the finger. To ensure that the panning and scrolling experience is natural, follow these practices.

Windows 8.1 introduces improvements that dramatically increase the panning and scrolling performance of the XAML GridView and ListView controls:

For more info, see these samples:

Some apps organize the UI into multiple pages for the user to move between them. To improve performance when the user navigates between pages, we recommend that you:

Viewing media

Apps often contain videos and images to provide richer content. Media files are some of the most common and expensive resources than an app might use, so it's important to manage them wisely. To get better performance when your app uses media, be sure to Optimize media resources.

App lifetime

When users move your app off-screen, Windows 8 suspends the app in memory so that users can switch back to it quickly. When users bring your app back to the foreground, they expect the app to resume where they left off, as if the app had been running in the background. When an app is suspended and stays in the system's memory, it can quickly be brought to the foreground for the user to interact with. If the app is terminated, it has to restart later and display a splash screen or perform a lengthy load operation. To improve the way your app suspends and resumes, we recommend that you:

Working with data

A lot of apps let the user view and manipulate some data. If you're not careful, an app that deals with large amounts of data can seem slow and unresponsive. To improve performance when your app works with large sets of data, we recommend that you:

Planning

Plan for performance

UX patterns

Index of UX guidelines for Windows Store apps

UX checklist for Windows Store apps

Guidelines

Guidelines for location-aware apps

Guidelines for geofencing apps

Tools

Analyze the performance of Windows Store apps

Windows Performance Toolkit Technical Reference

Debugging and testing

Using the Windows App Certification Kit

Windows Store app test cases