Chapter 12. Making your app run fast

 

This chapter covers

  • Preloading data
  • Treating multiple operations as one
  • Performing multiple operations simultaneously

In the last chapter, I showed you actions you can take before and during app startup to improve its responsiveness. In this chapter, I’ll continue this theme and look at ways to improve the speed and responsiveness of an app while in use. Specifically, I’ll cover three techniques:

  • Eager loadingLets people avoid having to wait for data to be retrieved.
  • Combining requests and responsesFewer requests take less time.
  • Making asynchronous requestsReduces the time spent waiting.

In this chapter, I’ll also introduce you to Elliott. He has a shopping app where the primary use case involves finding items through a search function. I’ll show you how he used each of the three techniques to address the following challenges:

  • Search results that can’t be preloaded
  • Returning results slowly, leading to less use and fewer sales
  • A chatty functionality with lots of requests and responses
  • The need to retrieve data from multiple sources

12.1. Using eager loading so people don’t have to wait

12.2. Parallel operations take less time

12.3. Combining requests for improved speed and control

Summary