Data processing method and device, electronic equipment and storage medium
By evaluating and selecting multiple compression algorithms for compressed data, the problem of poor performance of existing memory compression technologies is solved, and more efficient memory usage and user experience is achieved.
Patent Information
- Application Number
- CN202310541814.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-12
- Publication Date
- 2024-11-12
AI Technical Summary
The existing memory compression technology has shortcomings in terms of compression effect and cannot effectively improve the system's memory usage efficiency and user experience.
By obtaining the data to be compressed, extracting part of the data as reference compressed data, using multiple compression algorithms to compress it, and selecting the algorithm with the lowest compression rate as the target algorithm to compress the data to be compressed, thereby improving the compression rate and efficiency.
It realizes more efficient data compression, improves the system's memory usage efficiency and user experience, and adapts to changes in system operating conditions through dynamic selection of compression algorithms, and optimizes the compression effect in real time.
Smart Images

Figure CN118944676A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and more specifically, to a data processing method, device, electronic device and storage medium. Background Art
[0002] Memory compression is a technology that effectively compresses long-term unused memory content in running memory (commonly known as memory compression technology) to shrink the memory capacity available for a given system. In short, memory compression compresses infrequently accessed memory pages to reduce the reading and writing of the hard disk. At present, memory compression technology is mostly used to save memory space to save the purchase cost of computer hardware. It allows programmers to release unused temporary memory space, reduce cache operation overhead, improve system performance, and make the system more stable. However, the compression effect of current memory compression schemes needs to be improved. Summary of the invention
[0003] In view of the above problems, the present application proposes a data processing method, device, electronic device and storage medium to improve the above problems.
[0004] In a first aspect, an embodiment of the present application provides a data processing method, which is applied to an electronic device, and the method includes: obtaining data to be compressed; obtaining part of compressed data from the data to be compressed as reference compressed data; compressing the reference compressed data respectively based on a specified number of compression algorithms, and obtaining the specified number of compression rates after compression; using the compression algorithm corresponding to the compression rate with the smallest median of the specified number of compression rates as a target compression algorithm; and compressing the data to be compressed based on the target compression algorithm.
[0005] In a second aspect, an embodiment of the present application provides a data processing device that runs on an electronic device, the device comprising: a first data acquisition module, used to acquire data to be compressed; a second data acquisition module, used to acquire partial compressed data from the data to be compressed as reference compressed data; a compression evaluation module, used to compress the reference compressed data based on a specified number of compression algorithms, respectively, and acquire the specified number of compression rates after compression; an algorithm selection module, used to use the compression algorithm corresponding to the compression rate with the smallest median of the specified number of compression rates as a target compression algorithm; and a data processing module, used to compress the data to be compressed based on the target compression algorithm.
[0006] In a third aspect, the present application provides an electronic device comprising one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method described in the first aspect above.
[0007] In a fourth aspect, the present application provides a computer-readable storage medium, in which a program code is stored, wherein the method described in the first aspect above is executed when the program code is run.
[0008] The present application provides a data processing method, device, electronic device and storage medium, which obtains data to be compressed; obtains part of the compressed data from the data to be compressed as reference compressed data; compresses the reference compressed data based on a specified number of compression algorithms, and obtains the compression ratio of the specified number obtained after compression; and compresses the data to be compressed based on the target compression algorithm. Thus, the above method realizes the use of multiple compression algorithms to compress the sampled data respectively, and selects the best compression algorithm to compress the data to be compressed, thereby improving the compression ratio and compression efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0010] Figure 1 A method flow chart of a data processing method proposed in an embodiment of the present application is shown.
[0011] Figure 2 A method flow chart of a data processing method proposed in another embodiment of the present application is shown.
[0012] Figure 3 A method flow chart of a data processing method proposed in yet another embodiment of the present application is shown.
[0013] Figure 4 A method flow chart of a data processing method proposed in yet another embodiment of the present application is shown.
[0014] Figure 5 A structural block diagram of a data processing device proposed in an embodiment of the present application is shown.
[0015] Figure 6 A structural block diagram of an electronic device for executing a data processing method according to an embodiment of the present application is shown.
[0016] Figure 7 It is a storage unit of an embodiment of the present application for storing or carrying a program code for implementing a data processing method according to an embodiment of the present application. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0018] Generally speaking, the available memory capacity of any system is limited over a period of time, and more memory can be used for larger programs and to support more users. However, due to memory limitations, the available memory resources of the system are often exhausted, which requires memory compression technology to save memory usage space. At present, memory compression technology is mostly used to save memory space to save the purchase cost of computer hardware. It allows programmers to release unused temporary memory space, reduce cache operation overhead, improve system performance, and make the system more stable. However, the compression effect of current memory compression schemes needs to be improved.
[0019] In order to optimize the above-mentioned problems, the inventors, after long-term research, proposed the data processing method, device, electronic device and storage medium provided in the embodiments of the present application. The method can use multiple compression algorithms to compress the sampled data respectively, and select the best compression algorithm to compress the data to be compressed, thereby improving the compression rate and compression efficiency, and enhancing the user experience.
[0020] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0021] See also Figure 1 In one embodiment of the present application, a data processing method is provided, which can be applied to an electronic device. In the implementation mode of the present application, the electronic device can be a mobile communication device such as a mobile phone or a tablet computer, or a wearable device, and the specific type of the electronic device is not limited. The method includes:
[0022] Step S110: Obtain data to be compressed.
[0023] In the implementation manner of the present application, the type of data to be compressed may not be limited, for example, the data to be compressed may be audio data, video data, files, pictures or codes, etc. The data to be compressed may include one or more data types at the same time.
[0024] As a method, the remaining available memory of the system can be monitored, and when it is detected that the remaining available memory of the system is lower than the memory threshold, the data to be compressed can be obtained. The specific value of the memory threshold may not be limited, for example, the memory threshold may be a value such as 3G, 1024M, etc. In at least one embodiment, the remaining available memory of the system may be monitored in real time, or the remaining available memory of the system may be monitored regularly (for example, once an hour), and the monitoring period may not be limited.
[0025] In the implementation manner of the present application, the data to be compressed can be understood as the storage data of the virtual memory. As the system operation time increases, the amount and / or type of the data to be compressed may change, wherein the amount of the data to be compressed may change, the type of the data to be compressed may change, or both the amount and type of the data to be compressed may change.
[0026] Step S120: obtaining part of compressed data from the data to be compressed as reference compressed data.
[0027] As mentioned above, it is not difficult to understand that if a pre-configured data compression algorithm is directly used to compress the data to be compressed, it may be impossible to select the most suitable compression algorithm according to the characteristics of the data to be compressed, thereby affecting the data compression rate and compression flexibility, and reducing user experience.
[0028] In order to improve the above problem, in the implementation mode of the present application, before compressing the data to be compressed, part of the compressed data can be obtained from the data to be compressed as reference compressed data, and the reference compressed data can be used to evaluate the compression effect of the compression algorithm, and then the compression algorithm with the best compression effect can be selected based on the reference compressed data to compress the data to be compressed. The amount of reference compressed data is less than the amount of data to be compressed.
[0029] As an implementation method, a preset number of bytes can be obtained from the data to be compressed as reference data to be compressed. In at least one embodiment, the preset number of bytes can be obtained from the data to be compressed in the order of the headers as reference data to be compressed, or the preset number of bytes can be randomly selected from the data to be compressed as reference data to be compressed, and the specific acquisition method may not be limited. The specific value of the preset number of bytes may not be limited. By obtaining reference compressed data in a flexible sampling method, the applicability of the data compression algorithm can be improved.
[0030] Step S130: compressing the reference compressed data respectively based on a specified number of compression algorithms, and obtaining the specified number of compression ratios obtained after compression.
[0031] The specified number includes two or more, and the specified number of compression algorithms are compression algorithms of different types.
[0032] As a method, when the reference compressed data is obtained, the reference compressed data can be compressed based on a specified number of compression algorithms, and a specified number of compression ratios obtained after compression can be obtained. Each compression algorithm corresponds to a compression ratio, and the values of compression ratios corresponding to different compression algorithms can be different, and the values of compression ratios corresponding to some different compression algorithms can also be the same or similar.
[0033] Step S140: taking the compression algorithm corresponding to the compression ratio with the smallest median value of the specified number of compression ratios as the target compression algorithm.
[0034] In the implementation manner of the present application, the smaller the compression rate value, the better the compression effect. Therefore, as a method, the compression algorithm corresponding to the compression rate with the smallest median compression rate of the specified number of compression rates obtained above can be used as the target compression algorithm, that is, it can be considered that the compression effect of the target compression algorithm is better than that of other compression algorithms.
[0035] As mentioned above, the data to be compressed may change as the system running time increases, so the target compression algorithm with the best compression effect may also change as the system running time changes. In this case, as an implementation method, in order to improve the flexibility of compression and improve the compression effect, the latest target compression algorithm can be updated in real time as the system running time changes, so as to ensure that the data to be compressed can be compressed in real time based on the target compression algorithm with the best compression effect.
[0036] As another implementation, in order to improve the compression effect and reduce energy consumption at the same time, the compression algorithm with the best compression effect can be obtained once at a specified time interval, and the compression algorithm with the best compression effect can be used as the target compression algorithm in the specified time interval. For example, 5 compression algorithms can be used to compress the data to be compressed every 10 minutes. The algorithm with the lowest compression rate after compression is used as the target compression algorithm in these 10 minutes. The values of the specified time period are only examples and do not constitute a limitation of this solution.
[0037] Alternatively, the compression algorithm can be obtained in real time at a fixed unit time within a specified period of time to obtain multiple compression algorithms, and then the compression algorithm with the best compression effect and the most satisfaction within the specified period of time is used as the target compression algorithm within the specified period of time. For example, 5 compression algorithms can be used to compress the data to be compressed every 50 seconds within 10 minutes, and 12 rounds of compression rates can be obtained. Each round includes 5 compression rates, that is, there are a total of 60 compression rate values. Assuming that a certain compression rate value appears 5 times, and the number of times other compression rate values appear is less than 5 times, then the compression algorithm corresponding to the compression rate can be used as the target compression algorithm within these 10 minutes. By dynamically obtaining the target compression algorithm, the dynamic selection of the compression algorithm can be realized, so that the compression efficiency and compression rate can be maximized.
[0038] Step S150: compressing the data to be compressed based on the target compression algorithm.
[0039] When the target compression algorithm is determined, the data to be compressed can be compressed based on the target compression algorithm, so that the compression algorithm with the best compression effect is selected to compress the data to be compressed, thereby improving the compression rate.
[0040] The present application provides a data processing method, which obtains data to be compressed; obtains part of the compressed data from the data to be compressed as reference compressed data; compresses the reference compressed data based on a specified number of compression algorithms, and obtains the compression ratio of the specified number obtained after compression; and compresses the data to be compressed based on the target compression algorithm. Thus, the above method realizes the use of multiple compression algorithms to compress the sampled data respectively, and selects the best compression algorithm to compress the data to be compressed, thereby improving the compression ratio and compression efficiency.
[0041] See also Figure 2 Another embodiment of the present application provides a data processing method, which can be applied to an electronic device, and the method includes:
[0042] Step S210: Acquire the operating system's running data as data to be compressed.
[0043] In the implementation manner of the present application, the operating data of the operating system may be obtained as the data to be compressed. The specific type of the operating system may not be limited.
[0044] In at least one embodiment, the running data of the target application may also be obtained as the data to be compressed. The target application is an application running in the operating system, and the number of the target application may be one or more.
[0045] As an implementation method, the application running in the foreground of the operating system can be obtained as the target application, or the application running in the background of the operating system can be obtained as the target application, or the application with the longest continuous running time in the operating system can be obtained as the target application, or the application with the most running data in the operating system can be obtained as the target application, or the application with the highest running frequency in the operating system can be obtained as the target application. By obtaining the target application, its running data can be compressed, so as to avoid the running data of the target application occupying more memory and affecting the stable operation of the operating system.
[0046] Step S220: obtaining part of compressed data from the data to be compressed as reference compressed data.
[0047] The specific implementation of step S220 may refer to the relevant description of step S120 in the aforementioned embodiment, which will not be repeated here.
[0048] Step S230: compressing the reference compressed data respectively based on a specified number of compression algorithms, and obtaining the specified number of compression ratios obtained after compression.
[0049] The specific implementation of step S230 may refer to the relevant description of step S130 in the aforementioned embodiment, which will not be repeated here.
[0050] Step S240: taking the compression algorithm corresponding to the compression ratio with the smallest median value of the specified number of compression ratios as the target compression algorithm.
[0051] The specific implementation of step S240 may refer to the relevant description of step S140 in the aforementioned embodiment, which will not be repeated here.
[0052] Step S250: compressing the data to be compressed based on the target compression algorithm.
[0053] The specific implementation of step S250 may refer to the relevant description of step S150 in the aforementioned embodiment, which will not be repeated here.
[0054] The present application provides a data processing method, which obtains the operating data of the operating system as the data to be compressed; obtains part of the compressed data from the data to be compressed as reference compressed data; compresses the reference compressed data based on a specified number of compression algorithms, and obtains the compression ratio of the specified number obtained after compression; and compresses the data to be compressed based on the target compression algorithm. Thus, the above method realizes the use of multiple compression algorithms to compress the sampled data respectively, and selects the best compression algorithm to compress the data to be compressed, thereby improving the compression ratio and compression efficiency.
[0055] See also Figure 3 Another embodiment of the present application provides a data processing method, which can be applied to an electronic device, and the method includes:
[0056] Step S310: Acquire the operating system's running data as data to be compressed.
[0057] The specific implementation of step S310 may refer to the relevant description of step S210 in the aforementioned embodiment, which will not be repeated here.
[0058] Step S320: If the data to be compressed includes one data type, obtain a preset number of bytes from the data to be compressed of the one data type as the reference compressed data; if the data to be compressed includes multiple data types, obtain a preset number of bytes from the data to be compressed of the multiple data types respectively as the reference compressed data.
[0059] In an implementation manner of the present application, data with different data characteristics may constitute different data types, and the data to be compressed may include at least one data type. For example, when the data to be compressed is the running data of the target application described in the aforementioned embodiment, if the target application is an audio playback application, the running data of the target application may include at least one type of data such as pictures, text, and audio.
[0060] As a method, if the data to be compressed includes only one data type, when obtaining reference compressed data, a preset number of bytes can be obtained from the data to be compressed of the one data type as reference compressed data. The specific acquisition process can refer to the relevant description of the aforementioned embodiment and will not be repeated here.
[0061] As another approach, if the data to be compressed includes multiple data types, since the same compression algorithm may have different compression effects on different types of data, and different compression algorithms may have different compression effects on the same type of data, in order to more effectively evaluate the compression effects of different compression algorithms on different types of compressed data, when obtaining reference compressed data, content with a preset number of bytes can be obtained from the data to be compressed of multiple data types as reference compressed data.
[0062] For example, assuming there are three types of compressed data, A, B, and C, the content of a preset number of bytes obtained from the compressed data of type A, the content of a preset number of bytes obtained from the compressed data of type B, and the content of a preset number of bytes obtained from the compressed data of type C can be used together as reference compressed data; or the content of a preset number of bytes obtained from the compressed data of type A can be used as reference compressed data A, the content of a preset number of bytes obtained from the compressed data of type B can be used as reference compressed data B, and the content of a preset number of bytes obtained from the compressed data of type C can be used as reference compressed data C. In this way, the reference compressed data A, reference compressed data B, and reference compressed data C are independent reference compressed data.
[0063] Step S330: compressing the reference compressed data respectively based on a specified number of compression algorithms, and obtaining the specified number of compression ratios obtained after compression.
[0064] The specific implementation of step S330 may refer to the relevant description of step S130 in the aforementioned embodiment, which will not be repeated here.
[0065] Step S340: taking the compression algorithm corresponding to the compression ratio with the smallest median value of the specified number of compression ratios as the target compression algorithm.
[0066] The specific implementation of step S340 may refer to the relevant description of step S140 in the aforementioned embodiment, which will not be repeated here.
[0067] In this embodiment, when the data to be compressed includes multiple data types, different types of compressed data may correspond to different target compression algorithms, thereby flexibly selecting the most suitable compression algorithm according to the characteristics of the compressed data, thereby improving the data compression effect.
[0068] Step S350: compressing the data to be compressed based on the target compression algorithm.
[0069] The specific implementation of step S350 may refer to the relevant description of step S150 in the aforementioned embodiment, which will not be repeated here.
[0070] It is worth noting that when the data to be compressed includes multiple data types, as described in the above example, assuming that there are three types of compressed data A, B, and C, then when the compressed data is compressed based on the target compression algorithm, the compressed data A, compressed data B, and compressed data C will be compressed separately based on the target compression algorithm.
[0071] The present application provides a data processing method, which obtains the operating data of the operating system as the data to be compressed; if the data to be compressed includes a data type, obtains the content of a preset number of bytes from the data to be compressed of the data type as the reference compressed data; if the data to be compressed includes multiple data types, obtains the content of a preset number of bytes from the data to be compressed of the multiple data types as the reference compressed data; compresses the reference compressed data based on a specified number of compression algorithms, and obtains the compression rate of the specified number obtained after compression; compresses the data to be compressed based on the target compression algorithm. Thus, through the above method, it is realized that multiple compression algorithms are used to compress the sampled data respectively, and the best compression algorithm is selected to compress the data to be compressed, so as to improve the compression rate and compression efficiency.
[0072] See also Figure 4 Another embodiment of the present application provides a data processing method, which can be applied to an electronic device, and the method includes:
[0073] Step S410: Obtain data to be compressed.
[0074] The specific implementation of step S410 may refer to the relevant description of step S110 in the aforementioned embodiment, which will not be repeated here.
[0075] Step S420: obtaining part of compressed data from the data to be compressed as reference compressed data.
[0076] The specific implementation of step S420 may refer to the relevant description of step S120 in the aforementioned embodiment, which will not be repeated here.
[0077] Step S430: compressing the reference compressed data respectively based on a specified number of compression algorithms according to the same compression mode, and obtaining the specified number of compression ratios obtained after compression.
[0078] In the implementation manner of the present application, the compression mode can be understood as the setting method of the intermediate variables in the process of compressing data. It is understandable that after compressing the same data using different compression algorithms, the format of the compressed data obtained may be different. In this way, the compression rate values corresponding to different compression algorithms may also be different. In order to improve the reliability and accuracy of obtaining the compression rate of the compression algorithm, the data compression formats of different compression algorithms can be unified. Specifically, the variable control method can be used to set the format to be compressed by a specified number of compression algorithms to the same format (the specific format may not be limited), and then the reference compressed data can be compressed separately based on a specified number of compression algorithms according to the same compression mode.
[0079] In at least one embodiment, the compression mode can also be set as follows: for different compression algorithms, the same compression speed is used to compress the reference compressed data respectively; or for different compression algorithms, the same decompression speed is used to decompress the reference compressed data respectively. By setting the same compression speed or decompression speed, different compression algorithms can compress the reference compressed data according to the same compression standard, so that the compression rate of the compression algorithm can be obtained more accurately, and then the compression effect of each compression algorithm can be more accurately evaluated.
[0080] In at least one embodiment, it is understood that some compression algorithms use a lossy compression mode during the compression process, while other compression algorithms use a lossless compression mode. For the same compression algorithm, the size of the compressed file obtained after lossy compression is smaller than the size of the compressed file obtained after lossless compression. In this case, in order to more accurately compare the compression effects of various algorithms, the algorithm using lossless compression can be configured as lossy compression; or the algorithm using lossy compression can be configured as lossless compression, that is, the compression modes of different compression algorithms are unified to achieve fair comparison of the compression effects of the compression algorithms and improve the overall compression efficiency.
[0081] Step S440: taking the compression algorithm corresponding to the compression ratio with the smallest median value of the specified number of compression ratios as the target compression algorithm.
[0082] The specific implementation of step S440 may refer to the relevant description of step S140 in the aforementioned embodiment, which will not be repeated here.
[0083] Step S450: compressing the data to be compressed based on the target compression algorithm.
[0084] The specific implementation of step S450 may refer to the relevant description of step S150 in the aforementioned embodiment, which will not be repeated here.
[0085] The present application provides a data processing method, which obtains data to be compressed; obtains part of the compressed data from the data to be compressed as reference compressed data; compresses the reference compressed data based on a specified number of compression algorithms according to the same compression mode, and obtains the compression ratio of the specified number obtained after compression; and compresses the data to be compressed based on the target compression algorithm. Thus, the above method realizes the use of multiple compression algorithms to compress the sampled data respectively, and selects the best compression algorithm to compress the data to be compressed, thereby improving the compression ratio and compression efficiency.
[0086] See also Figure 5 , an embodiment of the present application provides a data processing device 500, which can operate an electronic device, and the device 500 includes:
[0087] The first data acquisition module 510 is used to acquire the data to be compressed.
[0088] As an implementation manner, the first data acquisition module 510 may be used to acquire operating data of the operating system as data to be compressed.
[0089] As another implementation manner, the first data acquisition module 510 may be configured to acquire the running data of the target application as the data to be compressed.
[0090] The second data acquisition module 520 is used to acquire part of the compressed data from the data to be compressed as reference compressed data.
[0091] As a method, the second data acquisition module 520 can be used to acquire content of a preset number of bytes from the data to be compressed as reference data to be compressed.
[0092] In an embodiment of the present application, the data to be compressed may include at least one data type. In this manner, the second data acquisition module 520 may be used to obtain a preset number of bytes from the data to be compressed of the one data type as the reference compressed data if the data to be compressed includes one data type; and to obtain a preset number of bytes from the data to be compressed of the multiple data types respectively as the reference compressed data if the data to be compressed includes multiple data types.
[0093] In the implementation manner of the present application, the second data acquisition module 520 can also be used to acquire content of a preset number of bytes from the to-be-compressed data at intervals of a preset time length as the reference compressed data.
[0094] The compression evaluation module 530 is used to compress the reference compressed data respectively based on a specified number of compression algorithms, and obtain the specified number of compression ratios obtained after compression.
[0095] As a method, the compression evaluation module 530 can be used to obtain content with a preset number of bytes from the data to be compressed at intervals of a preset time as the reference compressed data.
[0096] The algorithm selection module 540 is used to select the compression algorithm corresponding to the compression ratio with the smallest median value among the specified number of compression ratios as the target compression algorithm.
[0097] The data processing module 550 is used to compress the data to be compressed based on the target compression algorithm.
[0098] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0099] In several embodiments provided in the present application, the coupling or direct coupling or communication connection between the modules shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or modules, which may be electrical, mechanical or other forms.
[0100] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
[0101] See also Figure 6 Based on the above data processing method and device, the embodiment of the present application also provides an electronic device 100 that can execute the above data processing method. The electronic device 100 includes a memory 102 and one or more (only one is shown in the figure) processors 104 coupled to each other, and the memory 102 and the processor 104 are connected by a communication line. The memory 102 stores a program that can execute the content of the above embodiments, and the processor 104 can execute the program stored in the memory 102.
[0102] Among them, the processor 104 may include one or more processing cores. The processor 104 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes various functions and processes data of the electronic device 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 102, and calling data stored in the memory 102. Optionally, the processor 104 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 104 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 104, but may be implemented separately through a communication chip.
[0103] The memory 102 may include a random access memory (RAM) or a read-only memory (ROM). The memory 102 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 102 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the aforementioned embodiments, etc. The data storage area may also store data (such as a phone book, audio and video data, chat record data) created by the electronic device 100 during use.
[0104] Please refer to Figure 7 , which shows a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable storage medium 600 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.
[0105] The computer readable storage medium 600 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 600 includes a non-transitory computer-readable storage medium. The computer readable storage medium 600 has storage space for program code 610 that performs any method step of the above method. These program codes can be read from or written to one or more computer program products. The program code 610 can be compressed, for example, in an appropriate form.
[0106] In summary, the present application provides a data processing method, device, electronic device and storage medium, which obtains the data to be compressed; obtains part of the compressed data from the data to be compressed as reference compressed data; compresses the reference compressed data based on a specified number of compression algorithms, and obtains the compression ratio of the specified number obtained after compression; and compresses the data to be compressed based on the target compression algorithm. Thus, the above method realizes the use of multiple compression algorithms to compress the sampled data respectively, and selects the best compression algorithm to compress the data to be compressed, thereby improving the compression ratio and compression efficiency.
[0107] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A data processing method, characterized in that: The method comprises: Get the data to be compressed; Acquire part of compressed data from the data to be compressed as reference compressed data; Compressing the reference compressed data respectively based on a specified number of compression algorithms, and obtaining the specified number of compression ratios obtained after compression; The compression algorithm corresponding to the compression ratio with the smallest median value of the specified number of compression ratios is used as the target compression algorithm; The data to be compressed is compressed based on the target compression algorithm.
2. The method according to claim 1, characterized in that The obtaining part of the compressed data from the data to be compressed as reference compressed data includes: A preset number of bytes is obtained from the data to be compressed as reference data to be compressed.
3. The method according to claim 2, characterized in that The step of obtaining the data to be compressed includes: The operating system's running data is obtained as the data to be compressed.
4. The method according to claim 2, characterized in that: The step of obtaining the data to be compressed includes: The running data of the target application is obtained as the data to be compressed.
5. The method according to claim 2, characterized in that: The data to be compressed includes at least one data type, and obtaining a preset number of bytes from the data to be compressed as reference compressed data includes: If the data to be compressed includes one data type, obtaining a preset number of bytes from the data to be compressed of the one data type as the reference compressed data; If the data to be compressed includes multiple data types, contents of preset bytes are respectively obtained from the data to be compressed of the multiple data types as the reference compressed data.
6. The method according to claim 5, characterized in that The step of obtaining a preset number of bytes from the data to be compressed as the reference compressed data includes: The content of a preset number of bytes is obtained from the data to be compressed at intervals of a preset time as the reference compressed data.
7. The method according to any one of claims 1 to 6, characterized in that: The compressing the determined data to be compressed respectively based on a specified number of compression algorithms includes: According to the same compression mode, the reference compressed data are respectively compressed based on a specified number of compression algorithms.
8. A data processing device, characterized in that: The device comprises: A first data acquisition module, used to acquire data to be compressed; A second data acquisition module, used for acquiring part of the compressed data from the data to be compressed as reference compressed data; A compression evaluation module, used to compress the reference compressed data respectively based on a specified number of compression algorithms, and obtain the specified number of compression ratios obtained after compression; An algorithm selection module, used for taking the compression algorithm corresponding to the compression ratio with the smallest median value of the specified number of compression ratios as the target compression algorithm; A data processing module is used to compress the data to be compressed based on the target compression algorithm.
9. An electronic device, characterized in that: comprising one or more processors and memory; One or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program code, wherein when the program code is executed by a processor, the method according to any one of claims 1 to 7 is executed.
