Weekend is free to have nothing to do, browsing the major video websites is really to find what good programs. Since the video is not good from the point of view of entertainment, let’s look at each video APP from the point of view of technology. From a technical point of view, the topic is still too big to be able to do a comprehensive comparison. I remember a friend once said that all performance problems will become memory problems. Then we will simply analyze the three video apps youku, IQiyi and Tencent Video from the perspective of memory.

Dumpsys command

For Debug apps, you can use the Android Studio Profiler to check the memory usage of the APP. Dumpsys is a tool to check the memory usage of Release apps. Dumpsys runs on Android devices and can be run with adb commands. Dumpsys allows you to obtain the characteristics of all running system services. There are so many system services that you can view the list of services that you can use Dumpsys to view service characteristics.

adb shell dumpsys -l
Copy the code

dumpsys -l
activity
adb shell dumpsys activity activities

The service name role
input Get system input device information, such as keyboard, touch screen, etc
batterystats Obtain power usage information
gfxinfo Get UI rendering information
meminfo Get memory usage information
cpuinfo Get CPU usage information
netstats Get network usage information
1.1 Dumpsys Command syntax

The dumpsys command syntax is also very simple, directly adb shell dumpsys. But this is to get information about all the services, there is a lot of information, in order to filter the information we care about, we need to follow the command after the name of the service we care about. If today we are focused on memory and the corresponding service name is meminfo, the command would be ADB shell Dumpsys meminfo. This command gets the memory usage of all processes on the device. Today we focus on the memory of three Apps of Youitun, so we have to add the process name after the command to filter adb shell dumpsys meminfo com.youku.phone

1.2 Dumpsys Output information parsing

As shown above, the Pss Total and Private Dirty columns are generally concerned with memory information. These are two different ways of counting memory.

Private (Clean and Dirty) RAM Private memory. In this method, only the memory that is exclusively used by the current process is counted. The sum of the Private Clean and Private Dirty memory is the memory that is exclusively used by the current process. Dirty RAM refers to data that must be stored in memory, such as variable data during program execution. Things in this part of memory must be kept in memory until they become garbage. Clean RAM is data loaded from a persistent file, such as code loaded during program execution, that can be thrown away and reloaded from the persistent file when used again.

Proportional Set Size (PSS) Proportional Set Size. Proportional Set Size (PSS) Sums the memory that is shared by processes and other processes through shared pages. A common use of shared memory is to share “code” memory pages (areas of memory that load read-only executable code) between processes. For example, external libraries and JVM executable code are stored in areas of memory that can be safely shared across processes. The shared memory is allocated to each process based on the number of shared processes.

It is also worth mentioning that the Objects field lists the number of Objects that are alive in the current process, which is also useful for analyzing memory leaks. For example, ViewRootImpl represents the number of root views alive in the current process. ViewRootImpl corresponds to window one by one. From the number of ViewRootImpl, we can also analyze whether there are memory leaks caused by dialog or other Windows.

Two, superior Iteng memory comparison

APP The package name version
youku com.youku.phone 7.6.7
iQIYI com.qiyi.video 10.2.0
Tencent video com.tencent.qqlive 6.8.0

Above is the version of the APP used for the test. To compare the size of the memory requested by the application itself, we list Private Dirty, Private Clean, their and Private Total. The following three scenarios were verified:

  1. Open the APP and enter the home page without doing any operation.
  2. Measure memory data after sliding down more than 10 screens on the home page.
  3. Exit the application killing process, re-enter the home page, search in the Name of The People, click episode 01 to enter the playing page, close the bullet screen, play HD resources in full screen, measure the memory data one minute later; The measurements are as follows, all in kilobytes.

The above is the memory comparison diagram of the three apps in different scenarios. To achieve the same function, the lower the memory consumption, the better. It can be seen that Youku is the most efficient in the use of memory on the home page, while IQiyi’s player is the best in the use of memory. Another point is that iQiyi has the smallest use of Private Clean in every stage.