CN114238250A - Program file compression method and device and electronic equipment - Google Patents

Program file compression method and device and electronic equipment Download PDF

Info

Publication number
CN114238250A
CN114238250A CN202111296092.9A CN202111296092A CN114238250A CN 114238250 A CN114238250 A CN 114238250A CN 202111296092 A CN202111296092 A CN 202111296092A CN 114238250 A CN114238250 A CN 114238250A
Authority
CN
China
Prior art keywords
data
compression
program file
instruction node
function
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.)
Pending
Application number
CN202111296092.9A
Other languages
Chinese (zh)
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.)
Qax Technology Group Inc
Qianxin Safety Technology Zhuhai Co Ltd
Original Assignee
Qax Technology Group Inc
Qianxin Safety Technology Zhuhai 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 Qax Technology Group Inc, Qianxin Safety Technology Zhuhai Co Ltd filed Critical Qax Technology Group Inc
Priority to CN202111296092.9A priority Critical patent/CN114238250A/en
Publication of CN114238250A publication Critical patent/CN114238250A/en
Pending legal-status Critical Current

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
    • 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/1737Details of further file system functions for reducing power consumption or coping with limited storage space, e.g. in mobile devices

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)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention provides a program file compression method, a device and electronic equipment, wherein the method comprises the following steps: acquiring at least one function in a target program file; determining a compression mode corresponding to the data of the instruction node according to the data length of the instruction node of the function; the compression mode is used for expressing the data length adopted when the data of the instruction node is compressed; and writing the data of the instruction node of the function into a compression program file corresponding to the target program file based on the compression mode so as to compress the data of the instruction node of the function through the compression program file. According to the data length of the instruction node of the function in the target program file, the compression mode corresponding to the data of the instruction node of the function is determined, the compression of the data of the instruction node of the function in the target program file by the compression program file is realized, and the data storage space can be saved.

Description

Program file compression method and device and electronic equipment
Technical Field
The present invention relates to the field of data compression technologies, and in particular, to a method and an apparatus for compressing a program file, and an electronic device.
Background
With the continuous development of computer technology, program files in computers occupy larger and larger storage space, and have higher and higher requirements on system storage performance.
In the related art, a program file is generally stored in a database; specifically, the program file is stored in the database in a set fixed byte compression manner. However, when the number of bytes actually occupied by the data in the program file is less than the fixed number of bytes, the storage space is wasted, and the storage efficiency and the transmission efficiency of the program file are also affected.
Disclosure of Invention
To solve the problems in the related art, embodiments of the present invention provide a method and an apparatus for compressing a program file, and an electronic device, so as to solve the problem of storage space waste caused by storing the program file in a fixed byte manner in the related art.
Specifically, the embodiment of the invention provides the following technical scheme:
in a first aspect, an embodiment of the present invention provides a method for compressing a program file, where the method includes:
acquiring at least one function in a target program file;
determining a compression mode corresponding to the data of the instruction node according to the data length of the instruction node of the function; the compression mode is used for expressing the data length adopted when the data of the instruction node is compressed;
and writing the data of the instruction node of the function into a compression program file corresponding to the target program file based on the compression mode so as to compress the data of the instruction node of the function through the compression program file.
Further, the determining, according to the data length of the instruction node of the function, a compression mode corresponding to the data of the instruction node includes:
determining a compression mode corresponding to the data of the instruction node according to the target compression relationship and the data length of the instruction node; the target compression relation is used for representing the corresponding relation between the numerical range and the compression mode.
Further, the compression method comprises the following steps: and the indication information is used for indicating a corresponding compression mode by adopting different identifications.
Further, the determining a compression mode corresponding to the data length of the instruction node according to the target compression relationship and the data length of the instruction node includes:
determining a target numerical value range corresponding to the length of the data of the instruction node according to the target compression relationship;
and determining a compression mode corresponding to the data of the instruction node according to the target numerical range and the target compression relationship.
Further, the data of the instruction node includes: the writing of the data of the instruction node of the function into the compressed program file corresponding to the target program file based on the compression mode comprises:
and sequentially writing the header information of the instruction node and the data content of the instruction node into the compressed program file based on the data length indicated by the compression mode.
Further, after writing the data of the instruction node of the function into the compressed program file corresponding to the target program file, the method further includes:
judging whether the target program file still has data of an instruction node to be compressed;
and if so, writing the data of the instruction nodes to be compressed into the compression program file based on the determined compression mode until the data of all the instruction nodes in the target program file are processed.
In a second aspect, an embodiment of the present invention further provides a program file compression apparatus, where the apparatus includes:
the acquisition module is used for acquiring at least one function in the target program file;
the determining module is used for determining a compression mode corresponding to the data of the instruction node according to the data length of the instruction node of the function; the compression mode is used for expressing the data length adopted when the data of the instruction node is compressed;
and the compression module is used for writing the data of the instruction node of the function into a compression program file corresponding to the target program file based on the compression mode so as to compress the data of the instruction node of the function through the compression program file.
In a third aspect, an embodiment of the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the program file compression method according to the first aspect when executing the program.
In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the program file compression method according to the first aspect.
In a fifth aspect, the present invention further provides a computer program product, on which executable instructions are stored, and when executed by a processor, the instructions cause the processor to implement the steps of the program file compression method according to the first aspect.
According to the program file compression method provided by the embodiment of the invention, the compression mode corresponding to the data of the instruction node is dynamically determined according to the data length of the instruction node of the function in the target program file, and the data length indicated by the compression mode is adopted to write the data of the instruction node into the compression program file corresponding to the target program file, so that the data of the instruction node is compressed, and the storage space of the data is saved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a flowchart illustrating a method for compressing a program file according to the present invention;
FIG. 2 is a second flowchart illustrating a method for compressing a program file according to the present invention;
FIG. 3 is a schematic diagram of determining a compression mode of an instruction node according to the present invention;
FIG. 4 is a third schematic flowchart of a program file compression method according to the present invention;
FIG. 5 is a schematic diagram of data storage in a compressed program file according to the present invention;
FIG. 6 is a schematic structural diagram of a program file compression apparatus according to the present invention;
fig. 7 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic flow chart of a program file compression method provided by the present invention, as shown in fig. 1, the method includes:
step 110, at least one function in the target program file is obtained.
It should be noted that the program file compression method provided by the present invention can be applied to a database compression scenario of an operating system such as a class (linux) operating system, for example. The execution subject of the program file compression method provided by the invention can be a program file compression device, such as a desktop computer or a server, or a control module in the program file compression device for executing the program file compression method.
Optionally, there are multiple object program files in the operating system; the object program file includes at least one function. The operating system loads the target program file into a memory buffer of the operating system by executing the target program file, so as to obtain at least one function in the target program file.
Step 120, determining a compression mode corresponding to the data of the instruction node according to the data length of the instruction node of the function; the compression mode is used for expressing the data length adopted when the data of the instruction node is compressed.
Optionally, the data length of the instruction node refers to a length corresponding to a decimal system for converting data of the instruction node into a binary system. The compression method comprises the following steps: indication information; the indication information is used for indicating a corresponding compression mode by adopting different identifications.
Step 130, based on the compression mode, writing the data of the instruction node of the function into a compression program file corresponding to the target program file, so as to compress the data of the instruction node of the function through the compression program file.
It should be noted that, the function has a plurality of instruction nodes, and the data of each instruction node includes the header information and the instruction data content of the instruction node; the header information of the instruction node includes information such as the name of the instruction node and the size of the instruction node. The type of instruction node includes at least one of: address pair nodes, return instruction nodes, indirect jump nodes and sub-function call jump nodes.
Optionally, the way of writing the data of the instruction node of the function into the compressed program file corresponding to the target program file may be: and according to the determined data compression mode of the instruction node, sequentially writing each function in the target program file and the data of the instruction node of the function into a compression program file corresponding to the target program file.
The program file compression method provided by the invention dynamically determines the compression mode corresponding to the data of the instruction node according to the data length of the instruction node of the function in the target program file, and writes the data of the instruction node into the compression program file corresponding to the target program file by adopting the data length indicated by the compression mode, so as to realize the compression of the data of the instruction node, thereby saving the storage space of the data.
Fig. 2 is a second schematic flow chart of the program file compression method provided by the present invention, as shown in fig. 2, the method includes:
step 210, at least one function in the target program file is obtained.
Step 220, determining a compression mode corresponding to the data of the instruction node according to the target compression relationship and the data length of the instruction node; the target compression relation is used for representing the corresponding relation between the numerical range and the compression mode.
Optionally, a compression mode corresponding to the numerical range in the target compression relationship is determined according to the numerical range corresponding to the data length of the instruction node.
Optionally, the data of the instruction node is a single number or an array; wherein, the data of the return instruction node and the indirect jump node is a single number, such as [128], and the data of the address pair node is an array, such as [1001, 10], [1002, 10] ]; where 1001 denotes the start address of the address pair node, 1002 denotes the target address of the address pair node, and 10 denotes the number of the target program file.
Optionally, the compression mode corresponding to the data of the instruction node represents a storage size of the data of the instruction node, for example, 1 byte, 2 bytes, 4 bytes, or 8 bytes; wherein, 1 byte is 8 bits, therefore, the storage range of the data corresponding to 1 byte is 0-64, the storage range of the data corresponding to 2 bytes is 0-16384, the storage range of the data corresponding to 4 bytes is 0-1073741824, and the storage range of the data corresponding to 8 bytes is 0-4.6116860184274 e + 18.
Step 230, based on the compression mode, writing the data of the instruction node into a compression program file corresponding to the target program file, so as to compress the data of the instruction node of the function through the compression program file.
Optionally, for the description and explanation of step 230, reference may be made to the description and explanation for step 130 above, and the same technical effect can be achieved, and in order to avoid repetition, detailed description is not repeated here.
The program file compression method provided by the invention dynamically determines the compression mode corresponding to the data of the instruction node according to the compression target relation and the data length of the instruction node of the function in the target program file, writes the data of the instruction node into the compression program file corresponding to the target program file by adopting the data length indicated by the compression mode, and realizes the compression of the data of the instruction node, thereby saving the storage space of the data.
Optionally, the implementation of step 220 includes: and determining a target value range corresponding to the data length of the instruction node in the target compression relationship according to the target compression relationship, and determining indication information corresponding to the data of the instruction node according to the determined target value range and the target compression relationship, thereby determining a compression mode corresponding to the data of the instruction node.
It should be noted that the first two bits of the compression method represent indication information, and the indication information is used for indicating the corresponding compression method by using different identifiers. For example, when the indication information of the compression method is 00, the indication information indicates that the compression method correspondingly stores 1 byte of data, and the range of the compression method storing 1 byte of data is 0-64; when the indication information of the compression mode is 01, the indication information indicates that the compression mode correspondingly stores 2 bytes of data, and the range of the storage data of the compression mode storing 2 bytes is 0-16384; when the indication information of the compression mode is 10, the indication information indicates that the compression mode correspondingly stores 4 bytes of data, and the range of the storage data of the compression mode storing 4 bytes is 0-1073741824; when the indication information of the compression method is 11, the indication information indicates that the compression method correspondingly stores 8 bytes of data, and the range of the compression method storing the 8 bytes of data is 0-4.6116860184274 e + 18.
FIG. 3 is a schematic diagram of determining a compression mode of an instruction node according to the present invention, as shown in FIG. 3, where 1 byte is 8 bits, and a data storage range is 0-64; the first two bits 00 indicate indication information of the compression method, the indication information is used for indicating that 1 byte of the compression method is used for storing data, and the data is stored from the 3 rd bit. 2 bytes are 16 bits, and the data storage range is 0-16384; wherein, the first two bits 01 represent indication information of the compression mode, the indication information is used for indicating the 2-byte compression mode to store data, and the data is stored from the 3 rd bit. The 4 bytes are 32 bits, and the data storage range is 0-1073741824; the first two bits 10 indicate indication information of the compression method, the indication information is used for indicating the 4-byte compression method to store data, and the data is stored from the 3 rd bit. 8 bytes are 64 bits, and the data storage range is 0-4.6116860184274 e + 18; the first two bits 11 indicate indication information of the compression method, the indication information is used for indicating that the compression method of 8 bytes stores data, and the data is stored from the 3 rd bit.
Fig. 4 is a third schematic flow chart of the program file compression method provided by the present invention, as shown in fig. 4, the method includes:
step 410, at least one function in the target program file is obtained.
Step 420, determining a compression mode corresponding to the data of the instruction node according to the data length of the instruction node of the function; the compression mode is used for expressing the data length adopted when the data of the instruction node is compressed.
And 430, sequentially writing the header information of the instruction node and the data content of the instruction node into the compressed program file based on the data length indicated by the compression mode.
Optionally, according to the data length indicated by the indication information of the compression method, the header information of the instruction node and the data content of the instruction node are sequentially written into the compression program file corresponding to the target program file in the determined compression method.
It should be noted that, in the actual storage process, the header information of the target program file is stored first, then the header information of the at least one function corresponding to the target program file is stored, and then the header information, the indication information, and the data content of the instruction node of the at least one function are stored.
Specifically, taking an instruction node as an indirect jump node as an example, the data content of the indirect jump node is 58, the corresponding storage range is 0-64, a compression mode that the data of the indirect jump node correspondingly stores 1 byte is determined according to the target compression relationship, the indication information of the compression mode is 00, and the data 58 is stored from the 3 rd bit.
In practice, if the next instruction node of the indirect jump node is an address pair node, the data content of the address pair node is [ [1001, 10], [1002, 10] ]; the storage range corresponding to 1001 and 1002 is 0-16384, and the compression modes of storing 2 bytes are determined to be corresponding to 1001 and 1002 respectively according to the target compression relationship, wherein the indication information of the compression modes is 01; the storage range corresponding to 10 is 0-64, a compression mode for storing 1 byte is determined according to the target compression relation, and the indication information of the compression mode is 00. Therefore, the header information of the address pair node, the indication information 01 of the data 1001 and the data 1001 are stored, and the indication information 00 of the first data 10 of the address pair node and the data 10 are stored; then, the indication information 01 and the data 1002 of the data 1002 are stored; finally, the indication information 00 of the address to the second data 10 of the node and the data 10 are stored. And by analogy, sequentially storing the header information, the indication information and the data content of the next instruction node until the data of the instruction node of the at least one function is sequentially written into the compressed program file corresponding to the target program file.
The program file compression method dynamically determines the compression mode corresponding to the data of the instruction node according to the data length of the instruction node of the function in the target program file, adopts the data length indicated by the compression mode, and sequentially writes the header information and the data content of the instruction node into the compression program file corresponding to the target program file in the determined compression mode to realize the compression of the data of the instruction node, thereby saving the storage space of the data.
Optionally, after writing the data of the instruction node of the function into the compressed program file corresponding to the target program file, it is further required to determine whether there are data of other instruction nodes to be compressed in the target program file; if the data of other instruction nodes to be compressed exist, the data of other instruction nodes to be compressed are sequentially written into the compressed program file according to the determined compression mode until the data of all the instruction nodes in the target program file are processed.
FIG. 5 is a schematic diagram of data in a compressed program file according to the present invention, where as shown in FIG. 5, a target program file includes a target program file header and a plurality of functions, each function corresponds to a function header and a plurality of instruction nodes, and the plurality of instruction nodes include at least one of an address pair node, a return instruction node, an indirect jump node, and a sub-function call jump node; the node of one address pair comprises a plurality of address pairs, the address pairs comprise address pairs 1 to address pairs n, and the data of the address pairs 1 to the address pairs n are all represented in the form of dynamic arrays; the data of the return instruction node, the indirect jump node and the sub-function call node are also represented in the form of dynamic arrays. The data of the instruction node comprises the head information of the instruction node and the instruction data content, and the instruction data content is stored in a dynamic array form.
Optionally, the invention further provides a program file decompression method, which can be applied to database decompression scenes in operating systems such as linux operating systems.
Specifically, when a compressed program file is decompressed, at least one function is obtained according to the compressed program file, and each function corresponds to one function attribute; wherein the function attributes may be represented by the numbers 1 to n. Therefore, the node type and the header information of the instruction node of the function can be determined according to the function attribute, and then the dynamic compression array of the instruction node of at least one function in the compression program file is obtained according to the header information of the instruction node. And then, according to the indication information of the dynamic compression array, obtaining a compression mode and a data storage range corresponding to the dynamic compression array, and analyzing the dynamic compression array according to the compression mode to obtain the data of the instruction node.
The following describes the program file compression apparatus provided by the present invention, and the program file compression apparatus described below and the program file compression method described above may be referred to in correspondence with each other.
Fig. 6 is a schematic structural diagram of a program file compression apparatus provided by the present invention, and as shown in fig. 6, the program file compression apparatus 600 includes: an acquisition module 601, a determination module 602, and a compression module 603; wherein the content of the first and second substances,
an obtaining module 601, configured to obtain at least one function in a target program file;
a determining module 602, configured to determine, according to the data length of the instruction node of the function, a compression manner corresponding to the data of the instruction node; the compression mode is used for expressing the data length adopted when the data of the instruction node is compressed;
the compression module 603 is configured to write the data of the instruction node of the function into a compression program file corresponding to the target program file based on the compression manner, so as to compress the data of the instruction node of the function by using the compression program file.
The program file compression device dynamically determines the compression mode corresponding to the data of the instruction node according to the data length of the instruction node of the function in the target program file, writes the data of the instruction node into the compression program file corresponding to the target program file by adopting the data length indicated by the compression mode, and compresses the data of the instruction node, thereby saving the storage space of the data.
Optionally, the determining module 602 is specifically configured to:
determining a compression mode corresponding to the data of the instruction node according to the target compression relationship and the data length of the instruction node; the target compression relation is used for representing the corresponding relation between the numerical range and the compression mode.
Optionally, the compression method includes: and the indication information is used for indicating a corresponding compression mode by adopting different identifications.
Optionally, the determining module 602 is specifically configured to:
determining a target numerical value range corresponding to the data length of the instruction node according to the target compression relationship;
and determining a compression mode corresponding to the data of the instruction node according to the target numerical range and the target compression relationship.
Optionally, the data of the instruction node includes: the compression module 603 is specifically configured to:
and sequentially writing the header information of the instruction node and the data content of the instruction node into the compressed program file based on the data length indicated by the compression mode.
Optionally, the program file compression apparatus 600 further includes a processing module, where the processing module is specifically configured to:
judging whether the target program file still has data of an instruction node to be compressed;
and if so, writing the data of the instruction nodes to be compressed into the compression program file based on the determined compression mode until the data of all the instruction nodes in the target program file are processed.
Fig. 7 is a schematic physical structure diagram of an electronic device provided in the present invention, and as shown in fig. 7, the electronic device 700 may include: a processor (processor)710, a communication Interface (Communications Interface)720, a memory (memory)730, and a communication bus 740, wherein the processor 710, the communication Interface 720, and the memory 730 communicate with each other via the communication bus 740. Processor 710 may call logic instructions in memory 730 to perform the following program file compression method: acquiring at least one function in a target program file; determining a compression mode corresponding to the data of the instruction node according to the data length of the instruction node of the function; the compression mode is used for expressing the data length adopted when the data of the instruction node is compressed; and writing the data of the instruction node of the function into a compression program file corresponding to the target program file based on the compression mode so as to compress the data of the instruction node of the function through the compression program file.
In addition, the logic instructions in the memory 730 can be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. 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 and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the following program file compression method: acquiring at least one function in a target program file; determining a compression mode corresponding to the data of the instruction node according to the data length of the instruction node of the function; the compression mode is used for expressing the data length adopted when the data of the instruction node is compressed; and writing the data of the instruction node of the function into a compression program file corresponding to the target program file based on the compression mode so as to compress the data of the instruction node of the function through the compression program file.
In yet another aspect, an embodiment of the present invention further provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions that, when executed by a computer, implement the following program file compression method: acquiring at least one function in a target program file; determining a compression mode corresponding to the data of the instruction node according to the data length of the instruction node of the function; the compression mode is used for expressing the data length adopted when the data of the instruction node is compressed; and writing the data of the instruction node of the function into a compression program file corresponding to the target program file based on the compression mode so as to compress the data of the instruction node of the function through the compression program file.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for compressing a program file, the method comprising:
acquiring at least one function in a target program file;
determining a compression mode corresponding to the data of the instruction node according to the data length of the instruction node of the function; the compression mode is used for expressing the data length adopted when the data of the instruction node is compressed;
and writing the data of the instruction node of the function into a compression program file corresponding to the target program file based on the compression mode so as to compress the data of the instruction node of the function through the compression program file.
2. The method according to claim 1, wherein determining a compression mode corresponding to data of an instruction node according to a data length of the instruction node of the function comprises:
determining a compression mode corresponding to the data of the instruction node according to the target compression relationship and the data length of the instruction node; the target compression relation is used for representing the corresponding relation between the numerical range and the compression mode.
3. The program file compression method according to claim 1, wherein the compression manner includes:
and the indication information is used for indicating a corresponding compression mode by adopting different identifications.
4. The method according to claim 2, wherein the determining a compression mode corresponding to the data of the instruction node according to the target compression relationship and the data length of the instruction node comprises:
determining a target numerical value range corresponding to the data length of the instruction node according to the target compression relationship;
and determining a compression mode corresponding to the data of the instruction node according to the target numerical range and the target compression relationship.
5. The program file compression method according to claim 1, wherein the data of the instruction node includes: the writing of the data of the instruction node of the function into the compressed program file corresponding to the target program file based on the compression mode comprises:
and sequentially writing the header information and the instruction data content of the instruction node into the compressed program file based on the data length indicated by the compression mode.
6. The program file compression method according to claim 1, wherein after writing the data of the instruction node of the function into the compressed program file corresponding to the target program file, the method further comprises:
judging whether the target program file still has data of an instruction node to be compressed;
and if so, writing the data of the instruction nodes to be compressed into the compression program file based on the determined compression mode until the data of all the instruction nodes in the target program file are processed.
7. A program file compression apparatus, the apparatus comprising:
the acquisition module is used for acquiring at least one function in the target program file;
the determining module is used for determining a compression mode corresponding to the data of the instruction node according to the data length of the instruction node of the function; the compression mode is used for expressing the data length adopted when the data of the instruction node is compressed;
and the compression module is used for writing the data of the instruction node of the function into a compression program file corresponding to the target program file based on the compression mode so as to compress the data of the instruction node of the function through the compression program file.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the program file compression method according to any one of claims 1 to 6 are implemented when the program is executed by the processor.
9. A non-transitory computer readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the program file compression method according to any one of claims 1 to 6.
10. A computer program product having stored thereon executable instructions, characterized in that the instructions, when executed by a processor, cause the processor to carry out the steps of the program file compression method according to any one of claims 1 to 6.
CN202111296092.9A 2021-11-03 2021-11-03 Program file compression method and device and electronic equipment Pending CN114238250A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111296092.9A CN114238250A (en) 2021-11-03 2021-11-03 Program file compression method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111296092.9A CN114238250A (en) 2021-11-03 2021-11-03 Program file compression method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN114238250A true CN114238250A (en) 2022-03-25

Family

ID=80743728

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111296092.9A Pending CN114238250A (en) 2021-11-03 2021-11-03 Program file compression method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN114238250A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117708069A (en) * 2023-07-24 2024-03-15 荣耀终端有限公司 Data compression method and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117708069A (en) * 2023-07-24 2024-03-15 荣耀终端有限公司 Data compression method and electronic equipment

Similar Documents

Publication Publication Date Title
CN109802684B (en) Method and device for data compression
CN111352861B (en) Memory compression method and device and electronic equipment
US10649905B2 (en) Method and apparatus for storing data
CN111124288B (en) VPD storage management method, device, equipment and readable storage medium
CN111491169B (en) Digital image compression method, device, equipment and medium
CN105677259A (en) Method for storing file in mobile terminal and mobile terminal
CN109697019B (en) Data writing method and system based on FAT file system
CN111352913A (en) File compression method and device, storage medium and terminal equipment
CN114238250A (en) Program file compression method and device and electronic equipment
CN105320669A (en) Method and device for data storage and method and device for data reading
CN110019347B (en) Data processing method and device of block chain and terminal equipment
CN113704588A (en) File reading method and system based on mapping technology
CN104598409A (en) Method and device for processing input and output requests
US9471246B2 (en) Data sharing using difference-on-write
CN113377391B (en) Method, device, equipment and medium for making and burning image file
CN108234552B (en) Data storage method and device
CN113805854A (en) Method, system and device for realizing Hook of application layer based on Linux system and storage medium
CN112506651A (en) Method and equipment for data operation in large-data-volume environment
CN114218175A (en) Resource cross-platform sharing method and device, terminal equipment and storage medium
CN114003573A (en) Compression method, device, equipment, storage medium and program product of file system
CN113641643A (en) File writing method and device
CN113628099A (en) Feature map data conversion method and device, electronic equipment and storage medium
CN116804915B (en) Data interaction method, processor, device and medium based on memory
CN108989813A (en) A kind of high efficiency of compression/decompression method, computer installation and storage medium
CN111324587A (en) Compression method, analysis method and system for data of OBJ file

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