Page processing method and device and electronic equipment
By compressing and clearing pages with high compression rates in GPU memory when running in the background of electronic devices, the problem of high power consumption in the existing technology is solved, and efficient resource release and system performance are achieved.
Patent Information
- Application Number
- CN202510498360.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-18
- Publication Date
- 2025-07-25
AI Technical Summary
In the prior art, the page compression method consumes a large amount of system power consumption, resulting in an increase in the energy consumption of electronic equipment.
When running in the background of the electronic device, only pages in GPU memory whose compression rate is higher than the first threshold are compressed, and pages whose compression rate is lower than or equal to the first threshold are retained, high compression rate pages are cleared, and invalid compression of low compression rate pages are avoided.
It reduces the consumption of system power consumption, and at the same time releases GPU resources, improving system fluency and resource utilization efficiency.
Smart Images

Figure CN120371445A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of terminals, and particularly relates to a method, apparatus, and electronic device for processing pages. Background Art
[0002] Nowadays, as the functions of application programs in electronic devices such as mobile phones become more and more abundant, during the operation of application programs in electronic devices, more and more Graphics Processing Unit (GPU) memory will be occupied. To avoid memory tension in the GPU, in related technologies, usually when an application program enters the background for operation, all pages of the application program in the GPU memory will be compressed.
[0003] However, since page compression consumes the computing resources of the Central Processing Unit (CPU), it will consume a large amount of system power consumption. Summary of the Invention
[0004] The purpose of the embodiments of this application is to provide a method, apparatus, and electronic device for processing pages, which can solve the technical problem that the existing compression method consumes a large amount of system power consumption.
[0005] In a first aspect, the embodiments of this application provide a method for processing pages, and the method includes:
[0006] When a first application is running in the background of an electronic device and the electronic device does not meet the target compression condition, compress a first page of the first application in the GPU memory to obtain a first compressed page, and retain a second page of the first application in the GPU memory, where the first page is a page with a compression ratio greater than a first threshold, the second page is a page with a compression ratio less than or equal to the first threshold, and the target compression condition is a trigger condition for compressing all pages in the GPU memory;
[0007] Delete the first page.
[0008] In a second aspect, the embodiments of this application provide a device for processing pages, and the device includes:
[0009] A first compression module, configured to compress a first page of a first application in the GPU memory to obtain a first compressed page and retain a second page of the first application in the GPU memory when the first application runs in the background of a page processing device and the page processing device does not meet a target compression condition, where the first page is a page with a compression ratio greater than a first threshold, the second page is a page with a compression ratio less than or equal to the first threshold, and the target compression condition is a trigger condition for compressing all pages in the GPU memory;
[0010] A clearing module, configured to clear the first page.
[0011] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory. The memory stores a program or instruction that can run on the processor. When the program or instruction is executed by the processor, the steps of the method provided in the first aspect are implemented.
[0012] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method provided in the first aspect are implemented.
[0013] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor, and the processor is configured to run a program or instruction to implement the method provided in the first aspect.
[0014] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method provided in the first aspect.
[0015] In the page processing method, device, and electronic device of the present application, when a first application enters the background and the electronic device does not meet the target compression condition, only the first page with a relatively high compression ratio in the GPU memory is compressed to generate a first compressed page, and the original first page is cleared, while the second page with a relatively low compression ratio remains in the GPU memory. By the above method, only the page with a high compression ratio in the GPU memory can be selected for compression, which not only releases GPU resources but also reduces the computing power burden of the electronic device, avoids the ineffective compression of the page with a low compression ratio, and reduces the consumption of system power while ensuring the release of memory space. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 is a flowchart of a page processing method provided by an embodiment of the present application;
[0017] Figure 2 is a schematic structural diagram of a page processing device provided by another embodiment of the present application;
[0018] Figure 3 It is a schematic structural diagram of an electronic device provided by another embodiment of the present application;
[0019] Figure 4 It is a schematic hardware structure diagram of the electronic device provided in the embodiment of the present application. Specific embodiments
[0020] Next, the technical solutions in the embodiments of the present application will be clearly described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present application.
[0021] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such terms can be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are usually of the same category, and the number of objects is not limited. For example, the first object can be one or multiple. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally means an "or" relationship between the associated objects before and after.
[0022] To solve the above technical problems, the present application provides a method for processing a page. Next, in conjunction with the accompanying drawings, the method for processing a page provided in the embodiments of the present application will be described in detail through specific embodiments and their application scenarios.
[0023] As Figure 1 shown, Figure 1 It is a schematic flowchart of a method for processing a page provided by an embodiment of the present application. The embodiment of the present application provides a method for processing a page, and the method may include:
[0024] S101, when the first application is running in the background of the electronic device and the electronic device does not meet the target compression condition, compress the first page of the first application in the GPU memory to obtain a first compressed page, and retain the second page of the first application in the GPU memory, where the first page is a page with a compression ratio greater than a first threshold, the second page is a page with a compression ratio less than or equal to the first threshold, and the target compression condition is a trigger condition for compressing all pages in the GPU memory;
[0025] In this embodiment, the first application is any application program in the electronic device. When the first application runs in the foreground of the electronic device, the first application will occupy GPU memory to store graphic data such as textures, frame buffers, and rendering caches to support the rendering tasks and computing tasks of its interface. When the first application switches to the background for running, the rendering tasks and some computing tasks will pause. Therefore, most of the data in the GPU memory will not be accessed in a short time, and these data can be compressed to release the GPU memory and reduce the system memory pressure.
[0026] However, the data in the GPU memory is stored and managed in the form of pages. Therefore, when the first application switches to the background of the electronic device for running, the data in the GPU memory can be compressed in units of pages.
[0027] Therefore, when the first application switches to the background of the electronic device for running, it can be further determined whether the electronic device meets the target compression condition, where the target compression condition is the trigger condition for compressing all pages in the GPU memory. If the electronic device meets the target compression condition, all pages of the first application in the GPU memory are compressed; if the electronic device does not meet the target compression condition, the first page with a high compression rate in the first application can be selected from the GPU memory for compression, while the second page with a low compression rate is retained. Retaining the second page means that for the second page with an insignificant compression effect, it is not compressed and its original page is directly retained to avoid consuming the system power during the compression process.
[0028] Among them, the compression rate refers to the proportion of the reduction in the size of the data after compression, that is:
[0029] Compression rate = 1 - size after compression / original size
[0030] For example, the original size of a page in a certain GPU memory is 16 KB, and it becomes 4 KB after compression. Then, according to the above formula, the compression rate of this page is calculated to be 75%.
[0031] Specifically, the compression rate of each page can be compared with a preset first threshold. If the compression rate is greater than the first threshold, the page is determined as the first page with a high compression rate and is compressed to obtain the first compressed page after compression. If the compression rate is less than or equal to the first threshold, the page is determined as the second page with a low compression rate and is retained. Among them, the first threshold can be set to 50% or 40%.
[0032] In addition, in some embodiments, the method further includes:
[0033] When the first application runs in the background of the electronic device and the electronic device meets the target compression condition, all pages of the first application in the GPU memory are compressed.
[0034] In this embodiment, when the first application switches to running in the background of the electronic device, it can be further determined whether the electronic device meets the target compression condition. If the electronic device meets the target compression condition, it can be considered that the GPU memory in the electronic device is relatively tight, or the compression ability of the electronic device is relatively good. Therefore, all pages of the first application in the GPU memory can be compressed to maximize the release of video memory space.
[0035] In this way, when the first application switches to running in the background and the electronic device meets the target compression condition, all pages of the first application in its GPU can be compressed, which can maximize the release of GPU memory, effectively relieve the system memory pressure, and thus improve the system fluency.
[0036] In some embodiments, the target compression condition includes any one of the following:
[0037] The available memory in the GPU is less than a third threshold;
[0038] The compression rate of the electronic device is greater than a fourth threshold.
[0039] In this embodiment, the available memory refers to the video memory that is not currently occupied by the GPU, that is, the GPU resources that can still be used for allocation. If the available memory in the GPU is less than the pre-set third threshold, it can be considered that the GPU memory is relatively tight. Therefore, the electronic device meets the target compression condition and all pages in the first application that switches to running in the background need to be compressed to maximize the release of video memory space.
[0040] The compression rate refers to the speed of processing compression tasks and decompression tasks. If the compression rate of the device is higher than the fourth threshold, it means that the system can quickly complete the compression of the data in the GPU memory, and the data compression will not significantly affect the system performance. Therefore, the electronic device meets the target compression condition, and all pages in the first application that switches to running in the background are compressed to maximize the release of video memory.
[0041] Specifically, the compression capabilities of different electronic devices are determined by the platform capabilities of their hardware platforms. Flagship platforms are equipped with GPUs and CPUs with higher computing power. Therefore, flagship platforms have stronger compression and decompression capabilities, and the time taken to compress or decompress a large amount of data is also shorter. Their compression rate is usually greater than the fourth threshold. In contrast, mid - to - low - end platforms have lower computing power, and their compression and decompression capabilities are not as good as those of flagship platforms. Their compression rate is usually less than or equal to the fourth threshold. If an electronic device on a mid - to - low - end platform compresses or decompresses a large amount of data, it takes more time and is prone to jamming. Therefore, electronic devices on flagship platforms usually meet the target compression conditions, while those on mid - to - low - end platforms do not meet the target compression conditions.
[0042] If the available memory in the GPU is greater than or equal to the third threshold, and the compression rate of the electronic device is less than or equal to the fourth threshold, then it can be considered that the available memory in the GPU is sufficient, and the compression rate of the electronic device is slow. Therefore, this electronic device does not meet the target compression conditions, and it is necessary to select the first page with a higher compression rate in the GPU memory for compression and retain the second page with a lower compression rate.
[0043] Through the above method, when the available memory in the GPU is insufficient or the compression rate of the electronic device is high, the first compression can be triggered to ensure that the GPU resources are maximally released when the memory is tight, and to avoid affecting the foreground - running applications due to insufficient video memory. At the same time, on high - performance electronic devices, the high compression rate feature can be fully utilized to maximize the release of GPU resources.
[0044] S102, clear the first page.
[0045] In the embodiments of the present application, after the compression of the first page is completed to obtain the compressed first compressed page, the system will release the original first page, freeing up space in the GPU memory, enabling the system to more efficiently utilize the GPU resources. Since the compression rate of the second page is low, the second page can be retained in the GPU memory to avoid additional CPU computing overhead during subsequent decompression.
[0046] In the present application, when the first application enters the background and the electronic device does not meet the target compression conditions, only the first page with a higher compression rate in the GPU memory is compressed to generate the first compressed page, and the original first page is cleared, while the second page with a lower compression rate remains in the GPU memory. Through the above method, only the page with a high compression rate in the GPU memory can be selected for compression, which not only releases the GPU resources but also takes into account reducing the computing power burden of the electronic device, avoiding the ineffective compression of low - compression - rate pages, and reducing the power consumption of the system while ensuring the release of memory space.
[0047] In some embodiments, the first page is a page associated with a large page identifier, and the second page is a page associated with a small page identifier. The method further includes:
[0048] Compress the third page of the first application, where the third page is a page that is not associated with the large page identifier and is not associated with the small page identifier.
[0049] In this embodiment, before compressing the pages of the first application in the GPU memory, for any page in the first application, the system will first check whether there is a large page identifier or a small page identifier associated with the page. Among them, the large page identifier is used to indicate that the page associated with it has a compression ratio less than or equal to the first threshold, and the small page identifier is used to indicate that the page associated with it has a compression ratio greater than the first threshold.
[0050] Therefore, if there is a large page identifier associated with the page, the page is determined as the second page, and the second page is retained without compressing it; if there is a small page identifier associated with the page, the page is determined as the first page, and the first page is compressed.
[0051] Among them, both the large page identifier and the small page identifier are identifiers added to the page by the system based on the comparison result of the compressed size and the original size of the page when the page is compressed for the first time.
[0052] If a certain page has neither an associated large page identifier nor an associated small page identifier, it can be considered that the page has not been compressed before. Then, the page is determined as the third page, and the third page can be compressed. During the compression process, it is determined whether the third page is the first page or the second page, and the corresponding identifier is added to it.
[0053] In this way, the pages can be classified based on the identifiers associated with the pages, and it can be determined which pages are suitable for compression, thereby avoiding ineffective compression of pages with a low compression ratio and improving the compression efficiency. At the same time, for pages that cannot be pre-classified by identifiers, compression is still performed to ensure the release of GPU resources as much as possible.
[0054] In some embodiments, the compressing the third page of the first application includes:
[0055] During the compression process of the third page, when the size of the compressed page of the third page reaches the second threshold, stop compressing the third page and associate a large page identifier with the third page.
[0056] In this embodiment, for a third page that has neither an associated large page identifier nor an associated small page identifier, it can be compressed, and during the compression process, the size of the already compressed part is continuously checked, that is, the size of the compressed page obtained by compressing the third page is checked in real time. And based on the size of the compressed page, it is dynamically determined whether to continue compressing the third page.
[0057] If during the compression of the third page, the size of the compressed page of the third page reaches the second threshold, it can be considered that the compression rate of the third page is low, and the third page already meets the standard of the second page. Then, the subsequent compression of the third page can be stopped in advance, and the third page can be directly determined as the second page with a low compression rate, and an associated large page identifier is added to it. Then, during the subsequent compression process, the third page can be directly determined as the second page, and the compression of this page can be directly skipped.
[0058] If after the compression of the third page is completed, the size of the compressed page of the third page is still smaller than the second threshold, it indicates that the compression rate of the third page is high and meets the standard of the first page. Then, an associated small page identifier can be conditionally added to it. Then, during the subsequent compression process, the third page can be directly determined as the first page, and the third page can be compressed.
[0059] Among them, since the first threshold is a pre-set compression rate standard, the product of the page size of the third page and the first threshold can be determined as the second threshold. Then, as long as the size of the compressed page of the third page reaches the second threshold, it can be determined that the compression rate of the third page is low.
[0060] For example, if the first threshold is 50%, and the page size of the third page is 16Kb, then the second threshold is 8Kb. During the compression of the third page, if it is found that the size of the compressed page has reached 8Kb when the third page is compressed to 60%, the subsequent compression of the third page can be stopped, and an associated large page identifier can be directly added to the third page.
[0061] Through the above method, the processing progress of the page can be judged in real time, the subsequent page compression can be terminated in advance when the page meets the standard of the second page, the waste of computing power can be reduced, and the overall compression efficiency can be improved. And an identifier is added to the unmarked third page during compression, which is convenient for judging the compression rate of the page during the subsequent compression process.
[0062] In some embodiments, the method further includes:
[0063] When the CPU of the electronic device is in a low-load state and the first application is running in the foreground of the electronic device, compress the fourth page of the first application in the GPU memory to obtain a fourth compressed page;
[0064] Associate the fourth compressed page with the fourth page.
[0065] In this embodiment, when the CPU of the electronic device is in a low-load state, it can be considered that there are fewer computing tasks in the current CPU and the overall utilization rate is low. For example, a state where the CPU occupancy rate is lower than 20% can be determined as the CPU being in a low-load state.
[0066] Then, when the CPU of the electronic device is in a low-load state, even if the first application is still running in the foreground of the electronic device, the fourth page that can be compressed in the first application in the GPU memory can be searched in advance, and the fourth page is compressed to obtain a fourth compressed page. After the fourth compressed page is obtained by compression, the original fourth page is still retained, and the fourth page and the fourth compressed page are associated and the fourth compressed page is stored.
[0067] For example, the compressible fourth page can be a page of static resources in the first application, and the static resources can include textures, maps of the user interface, etc.
[0068] Then, in the case where the first application is subsequently switched to the background of the electronic device, page compression of the first application is triggered. At this time, since the fourth compressed page has been pre-compressed and the compressed fourth compressed page and the fourth page are associated and stored. Therefore, the system can directly release the fourth page and use the already compressed fourth compressed page without performing additional compression calculations.
[0069] In the above-described manner, pages in the application running in the foreground can be pre-compressed when the CPU is in a low-load state, and the compressed data is associated with the original page, so that compression can be avoided when system resources are tense, and reasonable allocation of CPU computing power is achieved.
[0070] In some embodiments, after clearing the first page, the method further includes:
[0071] When the interval duration between the wake-up time of the first application running in the background and the current time is less than a first duration, decompress the first compressed page to obtain the first page, where the wake-up time is the time after the current time when the first application is switched to the foreground.
[0072] In this embodiment, after the first application is switched from running in the foreground to running in the background, in order to release the GPU memory, the first page can be compressed into a first compressed page, and then the first page is released. Subsequently, when the first application is switched back from the background to the foreground, the GPU needs to re-render the interface. At this time, the compressed first compressed page must be decompressed to restore the original resources to ensure normal display and interaction.
[0073] In this embodiment, when the first application is running in the background, the user's behavior can be predicted in real time. When it is predicted that the user will switch the first application to the foreground at the wake-up moment, and the time interval between the wake-up moment and the current moment is less than the first duration, it can be considered that the user is about to switch the first application to the foreground. Then, the pre-uncompression of GPU resources can be triggered in advance at the current moment. That is to say, even if the first application is still running in the background, the first compressed page can be automatically decompressed to obtain the first page.
[0074] In this way, when the user actually switches the first application to the foreground, there is no need to wait for decompression, and the first page can be directly used.
[0075] Through the above method, when it is predicted that the first application is about to be switched to the foreground, the GPU resources can be decompressed in advance, thereby reducing the loading delay during application switching, improving the smoothness of application switching, avoiding the user waiting for resource decompression when opening the application, and improving the system response speed.
[0076] Figure 2 It is a schematic structural diagram of a page processing device provided by another embodiment of the present application. As Figure 2 shown, the page processing device may include:
[0077] A first compression module 201, configured to compress the first page of the first application in the GPU memory to obtain a first compressed page and retain the second page of the first application in the GPU memory when the first application is running in the background of the page processing device and the page processing device does not meet the target compression condition, where the first page is a page with a compression ratio greater than a first threshold, the second page is a page with a compression ratio less than or equal to the first threshold, and the target compression condition is a trigger condition for compressing all pages in the GPU memory;
[0078] A clearing module 202, configured to clear the first page.
[0079] In the present application, when the first application enters the background and the page processing device does not meet the target compression condition, only the first page with a higher compression ratio in the GPU memory can be compressed to generate a first compressed page, and the original first page is cleared, while the second page with a lower compression ratio remains in the GPU memory. Through the above method, only the page with a high compression ratio in the GPU memory can be selected for compression, which not only releases GPU resources but also takes into account reducing the computing power burden of the page processing device, avoids the ineffective compression of pages with a low compression ratio, and reduces the consumption of system power while ensuring the release of memory space.
[0080] In another optional example, the page processing device further includes:
[0081] A second compression module for compressing a third page of the first application, where the third page is a page not associated with the large page identifier and not associated with the small page identifier.
[0082] In another optional example, the second compression module further includes:
[0083] An association unit for stopping compressing the third page and associating a large page identifier with the third page when the size of the compressed page of the third page reaches a second threshold during the compression process of the third page.
[0084] In another optional example, the page processing device further includes:
[0085] A third compression module for compressing a fourth page of the first application in the GPU memory to obtain a fourth compressed page when the CPU of the page processing device is in a low load state and the first application is running in the foreground of the page processing device;
[0086] An association module for associating the fourth compressed page with the fourth page.
[0087] In another optional example, the page processing device further includes:
[0088] A decompression module for decompressing the first compressed page to obtain the first page when the interval duration between the wake-up time and the current time of the first application running in the background is less than a first duration, where the wake-up time is the time when the first application is switched to the foreground after the current time.
[0089] The page processing device in the embodiments of the present application may be an electronic device or a component in an electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal or other devices other than terminals. Exemplarily, the electronic device may be a mobile phone, a tablet computer, a laptop computer, a handheld computer, a vehicle-mounted electronic device, a Mobile Internet Device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. It may also be a server, a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc. The embodiments of the present application do not make specific limitations.
[0090] The page processing device in the embodiments of the present application may be a device with an operating system. The operating system may be an Android operating system, an IOS operating system, or other possible operating systems. The embodiments of the present application do not make specific limitations.
[0091] The page processing device provided by the embodiments of the present application can implement Figure 1 each process implemented by the method embodiments. To avoid repetition, details are not described herein again.
[0092] Optionally, as Figure 3 shown, the embodiments of the present application further provide an electronic device 100, including a processor 110, a memory 119, a program or instruction stored on the memory 119 and executable on the processor 110. When the program or instruction is executed by the processor 110, it implements each process of the above-mentioned page processing method embodiment and can achieve the same technical effect. To avoid repetition, details are not described herein again.
[0093] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0094] Please refer to Figure 4, Figure 4 It is a schematic diagram of the hardware structure of an electronic device for implementing an embodiment of the present application. The electronic device 100 includes, but is not limited to: a radio frequency unit 121, a network module 122, an audio output unit 123, an input unit 124, a sensor 125, a display unit 126, a user input unit 127, an interface unit 128, a memory 129, a processor 120, and other components.
[0095] Those skilled in the art can understand that the electronic device 100 may further include a power supply (such as a battery) for supplying power to each component. The power supply can be logically connected to the processor 120 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system. Figure 4 The structure of the electronic device shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0096] Among them, the processor 120 is used to compress the first page of the first application in the GPU memory to obtain a first compressed page and retain the second page of the first application in the GPU memory when the first application is running in the background of the electronic device and the electronic device does not meet the target compression condition. Wherein, the first page is a page with a compression rate greater than a first threshold, the second page is a page with a compression rate less than or equal to the first threshold, and the target compression condition is a trigger condition for compressing all pages in the GPU memory;
[0097] The processor 120 is used to clear the first page.
[0098] In the present application, when the first application enters the background and the electronic device does not meet the target compression condition, only the first page with a higher compression rate in the GPU memory can be compressed to generate a first compressed page, and the original first page can be cleared, while the second page with a lower compression rate remains in the GPU memory. Through the above method, only the page with a high compression rate in the GPU memory can be selected for compression, which not only releases GPU resources but also reduces the computing power burden of the electronic device, avoids ineffective compression of pages with a low compression rate, and reduces the consumption of system power while ensuring the release of memory space.
[0099] In another alternative example, the processor 120 is further used for:
[0100] Compress the third page of the first application, where the third page is a page not associated with the large page identifier and not associated with the small page identifier.
[0101] In another alternative example, the processor 120 is further used for:
[0102] During the compression of the third page, when the size of the compressed page of the third page reaches a second threshold, stop compressing the third page and associate a large page identifier with the third page.
[0103] In another optional example, the processor 120 is further configured to:
[0104] When the CPU of the electronic device is in a low-load state and the first application is running in the foreground of the electronic device, compress a fourth page of the first application in the GPU memory to obtain a fourth compressed page;
[0105] Associate the fourth compressed page with the fourth page.
[0106] In another optional example, the processor 120 is further configured to:
[0107] When the interval duration between the wake-up time of the first application running in the background and the current time is less than a first duration, decompress the first compressed page to obtain the first page, where the wake-up time is the time when the first application is switched to the foreground after the current time.
[0108] It should be understood that in the embodiments of the present application, the input unit 124 may include a Graphics Processing Unit (GPU) 1241 and a microphone 1242. The graphics processor 1241 processes the image data of static pictures or videos obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 126 may include a display panel 1261, and the display panel 1261 may be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 127 includes at least one of a touch panel 1271 and other input devices 1272. The touch panel 1271 is also called a touch screen. The touch panel 1271 may include a touch detection device and a touch controller. The other input devices 1272 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be elaborated here.
[0109] The memory 129 can be used to store software programs and various data. The memory 129 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data. Among them, the first storage area may store an operating system, application programs or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 129 may include a volatile memory or a non-volatile memory, or the memory 129 may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDR SDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synch link dynamic random access memory (SLDRAM), and a direct rambus random access memory (DRRAM). The memory 129 in the embodiments of the present application includes but is not limited to these and any other suitable types of memories.
[0110] The processor 120 may include one or more processing units; optionally, the processor 120 integrates an application processor and a modem processor. Among them, the application processor mainly processes operations related to the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above modem processor may not be integrated into the processor 120 either.
[0111] The embodiments of the present application further provide a readable storage medium. A program or instruction is stored on the readable storage medium. When the program or instruction is executed by the processor, it implements each process of the embodiment of the above page processing method and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0112] Among them, the processor is the processor in the electronic device in the above-mentioned embodiment. The readable storage medium includes computer-readable storage media such as computer read-only memory ROM, random access memory RAM, magnetic disk or optical disc, etc.
[0113] Another embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement each process of the above-mentioned embodiment of the page processing method, and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0114] It should be understood that the chip mentioned in the embodiment of the present application can also be referred to as a system-on-chip, system chip, chip system or system-on-chip, etc.
[0115] The embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement each process of the above-mentioned embodiment of the page processing method, and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0116] It should be noted that in this article, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. Without more limitations, an element defined by the statement "including a..." does not exclude the existence of another identical element in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in a reverse order according to the functions involved. For example, the described methods may be performed in an order different from that described, and various steps may be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0117] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disc), and includes several instructions to enable a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present application.
[0118] The embodiments of the present application have been described above in conjunction with the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative rather than restrictive. Under the inspiration of the present application, those of ordinary skill in the art can also make many forms without departing from the purpose of the present application and the scope protected by the claims, and all of them fall within the protection scope of the present application.
Claims
1. A method for processing a page, the method being executed by an electronic device, characterized in that, including: When the first application is running in the background of the electronic device and the electronic device does not meet the target compression condition, compress the first page of the first application in the GPU memory to obtain a first compressed page, and retain the second page of the first application in the GPU memory, where the first page is a page with a compression ratio greater than a first threshold, the second page is a page with a compression ratio less than or equal to the first threshold, and the target compression condition is the trigger condition for compressing all pages in the GPU memory; Clear the first page.
2. The method according to claim 1, characterized in that, The first page is a page associated with a large page identifier, and the second page is a page associated with a small page identifier. The method further includes: Compress the third page of the first application, where the third page is a page that is not associated with the large page identifier and is not associated with the small page identifier.
3. The method according to claim 2, characterized in that, The compressing the third page of the first application includes: During the compression of the third page, when the size of the compressed page of the third page reaches a second threshold, stop compressing the third page and associate a large page identifier with the third page.
4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: When the CPU of the electronic device is in a low load state and the first application is running in the foreground of the electronic device, compress the fourth page of the first application in the GPU memory to obtain a fourth compressed page; Associate the fourth compressed page with the fourth page.
5. The method according to any one of claims 1 to 3, characterized in that, After clearing the first page, the method further includes: When the interval duration between the wake-up time of the first application running in the background and the current time is less than a first duration, decompress the first compressed page to obtain the first page, where the wake-up time is the time after the current time when the first application is switched to the foreground.
6. A page processing device, characterized in that, including: A first compression module, configured to compress the first page of the first application in the GPU memory to obtain a first compressed page and retain the second page of the first application in the GPU memory when the first application is running in the background of the page processing device and the page processing device does not meet the target compression condition, where the first page is a page with a compression ratio greater than a first threshold, the second page is a page with a compression ratio less than or equal to the first threshold, and the target compression condition is the trigger condition for compressing all pages in the GPU memory; A clearing module, configured to clear the first page.
7. The device according to claim 6, characterized in that The page processing device further includes: A second compression module, configured to compress the third page of the first application, where the third page is a page that is not associated with the large page identifier and is not associated with the small page identifier.
8. The device according to claim 7, characterized in that, The second compression module further includes: An association unit, configured to stop compressing the third page and associate a large page identifier with the third page when the size of the compressed page of the third page reaches a second threshold during the compression of the third page.
9. The device according to any one of claims 6 - 8, characterized in that, The page processing device further includes: A third compression module, configured to compress a fourth page of the first application in the GPU memory to obtain a fourth compressed page when the CPU of the processing device of the page is in a low load state and the first application is running in the foreground of the processing device of the page; An association module, configured to associate the fourth compressed page with the fourth page.
10. The device according to any one of claims 6 - 8, characterized in that, The processing device of the page further includes: A decompression module, configured to decompress the first compressed page to obtain the first page when the time interval between the wake-up time of the first application running in the background and the current time is less than a first time period, where the wake-up time is the time when the first application is switched to the foreground after the current time.
11. An electronic device, characterized in that, It includes a processor and a memory, and the memory stores programs or instructions that can run on the processor. When the programs or instructions are executed by the processor, the steps of the page processing method according to any one of claims 1-5 are implemented.