CN108427704B - Compression tool calling method and device and storage medium - Google Patents

Compression tool calling method and device and storage medium Download PDF

Info

Publication number
CN108427704B
CN108427704B CN201810010765.1A CN201810010765A CN108427704B CN 108427704 B CN108427704 B CN 108427704B CN 201810010765 A CN201810010765 A CN 201810010765A CN 108427704 B CN108427704 B CN 108427704B
Authority
CN
China
Prior art keywords
compression
file
tool
type
recommended value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810010765.1A
Other languages
Chinese (zh)
Other versions
CN108427704A (en
Inventor
兰东平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201810010765.1A priority Critical patent/CN108427704B/en
Priority to PCT/CN2018/077620 priority patent/WO2019134244A1/en
Publication of CN108427704A publication Critical patent/CN108427704A/en
Application granted granted Critical
Publication of CN108427704B publication Critical patent/CN108427704B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • G06F16/1744Redundancy elimination performed by the file system using compression, e.g. sparse files

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a compression tool calling method, a compression tool calling device and a storage medium, wherein the method comprises the following steps: responding to the operation of starting the compressed file by the user, analyzing the type and the size of the file to be compressed, and recording the compression mode and the compression tool selected by the user; after the compression is finished, recording the compression rate and the compression time of the compression tool aiming at the files of the type and the size under the compression mode; calculating a recommended value of each compression tool about the compression rate or a recommended value of compression time for each type of file under each compression mode according to a preset recommended value calculation formula every other preset period; receiving a request of compressing a file by a user and a compression mode selected by the user; and under the compression mode, selecting a compression tool corresponding to the maximum recommended value of the compression rate or the maximum recommended value of the compression time, and automatically calling the selected compression tool to compress the file. The invention realizes the optimization of the compression processing effect by selecting the optimal compression tool under the compression mode selected by the user.

Description

Compression tool calling method and device and storage medium
Technical Field
The present invention relates to the field of computers, and in particular, to a compression tool calling method, apparatus, and computer-readable storage medium.
Background
In some storage service scenarios, various types of files need to be compressed and stored to save storage space. However, the existing compression tools cannot have a high compression rate and a high compression ratio at the same time, and on the other hand, for different types of files, the compression effects of different compression tools often have great differences. Therefore, when a large number of files of different types are compressed and processed by workers, the optimization of storage service cannot be achieved, and the working efficiency is low.
Disclosure of Invention
In view of the above, the present invention provides a compression tool invoking method, apparatus and computer readable storage medium, and the main purpose of the method is to automatically select an optimal compression tool for compression according to different types of files, so as to optimize storage services.
In order to achieve the above object, the present invention provides a compression tool calling method, including:
and (3) analyzing: responding to the operation of starting the compressed file by the user each time, analyzing the type and the size of the file to be compressed, and recording the compression mode and the compression tool selected by the user;
a recording step: after the compression is finished, recording the compression rate and the compression time of the compression tool aiming at the files of the type and the size under the compression mode;
a calculation step: calculating a recommended value of each compression tool about the compression rate or a recommended value of compression time for each type of file under each compression mode according to a preset recommended value calculation formula every other preset period;
a receiving step: receiving a request of compressing a file by a user and a compression mode selected by the user;
calling: and under the compression mode, selecting a compression tool corresponding to the maximum recommended value of the compression rate or the maximum recommended value of the compression time, and automatically calling the selected compression tool to perform compression operation on the file.
Optionally, the calling step may be replaced by the displaying step: and under the mode selected by the user, showing the compression rate recommendation value or the compression time recommendation value of each compression tool to the user for the user to perform the compression operation by referring to the selected compression tool.
Optionally, the present invention further provides another compression tool invoking method, including:
and (3) analyzing: responding to the operation of starting the compressed file by the user each time, analyzing the type and the size of the file to be compressed, and recording the compression mode and the compression tool selected by the user;
a recording step: after the compression is finished, recording the compression rate and the compression time of the compression tool aiming at the files of the type and the size under the compression mode;
a first calculation step: calculating a recommended value of each compression tool about the compression rate or a recommended value of compression time for each type of file under each compression mode according to a preset recommended value calculation formula every other preset period;
a receiving step: receiving a request of compressing a file by a user and a compression mode selected by the user;
a generation step: under the compression mode selected by the user, generating a numerical range according to the compression rate recommended value or the compression time recommended value of each compression tool for the file of the type, and generating a random number in the numerical range;
a second calculation step: calculating a difference between the random number and a recommended value of each compression tool;
calling: and selecting the compression tool corresponding to the minimum difference value, and automatically calling the selected compression tool to perform compression operation on the file.
Optionally, the calling step may be replaced by the displaying step:
and according to the sequence of the difference values from small to large, different recommendation levels are distributed to each compression tool, and the compression tools are displayed for the user to refer to and select the compression tools to execute the compression operation.
Preferably, the recommendation value calculation formula includes:
under the limit compression mode, the recommended value calculation formula is as follows:
Figure BDA0001540215730000021
wherein Y is 1 Representing a compression rate recommendation, X, for a certain type of file in a certain compression tool i Representing the compression rate of the type file under the compression tool in a preset period, wherein n is a positive integer and represents the number of the type files compressed by the compression tool in the preset period, and i is (1,2, …, n);
under the extreme speed compression mode, the recommended value calculation formula is as follows:
Figure BDA0001540215730000022
wherein Y is 2 Representing a compression time recommendation, M, for a type of file in a compression tool ij /N ij Represents the ratio of the compression time and the file size of the type file under all compression tools in a preset period, M i /N i Representing the ratio of the compression time of the type file under a certain compression tool to the file size in a preset period, m is a positive integer representing the number of compression tool pressures, n is a positive integer representing the number of the type files compressed by the compression tool in the preset period, wherein i is (1,2, …,n),j=(1,2,…,m)。
in addition, the present invention also provides an electronic device, including: the compression tool calling program is executed by the processor, and the following steps can be realized:
an analysis step: responding to the operation of starting the compressed file by the user each time, analyzing the type and the size of the file to be compressed, and recording the compression mode and the compression tool selected by the user;
a recording step: after the compression is finished, recording the compression rate and the compression time of the compression tool aiming at the files of the type and the size under the compression mode;
a calculation step: calculating a recommended value of each compression tool about the compression rate or a recommended value of compression time for each type of file under each compression mode according to a preset recommended value calculation formula every other preset period;
a receiving step: receiving a request of compressing a file by a user and a compression mode selected by the user;
calling: and under the compression mode, calling a compression tool to perform compression operation on the file according to a predetermined compression rule.
Preferably, the recommendation value calculation formula includes:
under the limit compression mode, the recommended value calculation formula is as follows:
Figure BDA0001540215730000031
wherein Y is 1 Representing a compression rate recommendation, X, for a certain type of file in a certain compression tool i Representing the compression rate of the type file under the compression tool in a preset period, wherein n is a positive integer and represents the number of the type files compressed by the compression tool in the preset period, and i is (1,2, …, n);
under the extreme speed compression mode, the recommended value calculation formula is as follows:
Figure BDA0001540215730000032
wherein Y is 2 Representing a compression time recommendation, M, for a type of file in a compression tool ij /N ij Representing the ratio of the compression time to the file size of the type file under all compression tools in a preset period, M i /N i Representing the ratio of the compression time of the type file under a certain compression tool to the file size in the preset period, m is a positive integer representing the number of compression tool pressures, n is a positive integer representing the number of the type files compressed by the compression tool in the preset period, wherein i is (1,2, …, n), and j is (1,2, …, m).
Optionally, the predetermined compression rule includes: and selecting the compression tool corresponding to the maximum recommended value of the compression rate or the maximum recommended value of the compression time.
Optionally, the predetermined compression rule includes:
under the compression mode selected by the user, generating a numerical range according to the compression rate recommended value or the compression time recommended value of each compression tool for the file of the type, and generating a random number in the numerical range;
and calculating the difference value of the random number and the recommended value of each compression tool, and selecting the compression tool corresponding to the minimum difference value.
In addition, to achieve the above object, the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a compression tool calling program, and when the compression tool calling program is executed by a processor, any step in the compression tool calling method may be implemented.
According to the compression tool calling method, the electronic device and the computer readable storage medium, the compression tool with the maximum compression rate recommendation value or the maximum compression time recommendation value is automatically called to compress the file under the compression mode selected by the user according to the type and the size of the file to be compressed by receiving the file compression request of the user, so that the storage space is saved, and the working efficiency is improved.
Drawings
FIG. 1 is a diagram of an electronic device according to a preferred embodiment of the present invention;
FIG. 2 is a block diagram of a preferred embodiment of the compression tool invocation program of FIG. 1;
FIG. 3 is a flowchart of a first embodiment of a compression tool invocation method of the present invention;
FIG. 4 is a flowchart of a compression tool invoking method according to a second embodiment of the present invention;
FIG. 5 is a flowchart illustrating a third exemplary embodiment of a compression tool invocation method;
FIG. 6 is a flowchart illustrating a fourth exemplary embodiment of a compression tool invocation method;
FIG. 7 is a diagram of an application environment of a compression tool calling method according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Fig. 1 is a schematic diagram of an electronic device 1 according to a preferred embodiment of the invention.
In the embodiment, the electronic device 1 may be a server, a smart phone, a tablet computer, a personal computer, a portable computer, and other electronic devices with an arithmetic function.
The electronic device 1 includes: memory 11, processor 12, display 13, network interface 14, and communication bus 15. The network interface 14 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), among others. The communication bus 15 is used to realize connection communication between these components.
The memory 11 includes at least one type of readable storage medium. The at least one type of readable storage medium may be a non-volatile storage medium such as a flash memory, a hard disk, a multimedia card, a card-type memory, and the like. In some embodiments, the memory 11 may be an internal storage unit of the electronic device 1, such as a hard disk of the electronic device 1. In other embodiments, the memory 11 may also be an external storage unit of the electronic device 1, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device 1.
In the present embodiment, the memory 11 can be used not only for storing the application software installed in the electronic device 1 and various types of data, such as the compression tool calling program 10, various types of compression tools 16, and records of compression time and compression rate of various types and sizes of files in each compression tool, but also for temporarily storing data that has been output or will be output.
The processor 12 may be a Central Processing Unit (CPU), microprocessor or other data Processing chip in some embodiments, and is used for executing program codes stored in the memory 11 or Processing data, such as computer program codes for executing the compression tool calling program 10.
The display 13 may be referred to as a display screen or display unit. In some embodiments, the display 13 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an Organic Light-Emitting Diode (OLED) touch screen, or the like. The display 13 is used for displaying information processed in the electronic device 1 and for displaying a visual work interface, such as a compression mode selection page.
Preferably, the electronic device 1 may further comprise a user interface, which may comprise an input unit such as a Keyboard (Keyboard), a voice output device such as a sound box, a headset, etc., and optionally a standard wired interface, a wireless interface.
In the embodiment of the apparatus shown in fig. 1, the memory 11 as a computer storage medium stores the program code of the compression tool calling program 10, and when the processor 12 executes the program code of the compression tool calling program 10, the following steps are implemented:
and (3) analyzing: responding to the operation of starting the compressed file by the user each time, analyzing the type and the size of the file to be compressed, and recording the compression mode and the compression tool selected by the user;
a recording step: after the compression is finished, recording the compression rate and the compression time of the compression tool aiming at the files of the type and the size under the compression mode;
a calculation step: calculating a recommended value of each compression tool about the compression rate or a recommended value of compression time for each type of file under each compression mode according to a preset recommended value calculation formula every other preset period;
a receiving step: receiving a request of compressing a file by a user and a compression mode selected by the user;
calling: and under the compression mode, selecting a compression tool corresponding to the maximum recommended value of the compression rate or the maximum recommended value of the compression time, and automatically calling the selected compression tool to perform compression operation on the file.
In this embodiment, the compression tool calling program 10 responds to the operation of starting the compression file by the user each time, analyzes the type and size of the file to be compressed, and records the compression mode and the compression tool selected by the user. For example, when a user compresses a picture file, a compression tool calling program automatically analyzes the type and the occupied space size of the picture file to be compressed, and records a compression mode and a compression tool selected by the user. Wherein the file types include: multimedia files (e.g., audio files, video files, image files, etc.), document class files (e.g., doc files, txt files, xls files, etc.), and executable files (e.g., exe file installation packages, etc.). The compression rate and compression time for compressing files by different compression tools are different for different types and sizes of files. For example, the compression rates of fastlz and lz4 for 2M txt files are 14% and 18%, respectively, and the compression times are 4s and 6s, respectively. The compression mode includes an extreme compression mode and a very high compression mode. The extreme compression mode mainly focuses on the compression rate of the file, and the extreme compression mode mainly focuses on the compression time of the file.
After the compression is completed, the compression tool calling program 10 records the compression rate and the compression time of the compression tool for the file of the type and size under the compression mode. For example, the user selects the limit compression mode, and the called compression tool is WinRAR, after the compression is completed, the compression mode, the compression tool, the file type, the file size, the compression rate, and the compression time are recorded as follows: limit compression mode-WinRAR-picture file-4M-28% -10 s. Wherein the compression tool comprises: one or more compression tools such as fastlz, lz4, snappy, deflate, WinRAR, WinZip, zlib and the like.
The compression tool calling program 10 calculates a recommended value of each compression tool with respect to the compression rate or a recommended value of the compression time for each type of file in each compression mode according to a preset recommended value calculation formula every preset period. For example, in the last night of each month, the compression tool calling program automatically calculates the recommended value of each file in each compression tool according to the compression rate and the compression time of each type of file in each compression tool recorded in the month by using a preset recommended value calculation formula.
Wherein the preset recommended value calculation formula comprises:
under the limit compression mode, the recommended value calculation formula is as follows:
Figure BDA0001540215730000071
wherein Y is 1 Representing a compression rate recommendation, X, for a certain type of file in a certain compression tool i The compression rate of the type file in the preset period under the compression tool is represented, and n is a positive integer and represents the number of the type files compressed by the compression tool in the preset period. For example, in a preset period, if the compression rate of the winter rar for doc files is 30% and 28%, the recommended value calculation formula is used:
Figure BDA0001540215730000072
the compression rate recommendation value of doc file in WinRAR is calculated to be 71.
In the extreme speed compression mode, the recommended value calculation formula is as follows:
Figure BDA0001540215730000073
Figure BDA0001540215730000074
wherein Y2 representsCompression time recommendation value, M, for a certain type of file in a certain compression tool ij /N ij Representing the ratio of the compression time to the file size of the type file under all compression tools in a preset period, M i /N i Representing the ratio of the compression time of the type file under a certain compression tool to the file size in a preset period, m is a positive integer representing the number of compression tool pressures, and n is a positive integer representing the number of the type files compressed by the compression tool in the preset period. Assuming that only two compression tools of WinRAR and WinZip are available in the compression tools, and the compression time is 8s and 4s respectively for a jpg picture file of 4M, a recommended value calculation formula is utilized:
Figure BDA0001540215730000075
the compression time recommendation values of the jpg picture file in WinRAR and WinZip are respectively 10 and 40.
When a user needs to compress the multimedia file, selecting a proper compression mode on the compression mode selection page. The compression tool calling program 10 receives a request for compressing a file from a user and a compression mode selected by the user. For example, a 4M jpg picture file and a user selected extreme speed compression mode are received.
The compression tool calling program 10 automatically calls the compression tool with the maximum compression rate recommendation value or the maximum compression time recommendation value to execute the compression operation on the file to be compressed according to the compression mode selected by the user. For example, in the extreme speed compression mode, assuming that the file to be compressed is a 4M jpg picture file and only two compression tools of WinRAR and WinZip are available among the compression tools, and the compression time recommendation values of the 4M jpg picture file in WinRAR and WinZip are 10 and 40 respectively, WinZip is called to compress the 4M jpg picture file.
In another embodiment, a recommended compression rate value or a recommended compression time value of the file to be compressed in each compression tool in the selected compression mode may be displayed to the user, and the user selects an appropriate compression tool to perform the compression operation according to the service scenario. For example, in the extreme speed compression mode, the compression time recommendation values of WinRAR and WinZip of the jpg picture file displayed in 4M are 10 and 40 respectively, and even if the compression time of WinRAR is long, if the distortion of the compression of the WinRAR is small, the user can still select the WinRAR to compress the file.
The compression tool calling method provided in the above embodiment queries the compression rate recommended value or the compression time recommended value of the file to be compressed in each compression tool according to the compression mode selected by the user, and automatically calls the optimal compression tool to perform compression processing on the file, thereby reducing manual compression operation of the staff and improving the service processing efficiency.
Fig. 2 is a block diagram of the compression tool calling program 10 of fig. 1 according to an embodiment. The modules referred to herein are referred to as a series of computer program instruction segments capable of performing specified functions.
In this embodiment, the compression tool calling program 10 includes: the parsing module 110, the recording module 120, the calculating module 130, the receiving module 140, and the invoking module 150, the functions or operation steps implemented by the modules 110 and 150 are similar to those described above, and are not detailed here, for example, where:
the analysis module 110 is configured to respond to an operation of starting the compressed file by a user each time, analyze the type and size of the file to be compressed, and record a compression mode and a compression tool selected by the user;
a recording module 120, configured to record, after the compression is completed, a compression rate and a compression time of the compression tool for the file of the type and size in the compression mode;
the calculation module 130 is configured to calculate, every preset period, a recommended value of each compression tool with respect to a compression rate or a recommended value of compression time for each type of file in each compression mode according to a preset recommended value calculation formula;
a receiving module 140, configured to receive a request for compressing a file from a user and a compression mode selected by the user;
the invoking module 150 is configured to select a compression tool corresponding to the maximum recommended value of the compression rate or the maximum recommended value of the compression time in the compression mode, and automatically invoke the selected compression tool to perform a compression operation on the file.
Fig. 3 is a flow chart of a first embodiment of the compression tool calling method according to the present invention.
In this embodiment, the implementation of the compression tool calling method when the processor 12 executes the computer program of the compression tool calling program 10 stored in the memory 11 includes: step S10-step S50:
step S10, as shown in fig. 7, is an application environment diagram of the compression tool calling method of the present invention, where the compression tool calling program 10 responds to the operation of the user to start compressing the file each time, analyzes the type and size of the file to be compressed, and records the compression mode and the compression tool selected by the user. Wherein the compression tools are stored in a compression tool library 16. For example, when a user compresses a picture file, a compression tool calling program automatically analyzes the type and the occupied space size of the picture file to be compressed, and records a compression mode and a compression tool selected by the user. Wherein the file types include: multimedia files (e.g., audio files, video files, image files, etc.), document class files (e.g., doc files, txt files, xls files, etc.), and executable files (e.g., exe file installation packages, etc.). The compression rate and compression time for compressing files by different compression tools are different for different types and sizes of files. For example, the compression rates of fastlz and lz4 for 2M txt files are 14% and 18%, respectively, and the compression times are 4s and 6s, respectively. The compression mode includes an extreme compression mode and a very high compression mode. The extreme compression mode mainly focuses on the compression rate of the file, and the extreme compression mode mainly focuses on the compression time of the file.
In step S20, after the compression is completed, the compression tool calling program 10 records the compression rate and the compression time of the compression tool for the file of the type and size under the compression mode. For example, the user selects the limit compression mode, and the called compression tool is WinRAR, after the compression is completed, the compression mode, the compression tool, the file type, the file size, the compression rate, and the compression time are recorded as follows: limit compression mode-WinRAR-picture file-4M-28% -10 s. Wherein the compression tool comprises: one or more compression tools such as fastlz, lz4, snappy, deflate, WinRAR, WinZip, zlib and the like.
In step S30, the compression tool calling program 10 calculates, for each compression mode, a recommended value of the compression rate or a recommended value of the compression time for each type of file for each compression tool according to a preset recommended value calculation formula every preset period. For example, in the last night of each month, the compression tool calling program automatically calculates the recommended value of each file in each compression tool according to the compression rate and the compression time of each type of file in each compression tool recorded in the month by using a preset recommended value calculation formula.
Wherein the preset recommended value calculation formula comprises:
under the limit compression mode, the recommended value calculation formula is as follows:
Figure BDA0001540215730000091
wherein Y is 1 Representing a compression rate recommendation, X, for a certain type of file in a certain compression tool i The compression rate of the type file in the preset period under the compression tool is represented, and n is a positive integer and represents the number of the type files compressed by the compression tool in the preset period. For example, in a preset period, if the compression rate of the winter rar for doc files is 30% and 28%, the recommended value calculation formula is used:
Figure BDA0001540215730000092
the compression rate recommendation value of doc file in WinRAR is calculated to be 71.
In the extreme speed compression mode, the recommended value calculation formula is as follows:
Figure BDA0001540215730000101
Figure BDA0001540215730000102
where Y2 represents the compression time recommendation for a type of file in a compression tool, M ij /N ij Representing the ratio of the compression time to the file size of the type file under all compression tools in a preset period, M i /N i Representing the ratio of the compression time of the type file under a certain compression tool to the file size in a preset period, m is a positive integer representing the number of compression tools, n isAnd the positive integer represents the number of the type files compressed by the compression tool in a preset period. Assuming that only two compression tools of WinRAR and WinZip are available in the compression tools, and the compression time is 8s and 4s respectively for a jpg picture file of 4M, a recommended value calculation formula is utilized:
Figure BDA0001540215730000103
the compression time recommendation values of the jpg picture file in WinRAR and WinZip are respectively 10 and 40.
In step S50, the compression tool calling program 10 automatically calls the compression tool with the maximum recommended compression ratio value or the maximum recommended compression time value from the compression tool set 16 to perform compression on the file to be compressed according to the compression mode selected by the user. For example, in the extreme speed compression mode, assuming that the file to be compressed is a 4M jpg picture file and only two compression tools of WinRAR and WinZip are available among the compression tools, and the compression time recommendation values of the 4M jpg picture file in WinRAR and WinZip are 10 and 40 respectively, WinZip is called to compress the 4M jpg picture file.
In another embodiment, as shown in FIG. 4, it is a flow chart of the second embodiment of the compression tool calling method of the present invention. Step S50 may also be displaying, to the user, a recommended compression rate value or a recommended compression time value of the file to be compressed in each compression tool in the selected compression mode, and the user selects a suitable compression tool to perform the compression operation according to the service scenario. For example, in the extreme speed compression mode, the compression time recommendation values of WinRAR and WinZip of the jpg picture file displayed in 4M are 10 and 40 respectively, and even if the compression time of WinRAR is long, if the distortion of the compression of the WinRAR is small, the user can still select the WinRAR to compress the file.
The compression tool calling method provided by the embodiment provides the compression mode for the user, and calls the compression tool most suitable for the service scene to perform compression operation on the file according to the compression rate recommended value or the compression time recommended value of the file to be compressed in each compression tool under the compression mode selected by the user, so that the file storage space is saved, and the compression performance is improved.
Fig. 5 is a flowchart of a third embodiment of the compression tool invoking method according to the present invention.
In this embodiment, the compression tool calling method includes: step S10-step S70. The contents of steps S10-S40 are substantially the same as those in the first embodiment, and are not described herein again.
In the compression mode selected by the user, the compression tool calling program 10 generates a numerical range in which a random number is generated according to the compression rate recommendation value or the compression time recommendation value of each compression tool for the type of file at step S50. For example, in the extreme compression mode, the recommended compression time values of the 2Mtxt file in the fastlz, lz4 and snappy compression tools are 10, 20 and 60 respectively, the minimum value of the random number generated by the compression tool calling program 10 is 0, the maximum value is 90, and a random number is generated, assuming that the random number is 30.
In step S60, the compression tool calling program 10 calculates a difference between the generated random number and the recommended value for each compression tool based on the random number. For example, the random number is 30, and the difference value between the random number and the compression time recommendation value (10, 20, 60) of the 2Mtxt file in three compression tools of fastlz, lz4 and snappy is 20, 10 and 30 respectively.
In step S70, the compression tool calling program 10 selects the compression tool corresponding to the minimum difference value from the compression tool set 16, and automatically calls the compression tool to perform a compression operation on the file. The automatic mode is suitable for a large number of file compression applications. For example, according to the random number 30, the difference values with the compression time recommendation values in three compression tools of fastlz, lz4 and snappy are respectively 20, 10 and 30, and the compression tool (lz4) with the minimum difference value is automatically selected to compress the file.
In another embodiment, as shown in fig. 6, it is a flow chart of the fourth embodiment of the compression tool calling method of the present invention. Step S70 may also be to assign different recommendation levels to each compression tool according to the order of the difference from small to large, and to present the user with a reference selection. The recommended mode is applicable to a small number of file compression requests. For example, by assigning the highest recommendation level to lz4, the next highest recommendation level to fastlz, and the lowest recommendation level to snappy, based on the difference values of 20, 10, and 30, the user may select a compression tool from the set of compression tools 16 for file compression based on the recommendation levels.
Compared with the first embodiment, the compression tool calling method provided by the embodiment generates a numerical range according to the recommended value of the file to be compressed in each compression tool, generates a random number in the range, and then adopts a mode of combining the recommended value with the random number, so that the compression tool with a smaller recommended value is also called to execute compression operation with a certain probability, and the burden of the compression tool with a larger recommended value is reduced.
Furthermore, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a compression tool calling program 10, and when executed by a processor, the compression tool calling program 10 implements the following operations:
and (3) analyzing: responding to the operation of starting the compressed file by the user each time, analyzing the type and the size of the file to be compressed, and recording the compression mode and the compression tool selected by the user;
a recording step: after the compression is finished, recording the compression rate and the compression time of the compression tool aiming at the files of the type and the size under the compression mode;
a calculation step: calculating a recommended value of each compression tool about the compression rate or a recommended value of compression time for each type of file under each compression mode according to a preset recommended value calculation formula every other preset period;
a receiving step: receiving a request of compressing a file by a user and a compression mode selected by the user;
calling: and under the compression mode, selecting a compression tool corresponding to the maximum recommended value of the compression rate or the maximum recommended value of the compression time, and automatically calling the selected compression tool to perform compression operation on the file.
Optionally, the calling step may be replaced by the displaying step: and under the mode selected by the user, showing the compression rate recommendation value or the compression time recommendation value of each compression tool to the user for the user to perform the compression operation by referring to the selected compression tool.
Optionally, the present invention further provides another compression tool invoking method, including:
and (3) analyzing: responding to the operation of starting the compressed file by the user each time, analyzing the type and the size of the file to be compressed, and recording the compression mode and the compression tool selected by the user;
a recording step: after the compression is finished, recording the compression rate and the compression time of the compression tool aiming at the files of the type and the size under the compression mode;
a first calculation step: calculating a recommended value of each compression tool about the compression rate or a recommended value of compression time for each type of file under each compression mode according to a preset recommended value calculation formula every other preset period;
a receiving step: receiving a request of compressing a file by a user and a compression mode selected by the user;
a generation step: under the compression mode selected by the user, generating a numerical range according to the compression rate recommended value or the compression time recommended value of each compression tool for the file of the type, and generating a random number in the numerical range;
a second calculation step: calculating a difference between the random number and a recommended value for each compression tool;
calling: and selecting the compression tool corresponding to the minimum difference value, and automatically calling the selected compression tool to perform compression operation on the file.
Optionally, the calling step may be replaced by the displaying step:
and according to the sequence from small to large of the difference, different recommendation levels are distributed to each compression tool, and are displayed to the user for referring to the selected compression tool to execute the compression operation.
Preferably, the recommendation value calculation formula includes:
under the limit compression mode, the recommended value calculation formula is as follows:
Figure BDA0001540215730000131
wherein Y is 1 Compression rate recommendations representing certain types of files in certain compression toolsValue, X i Representing the compression rate of the type file under the compression tool in a preset period, wherein n is a positive integer and represents the number of the type files compressed by the compression tool in the preset period, and i is (1,2, …, n);
under the extreme speed compression mode, the recommended value calculation formula is as follows:
Figure BDA0001540215730000132
wherein Y is 2 Representing a compression time recommendation, M, for a type of file in a compression tool ij /N ij Representing the ratio of the compression time to the file size of the type file under all compression tools in a preset period, M i /N i Representing the ratio of the compression time of the type file under a certain compression tool to the file size in the preset period, m is a positive integer representing the number of compression tool pressures, n is a positive integer representing the number of the type files compressed by the compression tool in the preset period, wherein i is (1,2, …, n), and j is (1,2, …, m).
The embodiment of the computer readable storage medium of the present invention is substantially the same as the embodiment of the compression tool invoking method, and will not be described herein again.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (8)

1. A compression tool invocation method, characterized in that the method comprises:
and (3) analyzing: responding to the operation that a user starts a compressed file each time, analyzing the type and the size of the file to be compressed, and recording a compression mode and a compression tool selected by the user, wherein the compression mode comprises an extreme compression mode and a maximum compression mode;
a recording step: after the compression is finished, recording the compression rate and the compression time of the compression tool aiming at the files of the type and the size under the compression mode;
a calculation step: calculating a recommended value of each compression tool about the compression rate or the recommended value of the compression time for each type of file under each compression mode according to a preset recommended value calculation formula every other preset period, wherein the recommended value calculation formula comprises:
under the limit compression mode, the recommended value calculation formula is as follows:
Figure FDA0003577491510000011
wherein Y is 1 Representing a compression rate recommendation, X, for a certain type of file in a certain compression tool i Representing the compression rate of the type file under the compression tool in a preset period, wherein n is a positive integer and represents the number of the type files compressed by the compression tool in the preset period, and i is (1,2, …, n);
under the extreme speed compression mode, the recommended value calculation formula is as follows:
Figure FDA0003577491510000012
wherein Y is 2 Representing a compression time recommendation, M, for a type of file in a compression tool ij /N ij Representing the ratio of the compression time to the file size of the type file under all compression tools in a preset period, M i /N i Representing the ratio of the compression time of the type file under a certain compression tool to the file size in a preset period, m is a positive integer and represents the number of compression tool pressures, n is a positive integer and represents the number of the type files compressed by the compression tool in the preset period, wherein i is (1,2, …, n), and j is (1,2, …, m);
a receiving step: receiving a request of compressing a file by a user and a compression mode selected by the user;
calling: and under the compression mode, selecting a compression tool corresponding to the maximum recommended value of the compression rate or the maximum recommended value of the compression time, and automatically calling the selected compression tool to perform compression operation on the file.
2. The compression tool invocation method according to claim 1, wherein the invocation step may be replaced with a presentation step: and under the mode selected by the user, showing the compression rate recommendation value or the compression time recommendation value of each compression tool to the user for the user to perform the compression operation by referring to the selected compression tool.
3. A compression tool invocation method, characterized in that the method comprises:
and (3) analyzing: responding to the operation of starting a compressed file by a user each time, analyzing the type and the size of the file to be compressed, and recording a compression mode and a compression tool selected by the user, wherein the compression mode comprises a limit compression mode and a maximum speed compression mode;
a recording step: after the compression is finished, recording the compression rate and the compression time of the compression tool aiming at the files of the type and the size under the compression mode;
a first calculation step: calculating a recommended value of each compression tool about the compression rate or the recommended value of the compression time for each type of file under each compression mode according to a preset recommended value calculation formula every other preset period, wherein the recommended value calculation formula comprises:
under the limit compression mode, the recommended value calculation formula is as follows:
Figure FDA0003577491510000021
wherein Y is 1 Representing a compression rate recommendation, X, for a certain type of file in a certain compression tool i Representing the compression rate of the type file under the compression tool in a preset period, wherein n is a positive integer and represents the number of the type files compressed by the compression tool in the preset period, and i is (1,2, …, n);
under the extreme speed compression mode, the recommended value calculation formula is as follows:
Figure FDA0003577491510000022
wherein Y is 2 Representing a compression time recommendation, M, for a type of file in a compression tool ij /N ij Representing the ratio of the compression time to the file size of the type file under all compression tools in a preset period, M i /N i Representing the ratio of the compression time of the type file under a certain compression tool to the file size in a preset period, m is a positive integer and represents the number of compression tool pressures, n is a positive integer and represents the number of the type files compressed by the compression tool in the preset period, wherein i is (1,2, …, n), and j is (1,2, …, m);
a receiving step: receiving a file compression request of a user and a compression mode selected by the user;
a generation step: under the compression mode selected by the user, generating a numerical range according to the compression rate recommended value or the compression time recommended value of each compression tool for the file of the type, and generating a random number in the numerical range;
a second calculation step: calculating a difference between the random number and a recommended value for each compression tool;
calling: and selecting the compression tool corresponding to the minimum difference value, and automatically calling the selected compression tool to perform compression operation on the file.
4. The compression tool calling method according to claim 3, wherein the calling step can be replaced by a presentation step of:
and according to the sequence of the difference values from small to large, different recommendation levels are distributed to each compression tool, and the compression tools are displayed for the user to refer to and select the compression tools to execute the compression operation.
5. An electronic device, the device comprising: the compression tool calling program is executed by the processor, and the following steps can be realized:
and (3) analyzing: responding to the operation of starting a compressed file by a user each time, analyzing the type and the size of the file to be compressed, and recording a compression mode and a compression tool selected by the user, wherein the compression mode comprises a limit compression mode and a maximum speed compression mode;
a recording step: after the compression is finished, recording the compression rate and the compression time of the compression tool aiming at the files of the type and the size under the compression mode;
a calculation step: calculating a recommended value of each compression tool about the compression rate or the recommended value of the compression time for each type of file under each compression mode according to a preset recommended value calculation formula every other preset period, wherein the recommended value calculation formula comprises:
under the limit compression mode, the recommended value calculation formula is as follows:
Figure FDA0003577491510000031
wherein Y is 1 Representing a compression rate recommendation for a certain type of file in a certain compression tool,X i representing the compression rate of the type file under the compression tool in a preset period, wherein n is a positive integer and represents the number of the type files compressed by the compression tool in the preset period, and i is (1,2, …, n);
under the extreme speed compression mode, the recommended value calculation formula is as follows:
Figure FDA0003577491510000041
wherein Y is 2 Representing a compression time recommendation, M, for a type of file in a compression tool ij /N ij Representing the ratio of the compression time to the file size of the type file under all compression tools in a preset period, M i /N i Representing the ratio of the compression time of the type file under a certain compression tool to the file size in a preset period, m is a positive integer and represents the number of compression tool pressures, n is a positive integer and represents the number of the type files compressed by the compression tool in the preset period, wherein i is (1,2, …, n), and j is (1,2, …, m);
a receiving step: receiving a request of compressing a file by a user and a compression mode selected by the user;
calling: and under the compression mode, calling a compression tool to perform compression operation on the file according to a predetermined compression rule.
6. The electronic device of claim 5, wherein the predetermined compression rule comprises: and selecting the compression tool corresponding to the maximum recommended value of the compression rate or the maximum recommended value of the compression time.
7. The electronic device of claim 5, wherein the predetermined compression rule comprises:
under the compression mode selected by the user, generating a numerical range according to the compression rate recommended value or the compression time recommended value of each compression tool for the file of the type, and generating a random number in the numerical range;
and calculating the difference value of the random number and the recommended value of each compression tool, and selecting the compression tool corresponding to the minimum difference value.
8. A computer-readable storage medium, comprising a compression tool calling program, which when executed by a processor, implements the steps of the compression tool calling method of any one of claims 1 to 4.
CN201810010765.1A 2018-01-05 2018-01-05 Compression tool calling method and device and storage medium Active CN108427704B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201810010765.1A CN108427704B (en) 2018-01-05 2018-01-05 Compression tool calling method and device and storage medium
PCT/CN2018/077620 WO2019134244A1 (en) 2018-01-05 2018-02-28 Method for calling compression tool, device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810010765.1A CN108427704B (en) 2018-01-05 2018-01-05 Compression tool calling method and device and storage medium

Publications (2)

Publication Number Publication Date
CN108427704A CN108427704A (en) 2018-08-21
CN108427704B true CN108427704B (en) 2022-08-09

Family

ID=63155843

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810010765.1A Active CN108427704B (en) 2018-01-05 2018-01-05 Compression tool calling method and device and storage medium

Country Status (2)

Country Link
CN (1) CN108427704B (en)
WO (1) WO2019134244A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112835479A (en) * 2019-11-25 2021-05-25 腾讯科技(深圳)有限公司 Compressed file viewing method, device, equipment and readable storage medium
CN111683189B (en) * 2020-05-14 2023-04-07 苏州达家迎信息技术有限公司 Picture compression method, system, terminal and storage medium
CN111817722A (en) * 2020-07-09 2020-10-23 北京奥星贝斯科技有限公司 Data compression method and device and computer equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102684705A (en) * 2012-05-30 2012-09-19 奇智软件(北京)有限公司 Method and device for data compression
CN102761540A (en) * 2012-05-30 2012-10-31 北京奇虎科技有限公司 Data compression method, device and system and server
CN102761339A (en) * 2012-05-30 2012-10-31 北京奇虎科技有限公司 Data compression method and device
CN102957906A (en) * 2011-08-29 2013-03-06 广州九游信息技术有限公司 Method and system for image classifying compression
CN103761153A (en) * 2012-05-02 2014-04-30 北京奇虎科技有限公司 Resource calling method and device of compress software

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101095284B (en) * 2004-12-28 2012-04-18 卡西欧电子工业株式会社 Device and data method for selective compression and decompression and data format for compressed data
US7420992B1 (en) * 2005-03-17 2008-09-02 Packeteer, Inc. Adaptive network traffic compression mechanism including dynamic selection of compression algorithms
CN100573385C (en) * 2007-06-01 2009-12-23 华南理工大学 A kind of distributed type double real-time compression method and system
CN102820888B (en) * 2012-06-05 2016-02-03 大唐移动通信设备有限公司 A kind of data compression method and system
GB2530012A (en) * 2014-08-05 2016-03-16 Illumina Cambridge Ltd Methods and systems for data analysis and compression

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102957906A (en) * 2011-08-29 2013-03-06 广州九游信息技术有限公司 Method and system for image classifying compression
CN103761153A (en) * 2012-05-02 2014-04-30 北京奇虎科技有限公司 Resource calling method and device of compress software
CN102684705A (en) * 2012-05-30 2012-09-19 奇智软件(北京)有限公司 Method and device for data compression
CN102761540A (en) * 2012-05-30 2012-10-31 北京奇虎科技有限公司 Data compression method, device and system and server
CN102761339A (en) * 2012-05-30 2012-10-31 北京奇虎科技有限公司 Data compression method and device

Also Published As

Publication number Publication date
CN108427704A (en) 2018-08-21
WO2019134244A1 (en) 2019-07-11

Similar Documents

Publication Publication Date Title
CN110008045B (en) Method, device and equipment for aggregating microservices and storage medium
CN108427704B (en) Compression tool calling method and device and storage medium
CN110888842A (en) File storage method, file query method, file storage device, file query device and file query equipment
CN105631035A (en) Data storage method and device
US20200210411A1 (en) Data storage in blockchain-type ledger
CN109471893B (en) Network data query method, equipment and computer readable storage medium
CN110968585A (en) Method, device and equipment for storing orientation column and computer readable storage medium
CN111680477A (en) Method and device for exporting spreadsheet file, computer equipment and storage medium
CN110597461B (en) Data storage method, device and equipment in block chain type account book
CN110929131A (en) Data export method, device, equipment and storage medium
CN105653674B (en) File management method and system of intelligent terminal
CN108053459B (en) Signature file synthesis method, application server and computer readable storage medium
CN106293658B (en) Interface component generation method and equipment
CN109614600A (en) Report methods of exhibiting, device and computer storage medium
CN109739548B (en) Program packaging method, program packaging device and computer readable storage medium
CN108052521B (en) Coordinated data display method, application server and storage medium
CN109271543B (en) Thumbnail display method and device, terminal and computer-readable storage medium
US20130139085A1 (en) Operation Support Computer Program, Operation Support Computer System
CN110597462A (en) Data storage method, system, device and equipment in block chain type account book
CN113626099B (en) Application program starting method and device and electronic equipment
CN105469433B (en) Picture compression method and equipment thereof
CN111143293B (en) Metadata acquisition method, device, equipment and computer readable storage medium
CN114090070A (en) Application program installation package file processing method and electronic equipment
CN112783578A (en) Method, device and equipment for starting task flow and storage medium
CN106843884B (en) Query data processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant