Data storage method, device, computer, readable storage medium and program product
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2022-04-19
- Publication Date
- 2026-08-07
AI Technical Summary
目前,常量表一般是包括不包含向量的常量表及包含向量的常量表,其中,通过不包含向量的常量表进行数据存储,在对向量常量进行加载时,需要在运行时进行数据的拼接操作,以得到需要加载的向量常量,从而导致数据加载的效率较低;通过包含向量的常量表进行数据存储时,对于向量常量的存储往往会出现一些无法合并或替代的重复的数据,导致数据冗余,增加数据存储空间
[0064] In this embodiment, data to be processed is acquired. If a first associated data with a first inclusion relationship is found in the data storage table, the storage address of the data to be processed is determined according to the storage address of the first associated data. The first inclusion relationship means that the first associated data includes the data to be processed, and the first inclusion relationship indicates that the data volume of the first associated data is greater than or equal to the data volume of the data to be processed. If a second associated data with a second inclusion relationship is found in the data storage table, the data to be processed is stored in the data storage table, the storage address of the second associated data is updated according to the storage address of the data to be processed, and the second associated data is deleted from the data storage table. The second inclusion relationship means that the data to be processed includes the second associated data, and the second inclusion relationship indicates that the data volume of the data to be processed is greater than the data volume of the second associated data. Through the above process, the duplication between the data to be stored (i.e., the data to be processed) and the already stored data (i.e., the data stored in the data storage table) can be fully considered. Storage reuse is performed regardless of when they are the same, and storage reuse can also be performed when there is an inclusion relationship, which greatly reduces the duplicate data in the data storage table, reduces data redundancy, and thus reduces the data storage space.
Smart Images

Figure CN116954482B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data storage method, apparatus, computer, readable storage medium, and program product. Background Technology
[0002] The constant table is a key data structure for constant compilation. Its construction and implementation significantly impact compilation efficiency, making its construction extremely important. Currently, constant tables generally include those without vectors and those with vectors. When storing data using a constant table without vectors, loading vector constants requires runtime data concatenation, leading to low loading efficiency. Conversely, storing data using a constant table with vectors often results in duplicate data that cannot be merged or substituted, causing data redundancy and increasing data storage space. Summary of the Invention
[0003] This application provides a data storage method, apparatus, computer, readable storage medium, and program product that can reduce data redundancy and reduce data storage space.
[0004] One embodiment of this application provides a data storage method, the method comprising:
[0005] Obtain the data to be processed;
[0006] If a first associated data with a first inclusion relationship is found in the data storage table, the storage address of the data to be processed is determined according to the storage address of the first associated data; the first inclusion relationship means that the first associated data contains the data to be processed, and the first inclusion relationship indicates that the data volume of the first associated data is greater than or equal to the data volume of the data to be processed.
[0007] If a second related data with a second inclusion relationship is found in the data storage table, the data to be processed is stored in the data storage table. Based on the storage address of the data to be processed, the storage address of the second related data is updated, and the second related data in the data storage table is deleted. The second inclusion relationship refers to the relationship that the data to be processed contains the second related data, and the second inclusion relationship indicates that the amount of data to be processed is greater than the amount of data of the second related data.
[0008] One embodiment of this application provides a data storage device, the device comprising:
[0009] The data acquisition module is used to acquire the data to be processed.
[0010] The address determination module is used to determine the storage address of the data to be processed based on the storage address of the first associated data if a first associated data with a first inclusion relationship is found in the data storage table; the first inclusion relationship refers to the relationship that the first associated data contains the data to be processed, and the first inclusion relationship indicates that the data volume of the first associated data is greater than or equal to the data volume of the data to be processed.
[0011] The data storage module is used to store the data to be processed into the data storage table if a second related data that has a second inclusion relationship with the data to be processed is found in the data storage table.
[0012] The address update module is used to update the storage address of the second associated data according to the storage address of the data to be processed;
[0013] The address deletion module is used to delete the second associated data in the data storage table; the second inclusion relationship refers to the relationship that the data to be processed contains the second associated data, and the second inclusion relationship indicates that the data volume of the data to be processed is greater than the data volume of the second associated data.
[0014] The data type of the data to be processed is the first data type; the first data type refers to a data type that includes one element.
[0015] The device also includes:
[0016] The data traversal module is used to traverse s candidate data in the data storage table; s is a positive integer.
[0017] The first relationship determination module is used to determine the j-th candidate data as first associated data that has a first inclusion relationship with the data to be processed if the data to be processed is the same as the j-th candidate data; j is a positive integer less than or equal to s; the j-th candidate data is a first data type;
[0018] The first relationship determination module is further configured to determine that there is no inclusion relationship between the j-th candidate data and the data to be processed if the data to be processed is different from the j-th candidate data; the j-th candidate data is a first data type.
[0019] The data type of the data to be processed is the first data type; the first data type refers to a data type that includes one element.
[0020] The device also includes:
[0021] This data traversal module is used to traverse s candidate data in the data storage table; s is a positive integer;
[0022] The second relationship determination module is used to determine that if the j-th candidate data includes an element that is the same as the data to be processed, then the j-th candidate data is a first associated data that has a first inclusion relationship with the data to be processed; j is a positive integer less than or equal to s; the j-th candidate data is a second data type; the second data type refers to a data type that includes at least two elements;
[0023] The second relationship determination module is further configured to determine that there is no inclusion relationship between the j-th candidate data and the data to be processed if the j-th candidate data does not contain any element that is the same as the data to be processed; the j-th candidate data is a second data type.
[0024] The device also includes:
[0025] The type acquisition module is used to obtain the component type of the j-th candidate data; the second data type refers to a data type that includes at least two elements;
[0026] The type matching module is used to obtain the format type of the data to be processed. If the component type of the j-th candidate data is different from the format type of the data to be processed, it is determined that the j-th candidate data does not contain the same element as the data to be processed.
[0027] The element comparison module is used to compare the elements included in the j-th candidate data with the data to be processed in turn if the component type of the j-th candidate data is the same as the format type of the data to be processed.
[0028] The first element search module is used to determine that the j-th candidate data includes the same element as the data to be processed if an element identical to the data to be processed is found in the j-th candidate data.
[0029] The second element search module is used to determine that the j-th candidate data does not contain an element that is the same as the data to be processed if no element identical to the data to be processed is found in the j-th candidate data.
[0030] The data to be processed is of the second data type; the second data type refers to a data type that includes at least two elements.
[0031] The device also includes:
[0032] This data traversal module is used to traverse s candidate data in the data storage table; s is a positive integer;
[0033] The third relationship determination module is used to determine the j-th candidate data as the first associated data that has a first inclusion relationship with the data to be processed if the data to be processed is the same as the j-th candidate data, or if the j-th candidate data includes the data to be processed; j is a positive integer less than or equal to s.
[0034] The third relationship determination module is further configured to determine, if the data to be processed includes the j-th candidate data, that the j-th candidate data is a second associated data that has a second inclusion relationship with the data to be processed.
[0035] The device also includes:
[0036] The fourth relationship determination module is used to determine that if the data type of the j-th candidate data is the first data type, then there is no inclusion relationship between the j-th candidate data and the data to be processed; the first data type refers to a data type that includes one element.
[0037] The component type acquisition module is used to acquire the component type of the j-th candidate data and the component type of the data to be processed if the data type of the j-th candidate data is the second data type.
[0038] The fifth relationship determination module is used to determine that there is no inclusion relationship between the j-th candidate data and the data to be processed if the component type of the j-th candidate data is different from the component type of the data to be processed.
[0039] The device also includes:
[0040] The quantity acquisition module is used to acquire the first element count of the elements included in the j-th candidate data and the second element count of the elements included in the data to be processed if the component type of the j-th candidate data is the same as the component type of the data to be processed.
[0041] The sixth relation determination module is used to determine that the j-th candidate data includes the data to be processed if the number of the first element is greater than or equal to the number of the second element, and there is a candidate subsequence in the j-th candidate data that is the same as the data to be processed.
[0042] The sixth relation determination module is also used to determine that the data to be processed includes the j-th candidate data if the number of the second element is greater than the number of the first element and there is a processing subsequence in the data to be processed that is the same as the j-th candidate data.
[0043] The device also includes:
[0044] The third element search module is used to search for the element in the data to be processed that is the same as the j-th candidate data if the data type of the j-th candidate data is the first data type.
[0045] The seventh relationship determination module is used to determine that the data to be processed includes the j-th candidate data if an element identical to the j-th candidate data is found in the data to be processed.
[0046] The seventh relationship determination module is also used to determine that there is no inclusion relationship between the j-th candidate data and the data to be processed if no element identical to the j-th candidate data is found in the data to be processed.
[0047] The address determination module includes:
[0048] The address determination unit is used to determine the storage address of the first associated data as the storage address of the data to be processed if the first associated data is the same as the data to be processed.
[0049] The address generation unit is used to obtain the address offset of the data to be processed in the first associated data if the first associated data is different from the data to be processed, and determine the storage address of the data to be processed based on the address offset and the storage address of the first associated data.
[0050] The address update module includes:
[0051] The association determination unit is used to obtain the association position corresponding to the second association data in the data to be processed, and determine the data association address based on the association position and the storage address of the data to be processed;
[0052] The address update unit is used to update the storage address of the second associated data to the data association address.
[0053] The device also includes:
[0054] The address recording module is used to store the data to be processed in the data storage table if no related data with an inclusion relationship is found in the data storage table, and to record the storage address of the data to be processed.
[0055] The device also includes:
[0056] The request and response module is used to respond to processing requests for the target business and execute the target business.
[0057] The data lookup module is used to retrieve the data to be processed from the data storage table based on the storage address of the data to be processed if the target business includes data to be processed.
[0058] The data generation module is used to generate business data corresponding to the target business based on the data to be processed.
[0059] One embodiment of this application provides a computer device, including a processor, a memory, and an input / output interface;
[0060] The processor is connected to a memory and an input / output interface, respectively. The input / output interface is used to receive and output data, the memory is used to store computer programs, and the processor is used to call the computer programs so that the computer device containing the processor executes the data storage method in one aspect of the embodiments of this application.
[0061] One aspect of this application provides a computer-readable storage medium storing a computer program adapted to be loaded and executed by a processor, so that a computer device having the processor performs the data storage method of one aspect of this application.
[0062] One aspect of this application provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in various optional embodiments of this application. In other words, when the computer instructions are executed by the processor, they implement the methods provided in various optional embodiments of this application.
[0063] Implementing the embodiments of this application will have the following beneficial effects:
[0064] In this embodiment, data to be processed is acquired. If a first associated data with a first inclusion relationship is found in the data storage table, the storage address of the data to be processed is determined according to the storage address of the first associated data. The first inclusion relationship means that the first associated data includes the data to be processed, and the first inclusion relationship indicates that the data volume of the first associated data is greater than or equal to the data volume of the data to be processed. If a second associated data with a second inclusion relationship is found in the data storage table, the data to be processed is stored in the data storage table, the storage address of the second associated data is updated according to the storage address of the data to be processed, and the second associated data is deleted from the data storage table. The second inclusion relationship means that the data to be processed includes the second associated data, and the second inclusion relationship indicates that the data volume of the data to be processed is greater than the data volume of the second associated data. Through the above process, the duplication between the data to be stored (i.e., the data to be processed) and the already stored data (i.e., the data stored in the data storage table) can be fully considered. Storage reuse is performed regardless of when they are the same, and storage reuse can also be performed when there is an inclusion relationship, which greatly reduces the duplicate data in the data storage table, reduces data redundancy, and thus reduces the data storage space. Attached Figure Description
[0065] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0066] Figure 1 This is a network interaction architecture diagram for data storage provided in an embodiment of this application;
[0067] Figure 2 This is a schematic diagram of a data storage scenario provided in an embodiment of this application;
[0068] Figure 3 This is a flowchart of a data storage method provided in an embodiment of this application;
[0069] Figure 4 This is a schematic diagram of a specific method for data storage provided in an embodiment of this application;
[0070] Figure 5 This application provides a schematic flowchart of a data storage loop process.
[0071] Figure 6 This is a flowchart illustrating a method for storing a first data type, as provided in an embodiment of this application.
[0072] Figure 7 This is a flowchart illustrating a method for storing a second data type according to an embodiment of this application;
[0073] Figure 8 This is a schematic diagram of a data storage device provided in an embodiment of this application;
[0074] Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0075] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0076] Optionally, in this application embodiment, cloud storage technology may be involved to store data and further improve storage efficiency.
[0077] Among them, cloud storage is a new concept that has been extended and developed from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as a storage system) refers to a storage system that uses cluster applications, grid technology and distributed storage file systems to bring together a large number of storage devices of various types in the network (storage devices are also called storage nodes) to work together through application software or application interfaces to provide data storage and business access functions to the outside world.
[0078] Currently, the storage method of storage systems is as follows: Logical volumes are created. During the creation of a logical volume, physical storage space is allocated to each logical volume. This physical storage space may consist of a single storage device or the disks of several storage devices. Clients store data on a logical volume, which means storing the data on the file system. The file system divides the data into many parts, each part being an object. Each object contains not only the data but also additional information such as a data identifier (ID, ID entity). The file system writes each object to the physical storage space of that logical volume and records the storage location information of each object. Therefore, when a client requests access to data, the file system can allow the client to access the data based on the storage location information of each object.
[0079] The process by which a storage system allocates physical storage space to a logical volume is as follows: the physical storage space is pre-divided into strips according to the capacity estimate of the objects stored in the logical volume (this estimate often has a large margin relative to the actual capacity of the objects to be stored) and the grouping of Redundant Array of Independent Disks (RAID). A logical volume can be understood as a strip, thus allocating physical storage space to the logical volume.
[0080] In the embodiments of this application, please refer to Figure 1 , Figure 1 This is a network interaction architecture diagram for data storage provided in an embodiment of this application. In this embodiment, a computer device can acquire data to be processed and compare it with candidate data already stored in the data storage table. When there is an inclusion relationship between the data to be processed and the stored candidate data, that is, when there is related data in the stored candidate data that has an inclusion relationship with the data to be processed, the data to be processed and the related data can be reused for storage to minimize data redundancy and reduce data storage space. The computer device can acquire the data to be processed from other computer devices or from terminal devices; there is no limitation on this. The computer device can interact with one or at least two terminal devices, such as... Figure 1As shown, there may be terminal devices 102a, 102b, or 102c, etc. The data involved in this application can be stored in a computer device or in a terminal device.
[0081] For details, please see Figure 2 , Figure 2 This is a schematic diagram of a data storage scenario provided in an embodiment of this application. For example... Figure 2 As shown, the computer device can acquire the data to be processed 201 and traverse the data storage table 202 for searching. The data storage table 202 can be considered to contain s candidate data, where s is a positive integer. Figure 2 As shown, such as candidate data 2021 and candidate data 2022, the computer device can compare the data to be processed 201 with the s candidate data sequentially. Optionally, in one case ①, if a first associated data 2031 with a first inclusion relationship with the data to be processed 201 is found in the data storage table 202, the storage address of the data to be processed can be determined according to the storage address of the first associated data 2031, which is equivalent to pointing the data to be processed 201 to the first associated data 2031 in the data storage table 202. In another case ②, if a second associated data 2032 with a second inclusion relationship with the data to be processed 201 is found in the data storage table 202, the data to be processed 201 can be stored in the data storage table 202, the storage address of the data to be processed 201 is recorded, the storage address of the second associated data 2032 is updated according to the storage address of the data to be processed 201, and the second associated data 2032 can be deleted from the data storage table 202. This approach allows for data reuse where there is a possibility of substitution between different data sets. In other words, if one set of data can represent all or part of another set, then these two sets of data can be reused, minimizing data redundancy and reducing storage space. Since the data is stored in its entirety, there is no need to concatenate data when loading it; the data to be loaded can be obtained directly, thus improving data loading efficiency to some extent. In other words, this application strikes a balance between data loading efficiency and data storage space usage, ensuring data loading efficiency while reducing data storage space.
[0082] It is understood that the computer equipment mentioned in the embodiments of this application includes, but is not limited to, terminal devices or servers. In other words, the computer equipment can be a server or a terminal device, or a system composed of a server and a terminal device. The terminal device mentioned above can be an electronic device, including but not limited to mobile phones, tablets, desktop computers, laptops, handheld computers, in-vehicle devices, augmented reality / virtual reality (AR / VR) devices, head-mounted displays, smart TVs, wearable devices, smart speakers, digital cameras, webcams, and other mobile internet devices (MIDs) with network access capabilities, or terminal devices in scenarios such as trains, ships, and flights. Figure 1 As shown, the terminal device can be a laptop computer (as shown in terminal device 102b), a mobile phone (as shown in terminal device 102c), or an in-vehicle device (as shown in terminal device 102a), etc. Figure 1 Only a portion of the devices are listed here. Optionally, terminal device 102a refers to the device located in vehicle 103. The servers mentioned above can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, vehicle-to-everything (V2X) communication, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0083] Optionally, the data involved in the embodiments of this application may be stored in a computer device, or may be stored based on cloud storage technology or a blockchain network, without limitation.
[0084] Further, please see Figure 3 , Figure 3 This is a flowchart illustrating a data storage method provided in an embodiment of this application. Figure 3 As shown, the data storage process includes the following steps:
[0085] Step S301: Obtain the data to be processed.
[0086] In this embodiment, the computer device can acquire data to be processed, which refers to data that needs to be stored. This data to be processed can be considered a constant, and may be either a first type of data or a second type of data. First type of data refers to data of a first data type, which includes one element, such as a scalar constant or a single data item. Second type of data refers to data of a second data type, which includes at least two elements, such as a vector constant or a data sequence. In other words, if the data to be processed is of the first type of the first data type, then the data to be processed includes one element; if the data to be processed is of the second type of the second data type, then the data to be processed includes at least two elements.
[0087] Optionally, the computer device can respond to a storage request for data to be processed and obtain the data to be processed carried in the storage request. Alternatively, it can respond to a request to construct a data storage table, obtain a set of data to be processed to be compiled, and sequentially determine the data included in the set of data to be processed, etc., without limitation. That is to say, in any scenario where data storage is required, the scheme in this application can be adopted, and the data to be stored can be denoted as data to be processed. Optionally, the data storage table can be a constant table, used to store constants, that is, a table structure composed of constants, used to assist the compiler in compiling constants. Here, constants refer to operands or parameters that are fixed and unchanging in the program. A compiler is a program that automatically converts the source program into target machine instructions; the conversion process is called "compilation". A dynamic compiler is a compiler that compiles during program execution, also known as a just-in-time (JIT) compiler.
[0088] Furthermore, the data to be processed can be matched with a data storage table to search for related data that has an inclusion relationship with the data to be processed. Specifically, if a first related data with a first inclusion relationship is found in the data storage table, step S302 is executed; if a second related data with a second inclusion relationship is found, step S303 is executed. The data storage table includes *s* candidate data, where *s* is a positive integer. Specifically, the data to be processed is compared sequentially with the *s* candidate data until a related data with an inclusion relationship is found, i.e., a first related data with a first inclusion relationship or a second related data with a second inclusion relationship is found. If no related data with an inclusion relationship is found in the data storage table, the data to be processed can be stored in the data storage table, and the storage address of the data to be processed is recorded. In this case, when storing other data subsequently, the data to be processed becomes candidate data for other data.
[0089] Step S302: If a first associated data with a first inclusion relationship with the data to be processed is found in the data storage table, the storage address of the data to be processed is determined according to the storage address of the first associated data.
[0090] In this embodiment, the first inclusion relationship refers to the relationship that the first associated data includes the data to be processed, and the first inclusion relationship indicates that the amount of data in the first associated data is greater than or equal to the amount of data in the data to be processed. That is, the first inclusion relationship means that the first associated data is the same as the data to be processed, or the first associated data includes the data to be processed. Therefore, the data to be processed can be referred to by all or part of the first associated data. In other words, the storage of the data to be processed can be achieved by directly reusing the first associated data. This allows the data to be referred to by the first associated data even when there is no identical data. Moreover, this reference is a complete reference, which can include the complete content of the data to be processed. This maximizes data reuse, reduces data redundancy, and maintains data integrity, so that the complete data can be obtained directly when loading data, thereby improving the efficiency of data loading.
[0091] Specifically, if the first associated data is the same as the data to be processed, the storage address of the first associated data can be determined as the storage address of the data to be processed. For example, if the storage address of the first associated data is denoted as addr, then the storage address of the data to be processed is addr. If the first associated data is different from the data to be processed, the address offset of the data to be processed corresponding to the first associated data is obtained. Based on the address offset and the storage address of the first associated data, the storage address of the data to be processed is determined. Specifically, the storage space of the first component of the first associated data can be obtained, the offset position of the data to be processed corresponding to the first associated data can be obtained, the address offset of the data to be processed corresponding to the first associated data can be determined based on the first component storage space and the offset position, and the storage address of the data to be processed can be determined based on the address offset and the storage address of the first associated data. For example, if the storage address of the first associated data is denoted as addr, and the first component storage space refers to the storage space occupied by one element in the first associated data, assuming the first component storage space is spa and the offset position is d, then the storage address of the data to be processed is (addr + d * spa), where d * spa represents the address offset of the data to be processed corresponding to the first associated data.
[0092] Step S303: If a second associated data with a second inclusion relationship with the data to be processed is found in the data storage table, the data to be processed is stored in the data storage table, the storage address of the second associated data is updated according to the storage address of the data to be processed, and the second associated data is deleted from the data storage table.
[0093] In this embodiment, the second inclusion relationship refers to the relationship that the data to be processed contains the second associated data, and the second inclusion relationship indicates that the data volume of the data to be processed is greater than the data volume of the second associated data. In other words, the second inclusion relationship means that the data to be processed includes the second associated data. Therefore, the second associated data can be represented by all or part of the data to be processed. That is, the data to be processed can be directly reused to achieve the re-storage of the second associated data. This allows the data to be represented by the data to be processed even when no identical data exists, and this representation is complete, meaning it can include the complete content of the second associated data. This maximizes data reuse, reduces data redundancy, and maintains data integrity, allowing complete data to be directly obtained during data loading, thereby improving data loading efficiency. The first inclusion relationship, which includes the relationship that the data to be processed is the same as the first associated data, is based on the fact that the first associated data has already been stored, eliminating the need for re-storage and replacement, thus reducing operational complexity to some extent.
[0094] Specifically, the data to be processed is stored in a data storage table, and the storage address of the data to be processed is recorded. The association position of the second associated data within the data to be processed is obtained. Based on the association position and the storage address of the data to be processed, the data association address is determined. Specifically, the storage space of the second component of the data to be processed can be obtained, the association position of the second associated data within the data to be processed can be obtained, the association offset address of the second associated data within the data to be processed can be determined based on the second component storage space and the association position, and the data association address can be determined based on the association offset address and the storage address of the data to be processed. The storage address of the second associated data is then updated to the data association address.
[0095] Optionally, the embodiments of this application are applicable to various scenarios involving data storage, such as compiler constant compilation scenarios, and are particularly applicable to compilation scenarios involving second-type data. For example, in compiler constant compilation scenarios, the compiler can be integrated into a Virtual Machine (VM). The VM mainly uses software (or with a small amount of hardware support) to virtualize a computer, and this virtual computer usually also supports its own instruction set, called the VM instruction set. The VM relies on the local physical machine and uses its execution engine to simulate the execution of a given sequence of VM instructions (target program) on the local machine. The VM execution engine can be implemented by an interpreter. Because interpreters have the characteristics of high portability, low implementation cost, and low memory consumption, most VM execution engines include interpreters. The interpreter performs instruction fetching, instruction dispatching, operand fetching, and execution on a unit of VM instruction. However, simple interpretation execution has low performance, so a dynamic compilation system is introduced into the VM to improve its performance. The compiler is the core of the dynamic compilation system. The compiler compiles a set of continuous virtual machine instruction sequences (basic blocks, functions, or methods) into a native central processing unit (CPU) instruction sequence, called a native method. The compiled native method is then directly executed by the hardware. Because the compiler eliminates repetitive instruction fetching and dispatching processes and performs numerous effective optimizations during compilation, its performance can be more than 10 times higher than that of the interpreter. Since the compiler performs dynamic compilation during program execution, it is also called a dynamic compiler. Introducing the scheme implemented in this application into the compiler can reduce data redundancy, reduce data storage space, and ensure data loading efficiency. Of course, the scheme in this application can also be used in other ordinary data storage processes, such as the storage of program data, which may contain scalar constants or vector constants, or simple data storage.
[0096] For details, please refer to Figure 4 , Figure 4This is a schematic diagram illustrating a specific method for data storage provided in an embodiment of this application. For example... Figure 4 As shown, the process may include the following steps:
[0097] Step S401: Obtain the data to be processed.
[0098] In this embodiment, the computer device can directly acquire the data to be processed; or it can acquire a set of data to be processed and sequentially determine the data included in the set as the data to be processed. For details, please refer to... Figure 3 The specific description of step S301 will not be repeated here.
[0099] Step S402: Compare the data to be processed with the data storage table to obtain the data relationship between the data storage table and the data to be processed.
[0100] In this embodiment, the computer device can compare the data to be processed with a data storage table. Specifically, the data storage table can be considered to include s candidate data, where s is a positive integer. The computer device can sequentially compare the data to be processed with the s candidate data to obtain the data relationship between the data storage table and the data to be processed. This data relationship can include a first data relationship, a second data relationship, and a third data relationship. The first data relationship indicates that there is first associated data in the data storage table that has a first inclusion relationship with the data to be processed; the second data relationship indicates that there is second associated data in the data storage table that has a second inclusion relationship with the data to be processed; and the third data relationship indicates that there is no associated data in the data storage table that has an inclusion relationship with the data to be processed.
[0101] Specifically, in one scenario ①, the data type of the data to be processed is a first data type, which refers to a data type that includes one element. Specifically, the s candidate data in the data storage table are traversed. Taking one of the s candidate data as an example, assume the j-th candidate data is a first data type, where j is a positive integer less than or equal to s. If the data to be processed is the same as the j-th candidate data, then the j-th candidate data is determined to be first associated data with a first inclusion relationship with the data to be processed; that is, the data relationship between the data storage table and the data to be processed is a first data relationship, and step S403 is executed. If the data to be processed is different from the j-th candidate data, then it is determined that there is no inclusion relationship between the j-th candidate data and the data to be processed, and the data storage table is traversed again, i.e., the data to be processed is compared with the next candidate data.
[0102] Assume the data type of the j-th candidate data is a second data type, where the second data type refers to a data type that includes at least two elements, and j is a positive integer less than or equal to s. If the j-th candidate data includes an element that is the same as the data to be processed, then the j-th candidate data is determined to be first associated data with a first inclusion relationship with the data to be processed, that is, the data relationship between the data storage table and the data to be processed is a first data relationship, and step S403 is executed; if the j-th candidate data does not include an element that is the same as the data to be processed, then it is determined that there is no inclusion relationship between the j-th candidate data and the data to be processed, and the data storage table is traversed again, that is, the data to be processed is compared with the next candidate data.
[0103] Specifically, the component type of the j-th candidate data is obtained; the second data type refers to a data type that includes at least two elements. The component type of the j-th candidate data refers to the format type of the elements included in the j-th candidate data. The format type can include, but is not limited to, single-precision floating-point type (float), integer type (int), double-precision floating-point type (double), string type (string), boolean type (bool), or character type (char). The computer device can obtain the format type of the data to be processed. If the component type of the j-th candidate data is different from the format type of the data to be processed, it is determined that the j-th candidate data does not contain elements identical to those in the data to be processed. Since the two data types will not be identical when the format types are different, matching can be performed first based on the format type. When the format types are different, the comparison result is obtained directly; when the format types are the same, the next comparison step is performed. This reduces the amount of data to be processed, improves data processing efficiency, and thus reduces the time required for data storage, thereby improving data storage efficiency to a certain extent. If the component type of the j-th candidate data is the same as the format type of the data to be processed, then the elements included in the j-th candidate data are compared sequentially with those in the data to be processed. If an element identical to the data to be processed is found in the j-th candidate data, then the j-th candidate data is determined to include an element identical to the data to be processed; if no element identical to the data to be processed is found in the j-th candidate data, then the j-th candidate data is determined not to include an element identical to the data to be processed.
[0104] Furthermore, based on the above process, the loop continues until a related data with an inclusion relationship to the data to be processed is found, or until all s candidate data have been traversed, at which point the loop ends. If none of the s candidate data has a related data with an inclusion relationship to the data to be processed, then step S405 can be executed.
[0105] In case ②, the data type of the data to be processed is a second data type, which refers to a data type that includes at least two elements. Specifically, s candidate data in the data storage table are traversed. Taking one of the s candidate data as an example, if the data to be processed is the same as the j-th candidate data, or the j-th candidate data includes the data to be processed, then the j-th candidate data is determined to be first associated data with a first inclusion relationship with the data to be processed, that is, the data relationship between the data storage table and the data to be processed is a first data relationship, and step S403 is executed; j is a positive integer less than or equal to s. If the data to be processed includes the j-th candidate data, then the j-th candidate data is determined to be second associated data with a second inclusion relationship with the data to be processed, that is, the data relationship between the data storage table and the data to be processed is a second data relationship, and step S404 is executed.
[0106] Specifically, when the data type of the j-th candidate data is the first data type, under one relationship determination method, if the data type of the j-th candidate data is the first data type, it is determined that there is no inclusion relationship between the j-th candidate data and the data to be processed. The data storage table is then traversed, i.e., the data to be processed is compared with the next candidate data. The first data type refers to a data type that includes one element. In other words, when the data type of the j-th candidate data is the first data type, since the data type of the data to be processed is the second data type, the j-th candidate data cannot include the data to be processed. During reuse, reusing second-type data can minimize storage space. Later, second-type data that may have an inclusion relationship with the data to be processed may appear. Therefore, it can be directly determined that there is no inclusion relationship between the j-th candidate data and the data to be processed, and subsequent processing can continue, reducing data redundancy to a certain extent.
[0107] In one relationship determination method, if the data type of the j-th candidate data is the first data type, then an element identical to the j-th candidate data is searched in the data to be processed. If an element identical to the j-th candidate data is found in the data to be processed, it is determined that the data to be processed includes the j-th candidate data; if no element identical to the j-th candidate data is found in the data to be processed, it is determined that there is no inclusion relationship between the j-th candidate data and the data to be processed, and the data storage table is traversed again, i.e., the data to be processed is compared with the next candidate data. Through this method, as long as the first type of data exists in the second type of data that needs to be stored, the second type of data will be replaced and stored, with the second type of data referring to the first type of data. This ensures that during the storage of the second type of data, the already stored first type of data that is identical to an element in the second type of data will be replaced. This ensures that there is no inclusion relationship between any first type of data and second type of data in the already stored data, and therefore, there will be no situation where a new second type of data has both inclusion relationships with existing first type of data and existing second type of data. This maximizes data reuse, reduces data redundancy, and minimizes data storage space. For example, if there are two types of data, A and A', and A' is a second type of data, and A' contains A, meaning that A and A' have the same element, then when storing B', it is assumed that B' contains an element that is the same as A. However, when storing A', B' will refer to A, meaning that A no longer exists in the data storage table. This demonstrates that this method can minimize data redundancy and reduce data storage space.
[0108] If the data type of the j-th candidate data is the second data type, then obtain the component type of the j-th candidate data and the component type of the data to be processed; if the component type of the j-th candidate data is different from the component type of the data to be processed, then determine that there is no inclusion relationship between the j-th candidate data and the data to be processed, and continue to traverse the data storage table, that is, compare the data to be processed with the next candidate data.
[0109] Furthermore, if the component type of the j-th candidate data is the same as the component type of the data to be processed, then the first element count of the elements included in the j-th candidate data is obtained, and the second element count of the elements included in the data to be processed is obtained; if the first element count is greater than or equal to the second element count, and there is a candidate subsequence in the j-th candidate data that is the same as the data to be processed, then the j-th candidate data is determined to include the data to be processed; if the second element count is greater than the first element count, and there is a processing subsequence in the data to be processed that is the same as the j-th candidate data, then the data to be processed is determined to include the j-th candidate data.
[0110] Furthermore, based on the above process, the loop continues until a related data with an inclusion relationship to the data to be processed is found, or until all s candidate data have been traversed, at which point the loop ends. If none of the s candidate data has a related data with an inclusion relationship to the data to be processed, then step S405 can be executed.
[0111] Optionally, if the data storage table is empty, that is, if the data storage table does not contain candidate data, or if s is considered to be 0, then the data to be processed can be stored in the data storage table, and the storage address of the data to be processed can be recorded.
[0112] Step S403: If a first associated data with a first inclusion relationship with the data to be processed is found in the data storage table, the storage address of the data to be processed is determined according to the storage address of the first associated data.
[0113] In this embodiment of the application, the first inclusion relationship refers to the relationship that the first associated data includes the data to be processed. That is, the data to be processed can be indicated by all or part of the first associated data. In other words, the storage address of the data to be processed can be determined based on the storage address of the first associated data. See details below. Figure 3 The specific description of step S302 is shown below.
[0114] Step S404: If a second associated data with a second inclusion relationship with the data to be processed is found in the data storage table, the data to be processed is stored in the data storage table, the storage address of the second associated data is updated according to the storage address of the data to be processed, and the second associated data is deleted from the data storage table.
[0115] In this embodiment, the second inclusion relationship refers to the relationship that the data to be processed includes the second associated data. That is, the second associated data can be indicated by all or part of the data to be processed. Specifically, the data to be processed can be stored in a data storage table, and the storage address of the data to be processed can be recorded. The storage address of the second associated data is then updated based on the storage address of the data to be processed. See details [link to relevant documentation]. Figure 3 The specific description of step S303 is shown below.
[0116] Step S405: If no related data with an inclusion relationship with the data to be processed is found in the data storage table, the data to be processed is stored in the data storage table.
[0117] In this embodiment of the application, if no related data with an inclusion relationship with the data to be processed is found in the data storage table, it means that the data to be processed cannot reuse the data in the data storage table. The data to be processed can be stored in the data storage table, and the storage address of the data to be processed is recorded.
[0118] Furthermore, when a computer device needs to retrieve data to be processed, it can do so by retrieving the data from a data storage table based on the storage address of the data to be processed. For example, in response to a processing request for a target service, the target service is executed; if the target service includes data to be processed, the data to be processed is retrieved from the data storage table based on the storage address of the data to be processed; and business data corresponding to the target service is generated based on the data to be processed.
[0119] In this embodiment, data to be processed is acquired. If a first associated data with a first inclusion relationship is found in the data storage table, the storage address of the data to be processed is determined according to the storage address of the first associated data. The first inclusion relationship means that the first associated data includes the data to be processed, and the first inclusion relationship indicates that the data volume of the first associated data is greater than or equal to the data volume of the data to be processed. If a second associated data with a second inclusion relationship is found in the data storage table, the data to be processed is stored in the data storage table, the storage address of the second associated data is updated according to the storage address of the data to be processed, and the second associated data is deleted from the data storage table. The second inclusion relationship means that the data to be processed includes the second associated data, and the second inclusion relationship indicates that the data volume of the data to be processed is greater than the data volume of the second associated data. Through the above process, the duplication between the data to be stored (i.e., the data to be processed) and the already stored data (i.e., the data stored in the data storage table) can be fully considered. Storage reuse is performed regardless of when they are the same, and storage reuse can also be performed when there is an inclusion relationship, which greatly reduces the duplicate data in the data storage table, reduces data redundancy, and thus reduces the data storage space.
[0120] Further, see Figure 5 , Figure 5 This is a schematic flowchart illustrating a data storage loop process provided in an embodiment of this application. For example... Figure 5 As shown, the data storage process includes the following steps:
[0121] Step S501: Obtain the set of data to be processed and compiled, denoted as C = {c1, c2, ..., c...}k , initialize the data iteration count \(i\).
[0122] In an embodiment of the present application, a computer device can obtain a set of data to be processed, which can be denoted as \(C\). The set of data to be processed includes \(k\) data to be processed, where \(k\) is a positive integer. For example, assume that the set of data to be processed includes data to be processed \(c_1\), data to be processed \(c_2\), …, and data to be processed \(c\) k . The \(k\) data to be processed included in the set of data to be processed can be stored in sequence. Specifically, the data iteration count \(i\) can be initialized. For example, the initial value of \(i\) is 0, which is used to indicate that the data to be processed in the set of data to be processed has not started to be stored yet. Then, step S502 is further executed.
[0123] Step S502: \(i = i + 1\).
[0124] In an embodiment of the present application, the numerical value of the data iteration count \(i\) is updated to indicate that the \(i\)-th data to be processed in the set of data to be processed \(C\) is being stored, that is, the value of \(i\) is incremented by one to process the next data to be processed. For example, when \(i = 1\), the first data to be processed in the set of data to be processed is stored in subsequent steps. Then, step S503 is further executed.
[0125] Step S503: Is \(i < k\) or \(i = k\)?
[0126] In an embodiment of the present application, it can be detected whether the data iteration count is less than or equal to the amount to be processed, and the amount to be processed is \(k\), which is used to represent the total number of data to be processed included in the set of data to be processed. Among them, if the data iteration count is less than or equal to the amount to be processed, step S504 is executed; if the data iteration count is greater than the amount to be processed, it means that all the data to be processed in the set of data to be processed have been stored, and the data storage process can be ended.
[0127] Step S504: Detect whether the data to be processed \(c\) i is of the second data type.
[0128] In an embodiment of the present application, the computer device can detect whether the data type of the data to be processed \(c\) i is of the second data type. Here, \(c\) i is used to represent the \(i\)-th data to be processed in the set of data to be processed. For example, assume that the second type of data is a vector constant, that is, the second data type is a vector constant type. Here, it means detecting whether the data to be processed is a vector constant. If the data type of the data to be processed \(c\) i is not of the second data type, that is, the data type of the data to be processed \(c\) i is of the first data type, then step S505 is executed; if the data type of the data to be processed \(c\)i If the data type is the second data type, then proceed to step S506.
[0129] Step S505: Execute the data storage subroutine for the first data type.
[0130] In this embodiment of the application, the computer device can process data c i When the data type is the first data type, execute Figure 6 The example shown is a data storage subroutine for the first data type. Specifically, as follows... Figure 4 As shown in case ① of step S402. After executing the data storage subroutine for the first data type, the process returns to step S502 to store the next piece of data to be processed.
[0131] Step S506: Execute the data storage subroutine for the second data type.
[0132] In this embodiment of the application, the computer device can process data c i When the data type is a second data type, execute Figure 7 The example shown is a data storage subroutine for the second data type. Specifically, as follows... Figure 4 As shown in case ② of step S402. After executing the data storage subroutine for the second data type, the process returns to step S502 to store the next piece of data to be processed.
[0133] Further, please see Figure 6 , Figure 6 This is a flowchart illustrating a method for storing data of a first data type, provided in an embodiment of this application, used to represent a subroutine for storing data of the first data type. For example... Figure 6 As shown, the data storage process includes the following steps:
[0134] Step S601: Obtain the set of candidate data that already exists in the data storage table, denoted as T = {t1, t2, ..., t}. s} initializes the number of data matches j.
[0135] In this embodiment of the application, the computer device can obtain a set of candidate data that already exists in the data storage table, that is, the s candidate data included in the data storage table. The data storage table can be denoted as T. For example, it is assumed that the s candidate data include candidate data t1, candidate data t2, ..., and candidate data t s It is possible to iterate through s candidate data and sequentially compare them with the data to be processed, c. iMake a comparison. Specifically, initialize the data matching count j. For example, the initial value of j is 0, which is used to indicate that the comparison of the s candidate data has not started yet, and then further execute step S602. Here, s is used to represent the number of candidate data currently included in the data storage table when obtaining the data storage table.
[0136] Step S602, j = j + 1.
[0137] In the embodiment of the present application, update the value of the data matching count j, which is used to indicate that when processing the data c i Compare with the j-th candidate data in the data storage table, that is, increment the value of j by one to traverse the next candidate data. For example, when j is 1, in the subsequent steps, compare the first candidate data in the data storage table with the data c to be processed i and then further execute step S603.
[0138] Step S603, is j < s or j = s?
[0139] In the embodiment of the present application, detect whether the data matching count is less than or equal to the candidate quantity. The candidate quantity is s, which is used to represent the total number of candidate data included in the data storage table. Among them, if the data matching count is less than or equal to the candidate quantity, then execute step S604; if the data matching count is greater than the candidate quantity, it means that the traversal of the data storage table is completed, that is, no associated data having an inclusion relationship with the data c to be processed is found in the data storage table, and then execute step S610. i and then execute step S610.
[0140] Step S604, detect whether the candidate data t j is of the second data type.
[0141] In the embodiment of the present application, the computer device can detect whether the candidate data t j is of the second data type. If the candidate data t j is not of the second data type, that is, the candidate data t j is of the first data type, then execute step S608; if the candidate data t j is of the second data type, then execute step S605.
[0142] Step S605, detect whether the component type of the candidate data t j is the same as the format type of c i or not.
[0143] In the embodiment of the present application, if the component type of the candidate data t j is the same as the format type of the data c to be processed i then execute step S606; if the candidate data t jThe component type and the data to be processed c i If the format types are different, then it can be determined that the j-th candidate data does not contain any elements that are the same as the data to be processed, and it can be determined that the j-th candidate data and the data to be processed are different. i If there is no inclusion relationship between the two, we can return to step S602 to compare the next candidate data. Here, candidate data t... j It refers to the j-th candidate data in the data storage table.
[0144] Step S606, t j Does it exist with c? i Same amount.
[0145] In this embodiment of the application, the elements included in the j-th candidate data are sequentially compared with the data to be processed, c. i For comparison, if candidate data t j There exists data c to be processed. i The same components, i.e., in candidate data t j The data c to be processed was found in the middle. i If the elements are the same, then candidate data t is determined. j This includes data c to be processed. i Identical elements can determine candidate data t j To process the data c i If there is a first inclusion relationship between the first related data, proceed to step S607; if the candidate data t j The data c to be processed does not exist in the data. i The same components, i.e., in candidate data t j No matching data c was found. i If the elements are the same, then candidate data t is determined. j This does not include data c to be processed. i Identical elements can determine candidate data t j With the data to be processed c i If there is no inclusion relationship between them, we can return to step S602 and compare the next candidate data.
[0146] Step S607, according to t j The storage address of c i The storage address.
[0147] In this embodiment of the application, based on candidate data t j The storage address is used to determine the data to be processed, c. i The storage address can be found in [reference]. Figure 3 The specific description shown in step S302 indicates that, at this point, the candidate data t j As the first associated data, candidate data t can be obtained.j The first component storage space is used to obtain the data to be processed, c. i In candidate data t j Based on the offset position corresponding to the first component's storage space and the offset position, the data to be processed, c, is determined. i In candidate data t j The corresponding address offset, based on the address offset and candidate data t j The storage address is used to determine the data to be processed, c. i The storage address. This completes the data storage subroutine for the first data type and returns. Figure 5 The step S502 shown.
[0148] Step S608, t j With c i Are they the same?
[0149] In this embodiment of the application, the computer device can detect candidate data t j With the data to be processed c i Are they the same? If candidate data t j With the data to be processed c i If they are the same, then the j-th candidate data is determined to be the first associated data that has a first inclusion relationship with the data to be processed, and step S609 is executed; if the candidate data t j With the data to be processed c i If they are different, it is determined that there is no inclusion relationship between the j-th candidate data and the data to be processed, and the process can return to step S602 to compare the next candidate data.
[0150] Step S609, according to t j The storage address of c i The storage address.
[0151] In this embodiment of the application, based on candidate data t j The storage address is used to determine the data to be processed, c. i The storage address can be found in [reference]. Figure 3 The specific description shown in step S302 indicates that, at this point, the candidate data t j As the first associated data, candidate data t can be... j The storage address is determined as the data to be processed, c. i The storage address. This completes the data storage subroutine for the first data type and returns. Figure 5 The step S502 shown.
[0152] Step S610: Store the data to be processed c i .
[0153] In an embodiment of the present application, the data c to be processed can be i stored in a data storage table, and the storage address of the data c to be processed is recorded. i After completing the data storage subroutine for the first data type this time, return to Figure 5 step S502 shown.
[0154] Further, please refer to Figure 7 , Figure 7 which is a flowchart of a method for data storage of a second data type provided by an embodiment of the present application, used to represent a data storage subroutine for the second data type. As Figure 7 shown, this data storage process includes the following steps:
[0155] Step S701, obtain the existing candidate data set in the data storage table, denoted as T = {t1, t2,..., t s}, and initialize the data matching count j.
[0156] In an embodiment of the present application, the computer device can obtain the existing candidate data set in the data storage table, that is, the s candidate data included in this data storage table. Among them, the data storage table can be denoted as T. For example, assume that the s candidate data include candidate data t1, candidate data t2,..., and candidate data t s . The s candidate data can be traversed and compared with the data c to be processed in turn. Specifically, the data matching count j is initialized. For example, the initial value of j is 0, which is used to indicate that the comparison of the s candidate data has not started yet, and then step S602 is further executed. Here, s is used to represent the number of candidate data currently included in the data storage table when obtaining this data storage table. i
[0157] Step S702, j = j + 1.
[0158] In an embodiment of the present application, the value of the data matching count j is updated numerically, which is used to indicate that the data c to be processed i is compared with the j-th candidate data in the data storage table. That is, the value of j is incremented by 1 to traverse the next candidate data. For example, when j is 1, in the subsequent steps, the first candidate data in the data storage table is compared with the data c to be processed i . Then step S703 is further executed.
[0159] Step S703, is j < s or j = s?
[0160] In this embodiment, the number of data matching counts is checked to see if it is less than or equal to the number of candidates, where the number of candidates is s, representing the total number of candidate data included in the data storage table. If the number of data matching counts is less than or equal to the number of candidates, step S704 is executed; if the number of data matching counts is greater than the number of candidates, it indicates that the data storage table has been traversed, meaning that no matching data c was found in the data storage table. i If there are related data with an inclusion relationship, proceed to step S712.
[0161] Step S704, detect candidate data t j Is it a secondary data type?
[0162] In this embodiment of the application, the computer device can detect candidate data t j Is it a secondary data type? If candidate data t j Not a second data type, that is, candidate data t j If the first data type is selected, then candidate data t is determined. j With the data to be processed c i If there is no inclusion relationship between the two, return to step S702 to compare the next candidate data. Alternatively, if candidate data t... j As the first data type, it can be used in the data to be processed, c. i Searching for candidate data t j The same element; if in the data to be processed c i Find candidate data t in j If the elements are the same, then the data to be processed, c, is determined. i Including candidate data t j Candidate data t can be determined j To process the data c i If there is a second associated data with a second inclusion relationship, step S711 can be executed; if there is data c to be processed... i No matching candidate data t was found. j If the elements are the same, then candidate data t is determined. j With the data to be processed c i If there is no inclusion relationship between them, return to step S702 and compare the next candidate data.
[0163] If candidate data t j If it is the second data type, then proceed to step S705.
[0164] Step S705, detect candidate data t j Component type and c i Are the component types the same?
[0165] In this embodiment of the application, if candidate data tj The component type and the data to be processed c i If the component types are the same, then proceed to step S706; if the candidate data t j The component type and the data to be processed c i If the component types are different, then the candidate data t is determined. j With the data to be processed c i If there is no inclusion relationship between them, return to step S702 and compare the next candidate data.
[0166] Step S706, obtain candidate data t j The first element count x of the included elements, and the data to be processed c. i The number y of the second element of the included elements.
[0167] Step S707, x is greater than or equal to y.
[0168] In this embodiment of the application, if the number of the first element x is greater than or equal to the number of the second element y, then step S708 is executed; if the number of the first element x is less than the number of the second element y, then step S710 is executed.
[0169] Step S708, candidate data t j There exist y consecutive elements in c. i same.
[0170] In this embodiment of the application, candidate data t is detected. j Does there exist y consecutive elements in the data to be processed that are related to the data c? i The same applies if candidate data t j There exist y consecutive elements and c data to be processed. i Same, that is, candidate data t j There exists data c to be processed. i The same candidate subsequence, where a candidate subsequence refers to candidate data t j c of data to be processed i If there are y consecutive identical elements, then candidate data t is determined. j Including data to be processed c i Candidate data t can be determined j To process the data c i If there is a first inclusion relationship between the first related data, proceed to step S709; if the candidate data t j There are no y consecutive elements in the data to be processed that match the data c. i Same, that is, candidate data t j The data c to be processed does not exist in the data. i If the candidate subsequences are the same, then the candidate data t is determined. j With the data to be processed ci If there is no inclusion relationship between them, return to step S702 and compare the next candidate data.
[0171] Step S709, according to t j The storage address of c i The storage address.
[0172] In this embodiment of the application, based on candidate data t j The storage address is used to determine the data to be processed, c. i The storage address can be found in [reference]. Figure 3 The specific description shown in step S302 indicates that, at this point, the candidate data t j As the first associated data, candidate data t can be obtained. j The first component storage space is used to obtain the data to be processed, c. i In candidate data t j The corresponding offset position in the candidate data t can be determined based on the first element in the candidate subsequence. j The position in the memory determines the data c to be processed, based on the storage space and offset of the first component. i In candidate data t j The corresponding address offset, based on the address offset and candidate data t j The storage address is used to determine the data to be processed, c. i The storage address. Of course, if the candidate data t j With the data to be processed c i If they are the same, then the candidate data t can be... j The storage address is directly determined as the data to be processed, c. i The storage address. Further, complete the data storage subroutine for the second data type and return to execution. Figure 5 The step S502 shown.
[0173] Step S710, c i There exist x consecutive elements and candidate data t. j same?
[0174] In this embodiment of the application, the data to be processed, c, is detected. i Does there exist x consecutive elements in the candidate data t? j Similarly, if the data to be processed is c i There exist x consecutive elements and candidate data t. j Same, that is, the data to be processed c i There exists candidate data t j The same processing subsequence, where the processing subsequence refers to the data c to be processed. i In and candidate data t jIf x consecutive elements are identical, then the data to be processed, c, is determined. i Including candidate data t j Candidate data t can be determined j To process the data c i If there is a second associated data with a second containment relationship, proceed to step S711; if the data to be processed c i There are no x consecutive elements in the candidate data t. j Same, that is, the data to be processed c i There is no candidate data t in the middle. j If the same subsequence is processed, then candidate data t is determined. j With the data to be processed c i If there is no inclusion relationship between them, return to step S702 and compare the next candidate data.
[0175] Step S711, store c i , update t j The storage address, delete t j .
[0176] In this embodiment of the application, the data to be processed c i Store the data to be processed in the data storage table and record the data c. i The storage address of the candidate data t. j For the second set of related data, obtain candidate data t. j In the data to be processed c i Based on the corresponding associated position and the storage address of the data to be processed, the data association address is determined. The candidate data t is then updated according to the data association address. j The storage address.
[0177] Step S712, store the data to be processed c i .
[0178] In this embodiment of the application, the data to be processed can be c i Store the data to be processed in the data storage table and record the data c. i The storage address. This completes the data storage subroutine for the second data type and returns. Figure 5 The step S502 shown.
[0179] For example, (1) Assume there are data to be processed: c1 = {1.0, 1.0}, c2 = {1.0, 1.0, 1.0}, and c3 = 1.0. Specifically, double_vector c1 = {1.0, 1.0} indicates that the component type of the data to be processed c1 is double; double_vector c2 = {1.0, 1.0, 1.0} indicates that the component type of the data to be processed c2 is double; double c3 = 1.0 indicates that the format type of the data to be processed c3 is double. That is to say, the set of data to be processed obtained by the computer device can be denoted as C = {c1 = {1.0, 1.0}, c2 = {1.0, 1.0, 1.0}, c3 = 1.0}, which includes 3 data to be processed, i.e., k is 3. The number of data iterations i is initialized, for example, the initial value of i is 0.
[0180] (2) Update the data iteration number i to get i = i + 1 = 1.
[0181] (3) If i is 1 and less than the amount to be processed k, and k is 3, execute step (4).
[0182] (4) Data c to be processed was detected. i =c1={1.0,1.0}, is a vector constant, that is, the data type is the second data type, and step (5) is executed.
[0183] (5) Figure 5 Step S506, begin execution Figure 7 Step S701 is shown. Assume the obtained data storage table is empty, denoted as T = {}, and initialize the number of data matching j, such as the initial value of j being 0.
[0184] (6) Update the number of data matching j to get j = j + 1 = 1. At this time, the number of candidates s is 0. Execute step S703. If the number of data matching j is greater than the number of candidates s, then execute step S712. Store the data to be processed c1 = {1.0, 1.0} in the data storage table and record the storage address of the processed data c1 = {1.0, 1.0} in the data storage table. At this time, the data storage table is T = {t1 = {1.0, 1.0}. At this time, t1 = {1.0, 1.0} is c1. The data storage subroutine for the second data type is completed. Execute step (7), i.e. step S502.
[0185] (7) That is, step S502, update the data iteration number i, at this time i = i + 1 = 2.
[0186] (8) That is, in step S503, i is detected to be 2, which is less than the amount to be processed k, and k is 3, and step (9) is executed.
[0187] (9) That is, step S504, the data to be processed c is detected. i =c2={1.0, 1.0, 1.0}, is a vector constant, that is, the data type is the second data type, execute step (10), that is, step S506.
[0188] (10) Start execution Figure 7 Step S701 is shown. Obtain the candidate data set from the data storage table, which is T = {t1 = {1.0, 1.0}}. At this time, the number of candidates s is 1, and the number of data matching times j is initialized, such as the initial value of j being 0.
[0189] (11) That is, step S702, update the number of data matching j, and get j = j + 1 = 1.
[0190] (12) That is, step S703, the number of data matching times j is equal to the number of candidates s.
[0191] (13) That is, step S704, candidate data t is detected. j =t1={1.0, 1.0} is the second data type. Execute step S705 to obtain candidate data t. j The component type of t1 = {1.0, 1.0} is double, and the data to be processed, c, is obtained. i The component type of c2={1.0, 1.0, 1.0} is double, which is the candidate data t. j The component type and the data to be processed c i If the component types are the same, proceed to step S706.
[0192] (14) That is, step S706, obtaining candidate data t j The first element of the included elements is counted as x, where x is 2, and the data to be processed is obtained as c. i The number of the second element y of the included elements is 3, and x is less than y (i.e., step S707), then proceed to step S710.
[0193] (15) That is, step S710, the data to be processed c is detected. i There exist x consecutive elements and candidate data t. j Same as above, proceed to step S711.
[0194] (16) That is, step S711, the data to be processed c i =c2={1.0, 1.0, 1.0} is stored in the data storage table, recording the data to be processed, c. i The storage address. Based on the data to be processed, c i The storage address is updated to update the candidate data t. j=The storage address of t1 = {1.0, 1.0}, that is, the storage address of c1 is obtained from the storage address of c2. At this time, the data storage table is T = {t1 = {1.0, 1.0, 1.0}}. At this time, t1 = {1.0, 1.0, 1.0} is c2. The data storage subroutine for the second data type is completed. Execute step (17), that is, step S502.
[0195] (17) That is, step S502, update the data iteration number i, at this time i = i + 1 = 3.
[0196] (18) That is, step S503, i is detected to be 3, which is equal to the quantity to be processed k, k is 3, and step (19) is executed.
[0197] (19) That is, step S504, the data to be processed c is detected. i =c3=1.0, which is a scalar constant, that is, the data type is the first data type. Execute step (20), that is, step S505.
[0198] (20) That is, step S505, start execution. Figure 6 Step S601 is shown. Obtain the candidate data set from the data storage table, which is T = {t1 = {1.0, 1.0, 1.0}}. At this time, the number of candidates s is 1, and the number of data matching times j is initialized, such as the initial value of j being 0.
[0199] (21) That is, step S602, update the number of data matching j, and get j = j + 1 = 1.
[0200] (22) That is, step S603, the number of data matching times j is equal to the number of candidates s.
[0201] (23) That is, step S604, candidate data t is detected. j =t1={1.0, 1.0, 1.0} is the second data type. Execute step S605 to obtain candidate data t. j The component type of t1 = {1.0, 1.0, 1.0} is double, and the data to be processed, c, is obtained. i =c3=1.0 has a format type of double, which means the candidate data t j The component type and the data to be processed c i If the format types are the same, proceed to step S606.
[0202] (24) That is, step S606, candidate data t is detected. j =t1={1.0, 1.0, 1.0}, the first element and the data to be processed c i The same applies; proceed to step S607.
[0203] (25) That is, step S607, which involves selecting candidate data t j The address of the first element of t1 = {1.0, 1.0, 1.0} is determined as the data c to be processed. i The storage address is T = {t1 = {1.0, 1.0, 1.0}}, and t1 = {1.0, 1.0, 1.0} is c2. The data storage subroutine for the first data type is completed, and step (26) is executed, i.e., step S502.
[0204] (26) That is, step S502, update the data iteration number i, at this time i = i + 1 = 4.
[0205] (27) That is, in step S503, i is detected to be 4, which is greater than the amount to be processed k, k is 3, the current data storage process ends, and the data storage table T = {t1 = {1.0, 1.0, 1.0}} is obtained.
[0206] Through the above process, we obtain the data storage table T = {t1 = {1.0, 1.0, 1.0}}, which stores the data to be processed, c2. The data to be processed, c1, and c3 directly reuse the data to be processed, reducing data redundancy and reducing data storage space.
[0207] Furthermore, for example, when it is necessary to retrieve the data to be processed c3, the data to be processed c3 can be retrieved from the data storage table based on the storage address of the data to be processed c3. Specifically, the storage address of the data to be processed c3 points to the first element of the data storage table of the data to be processed c2.
[0208] Further, please see Figure 8 , Figure 8 This is a schematic diagram of a data storage device provided in an embodiment of this application. The data storage device can be a computer program (including program code, etc.) running on a computer device; for example, the data storage device can be application software. The device can be used to execute corresponding steps in the methods provided in the embodiments of this application. Figure 8 As shown, the data storage device 800 can be used for Figure 3 Specifically, the computer device 800 in the corresponding embodiment may include: a data acquisition module 11, an address determination module 12, a data storage module 13, an address update module 14, and an address deletion module 15.
[0209] Data acquisition module 11 is used to acquire data to be processed;
[0210] The address determination module 12 is used to determine the storage address of the data to be processed based on the storage address of the first associated data if a first associated data with a first inclusion relationship is found in the data storage table; the first inclusion relationship refers to the relationship that the first associated data includes the data to be processed, and the first inclusion relationship indicates that the data volume of the first associated data is greater than or equal to the data volume of the data to be processed.
[0211] The data storage module 13 is used to store the data to be processed in the data storage table if a second related data that has a second inclusion relationship with the data to be processed is found in the data storage table.
[0212] Address update module 14 is used to update the storage address of the second associated data according to the storage address of the data to be processed;
[0213] Address deletion module 15 is used to delete the second associated data in the data storage table; the second inclusion relationship refers to the relationship that the data to be processed contains the second associated data, and the second inclusion relationship indicates that the data volume of the data to be processed is greater than the data volume of the second associated data.
[0214] The data type of the data to be processed is the first data type; the first data type refers to a data type that includes one element.
[0215] The device 800 also includes:
[0216] Data traversal module 16 is used to traverse s candidate data in the data storage table; s is a positive integer;
[0217] The first relationship determination module 17 is used to determine the j-th candidate data as first associated data that has a first inclusion relationship with the data to be processed if the data to be processed is the same as the j-th candidate data; j is a positive integer less than or equal to s; the j-th candidate data is a first data type;
[0218] The first relationship determination module 17 is further configured to determine that there is no inclusion relationship between the j-th candidate data and the data to be processed if the data to be processed is different from the j-th candidate data; the j-th candidate data is a first data type.
[0219] The data type of the data to be processed is the first data type; the first data type refers to a data type that includes one element.
[0220] The device 800 also includes:
[0221] This data traversal module 16 is used to traverse s candidate data in the data storage table; s is a positive integer.
[0222] The second relationship determination module 18 is used to determine the j-th candidate data as first associated data that has a first inclusion relationship with the data to be processed if the j-th candidate data includes the same element as the data to be processed; j is a positive integer less than or equal to s; the j-th candidate data is a second data type;
[0223] The second relationship determination module 18 is further configured to determine that there is no inclusion relationship between the j-th candidate data and the data to be processed if the j-th candidate data does not contain any element that is the same as the data to be processed; the j-th candidate data is a second data type.
[0224] The device 800 also includes:
[0225] Type acquisition module 19 is used to acquire the component type of the j-th candidate data; the second data type refers to a data type that includes at least two elements;
[0226] The type matching module 20 is used to obtain the format type of the data to be processed. If the component type of the j-th candidate data is different from the format type of the data to be processed, it is determined that the j-th candidate data does not contain the same element as the data to be processed.
[0227] The element comparison module 21 is used to compare the elements included in the j-th candidate data with the data to be processed in turn if the component type of the j-th candidate data is the same as the format type of the data to be processed.
[0228] The first element search module 22 is used to determine that the j-th candidate data includes the same element as the data to be processed if an element identical to the data to be processed is found in the j-th candidate data.
[0229] The second element search module 23 is used to determine that the j-th candidate data does not include an element that is the same as the data to be processed if no element identical to the data to be processed is found in the j-th candidate data.
[0230] The data to be processed is of the second data type; the second data type refers to a data type that includes at least two elements.
[0231] The device 800 also includes:
[0232] This data traversal module 16 is used to traverse s candidate data in the data storage table; s is a positive integer.
[0233] The third relationship determination module 24 is used to determine the j-th candidate data as the first associated data that has a first inclusion relationship with the data to be processed if the data to be processed is the same as the j-th candidate data, or if the j-th candidate data includes the data to be processed; j is a positive integer less than or equal to s.
[0234] The third relationship determination module 24 is further configured to determine, if the data to be processed includes the j-th candidate data, that the j-th candidate data is a second associated data that has a second inclusion relationship with the data to be processed.
[0235] The device 800 also includes:
[0236] The fourth relationship determination module 25 is used to determine that if the data type of the j-th candidate data is the first data type, then there is no inclusion relationship between the j-th candidate data and the data to be processed; the first data type refers to a data type that includes one element;
[0237] The component type acquisition module 26 is used to acquire the component type of the j-th candidate data and the component type of the data to be processed if the data type of the j-th candidate data is the second data type.
[0238] The fifth relationship determination module 27 is used to determine that there is no inclusion relationship between the j-th candidate data and the data to be processed if the component type of the j-th candidate data is different from the component type of the data to be processed.
[0239] The device 800 also includes:
[0240] The quantity acquisition module 28 is used to acquire the first element count of the elements included in the j-th candidate data and the second element count of the elements included in the data to be processed if the component type of the j-th candidate data is the same as the component type of the data to be processed.
[0241] The sixth relation determination module 29 is used to determine that the j-th candidate data includes the data to be processed if the number of the first element is greater than or equal to the number of the second element, and there is a candidate subsequence in the j-th candidate data that is the same as the data to be processed.
[0242] The sixth relation determination module 29 is further configured to determine that the data to be processed includes the j-th candidate data if the number of the second element is greater than the number of the first element and there is a processing subsequence in the data to be processed that is the same as the j-th candidate data.
[0243] The device 800 also includes:
[0244] The third element search module 30 is used to search for the element that is the same as the j-th candidate data in the data to be processed if the data type of the j-th candidate data is the first data type.
[0245] The seventh relation determination module 31 is used to determine that the data to be processed includes the j-th candidate data if an element identical to the j-th candidate data is found in the data to be processed.
[0246] The seventh relationship determination module 31 is also used to determine that there is no inclusion relationship between the j-th candidate data and the data to be processed if no element identical to the j-th candidate data is found in the data to be processed.
[0247] The address determination module 12 includes:
[0248] Address determination unit 121 is used to determine the storage address of the first associated data as the storage address of the data to be processed if the first associated data is the same as the data to be processed.
[0249] Address generation unit 122 is used to obtain the address offset of the data to be processed in the first associated data if the first associated data is different from the data to be processed, and determine the storage address of the data to be processed based on the address offset and the storage address of the first associated data.
[0250] The address update module 14 includes:
[0251] The association determination unit 141 is used to obtain the association position corresponding to the second association data in the data to be processed, and determine the data association address based on the association position and the storage address of the data to be processed;
[0252] Address update unit 142 is used to update the storage address of the second associated data to the data associated address.
[0253] The device 800 also includes:
[0254] The address recording module 32 is used to store the data to be processed in the data storage table and record the storage address of the data to be processed if no related data with an inclusion relationship is found in the data storage table.
[0255] The device 800 also includes:
[0256] The request and response module 33 is used to respond to processing requests for the target business and execute the target business.
[0257] The data lookup module 34 is used to retrieve the data to be processed from the data storage table based on the storage address of the data to be processed if the target business includes data to be processed.
[0258] The data generation module 35 is used to generate business data corresponding to the target business based on the data to be processed.
[0259] This application provides a data storage device that can acquire data to be processed. If a first associated data with a first inclusion relationship is found in the data storage table, the storage address of the data to be processed is determined based on the storage address of the first associated data. The first inclusion relationship means that the first associated data includes the data to be processed, and the first inclusion relationship indicates that the amount of data in the first associated data is greater than or equal to the amount of data in the data to be processed. If a second associated data with a second inclusion relationship is found in the data storage table, the data to be processed is stored in the data storage table, the storage address of the second associated data is updated based on the storage address of the data to be processed, and the second associated data is deleted from the data storage table. The second inclusion relationship means that the data to be processed includes the second associated data, and the second inclusion relationship indicates that the amount of data in the data to be processed is greater than the amount of data in the second associated data. Through the above process, the duplication between the data to be stored (i.e., the data to be processed) and the already stored data (i.e., the data stored in the data storage table) can be fully considered. Storage reuse is performed regardless of when they are the same, and storage reuse can also be performed when there is an inclusion relationship, which greatly reduces duplicate data in the data storage table, reduces data redundancy, and thus reduces data storage space.
[0260] See Figure 9 , Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 9 As shown, the computer device in this embodiment may include one or more processors 901, a memory 902, and an input / output interface 903. The processor 901, memory 902, and input / output interface 903 are connected via a bus 904. The memory 902 stores a computer program, which includes program instructions. The input / output interface 903 receives and outputs data, such as for data interaction between the computer device and a terminal device. The processor 901 executes the program instructions stored in the memory 902.
[0261] The processor 901 can perform the following operations:
[0262] Obtain the data to be processed;
[0263] If a first associated data with a first inclusion relationship is found in the data storage table, the storage address of the data to be processed is determined according to the storage address of the first associated data; the first inclusion relationship means that the first associated data contains the data to be processed, and the first inclusion relationship indicates that the data volume of the first associated data is greater than or equal to the data volume of the data to be processed.
[0264] If a second related data with a second inclusion relationship is found in the data storage table, the data to be processed is stored in the data storage table. Based on the storage address of the data to be processed, the storage address of the second related data is updated, and the second related data in the data storage table is deleted. The second inclusion relationship refers to the relationship that the data to be processed contains the second related data, and the second inclusion relationship indicates that the amount of data to be processed is greater than the amount of data of the second related data.
[0265] The data type of the data to be processed is a first data type; a first data type refers to a data type that includes one element; the processor 901 can perform the following operations:
[0266] Iterate through the s candidate data in the data storage table; s is a positive integer.
[0267] If the data to be processed is the same as the j-th candidate data, then the j-th candidate data is determined to be the first associated data that has a first inclusion relationship with the data to be processed; j is a positive integer less than or equal to s; the j-th candidate data is a first data type;
[0268] If the data to be processed is different from the j-th candidate data, then it is determined that there is no inclusion relationship between the j-th candidate data and the data to be processed; the j-th candidate data is of the first data type.
[0269] The data type of the data to be processed is a first data type; a first data type refers to a data type that includes one element; the processor 901 can also perform the following operations:
[0270] Iterate through the s candidate data in the data storage table; s is a positive integer.
[0271] If the j-th candidate data includes an element that is the same as the data to be processed, then the j-th candidate data is determined to be the first associated data that has a first inclusion relationship with the data to be processed; j is a positive integer less than or equal to s; the j-th candidate data is a second data type; the second data type refers to a data type that includes at least two elements;
[0272] If the j-th candidate data does not contain any elements that are the same as the data to be processed, then it is determined that there is no inclusion relationship between the j-th candidate data and the data to be processed; the j-th candidate data is a second data type.
[0273] The processor 901 can also perform the following operations:
[0274] Obtain the component type of the j-th candidate data; the second data type refers to a data type that includes at least two elements;
[0275] Obtain the format type of the data to be processed. If the component type of the j-th candidate data is different from the format type of the data to be processed, then determine that the j-th candidate data does not contain the same element as the data to be processed.
[0276] If the component type of the j-th candidate data is the same as the format type of the data to be processed, then the elements included in the j-th candidate data are compared with the data to be processed in turn.
[0277] If an element identical to the data to be processed is found in the j-th candidate data, then it is determined that the j-th candidate data includes an element identical to the data to be processed.
[0278] If no element identical to the data to be processed is found in the j-th candidate data, then it is determined that the j-th candidate data does not contain an element identical to the data to be processed.
[0279] The data to be processed is of the second data type; the second data type refers to a data type that includes at least two elements.
[0280] The processor 901 can also perform the following operations:
[0281] Iterate through the s candidate data in the data storage table; s is a positive integer.
[0282] If the data to be processed is the same as the j-th candidate data, or the j-th candidate data includes the data to be processed, then the j-th candidate data is determined to be the first associated data that has a first inclusion relationship with the data to be processed; j is a positive integer less than or equal to s;
[0283] If the data to be processed includes the j-th candidate data, then the j-th candidate data is determined to be the second associated data that has a second inclusion relationship with the data to be processed.
[0284] The processor 901 can also perform the following operations:
[0285] If the data type of the j-th candidate data is the first data type, then it is determined that there is no inclusion relationship between the j-th candidate data and the data to be processed; the first data type refers to a data type that includes one element.
[0286] If the data type of the j-th candidate data is the second data type, then obtain the component type of the j-th candidate data and the component type of the data to be processed;
[0287] If the component type of the j-th candidate data is different from the component type of the data to be processed, then it is determined that there is no inclusion relationship between the j-th candidate data and the data to be processed.
[0288] The processor 901 can also perform the following operations:
[0289] If the component type of the j-th candidate data is the same as the component type of the data to be processed, then obtain the number of the first element of the elements included in the j-th candidate data and obtain the number of the second element of the elements included in the data to be processed.
[0290] If the number of the first element is greater than or equal to the number of the second element, and there is a candidate subsequence in the j-th candidate data that is the same as the data to be processed, then the j-th candidate data is determined to include the data to be processed.
[0291] If the number of the second element is greater than the number of the first element, and there is a processing subsequence in the data to be processed that is the same as the j-th candidate data, then it is determined that the data to be processed includes the j-th candidate data.
[0292] The processor 901 can also perform the following operations:
[0293] If the data type of the j-th candidate data is the first data type, then search for the element in the data to be processed that is the same as the j-th candidate data.
[0294] If an element identical to the j-th candidate data is found in the data to be processed, then it is determined that the data to be processed includes the j-th candidate data.
[0295] If no element identical to the j-th candidate data is found in the data to be processed, it is determined that there is no inclusion relationship between the j-th candidate data and the data to be processed.
[0296] When determining the storage address of the data to be processed based on the storage address of the first associated data, the processor 901 can perform the following operations:
[0297] If the first associated data is the same as the data to be processed, then the storage address of the first associated data is determined as the storage address of the data to be processed.
[0298] If the first associated data is different from the data to be processed, then obtain the address offset of the data to be processed in the first associated data, and determine the storage address of the data to be processed based on the address offset and the storage address of the first associated data.
[0299] When updating the storage address of the second associated data based on the storage address of the data to be processed, the processor 901 can perform the following operations:
[0300] Obtain the associated position of the second associated data in the data to be processed, and determine the data association address based on the associated position and the storage address of the data to be processed;
[0301] Update the storage address of the second associated data to the data association address.
[0302] The processor 901 can also perform the following operations:
[0303] If no related data with an inclusion relationship to the data to be processed is found in the data storage table, the data to be processed is stored in the data storage table, and the storage address of the data to be processed is recorded.
[0304] The processor 901 can also perform the following operations:
[0305] Respond to processing requests for the target business and execute the target business;
[0306] If the target business includes data to be processed, then the data to be processed is retrieved from the data storage table based on the storage address of the data to be processed.
[0307] Generate business data corresponding to the target business based on the data to be processed.
[0308] In some feasible implementations, the processor 901 may be a central processing unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0309] The memory 902 may include read-only memory and random access memory, and provides instructions and data to the processor 901 and the input / output interface 903. A portion of the memory 902 may also include non-volatile random access memory. For example, the memory 902 may also store device type information.
[0310] In practice, the computer device can perform actions such as these through its built-in functional modules. Figure 3 For details on the implementation methods provided for each step, please refer to [the relevant documentation / document / etc.]. Figure 3 The implementation methods provided for each step are not elaborated here.
[0311] This application provides a computer device including a processor, an input / output interface, and a memory. The processor retrieves a computer program from the memory and executes it. Figure 3Each step of the method shown involves data storage operations. This embodiment of the application acquires the data to be processed; if a first associated data with a first inclusion relationship is found in the data storage table, the storage address of the data to be processed is determined based on the storage address of the first associated data; the first inclusion relationship refers to the relationship where the first associated data includes the data to be processed, and the first inclusion relationship indicates that the amount of data in the first associated data is greater than or equal to the amount of data in the data to be processed; if a second associated data with a second inclusion relationship is found in the data storage table, the data to be processed is stored in the data storage table, the storage address of the second associated data is updated based on the storage address of the data to be processed, and the second associated data is deleted from the data storage table; the second inclusion relationship refers to the relationship where the data to be processed includes the second associated data, and the second inclusion relationship indicates that the amount of data in the data to be processed is greater than the amount of data in the second associated data. Through the above process, the duplication between the data to be stored (i.e., the data to be processed) and the already stored data (i.e., the data stored in the data storage table) can be fully considered. Storage reuse is performed regardless of when the data is stored at the same time, and storage reuse can also be performed when there is an inclusion relationship, greatly reducing duplicate data in the data storage table, reducing data redundancy, and thus reducing data storage space.
[0312] This application also provides a computer-readable storage medium storing a computer program adapted to be loaded and executed by a processor. Figure 3 For details on the data storage methods provided in each step, please refer to the document. Figure 3 The implementation methods provided for each step are not repeated here. Furthermore, the beneficial effects of using the same method are also not repeated. For technical details not disclosed in the computer-readable storage medium embodiments involved in this application, please refer to the description of the method embodiments of this application. As an example, a computer program may be deployed to execute on a single computer device, or on multiple computer devices located in one location, or on multiple computer devices distributed across multiple locations and interconnected via a communication network.
[0313] The computer-readable storage medium can be a data storage device provided in any of the foregoing embodiments or an internal storage unit of the computer device, such as a hard disk or memory of the computer device. The computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., provided on the computer device. Furthermore, the computer-readable storage medium can include both internal storage units and external storage devices of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.
[0314] This application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform... Figure 3 The methods provided among the various optional approaches comprehensively consider the duplication between the data to be stored (i.e., the data to be processed) and the data already stored (i.e., the data stored in the data storage table). Storage reuse is performed regardless of whether the data is stored at the same time or when there is an inclusion relationship. This greatly reduces duplicate data in the data storage table, reduces data redundancy, and thus reduces data storage space.
[0315] The terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the term "comprising," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or device that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.
[0316] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described in terms of functionality. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.
[0317] The methods and related apparatus provided in this application are described with reference to the method flowcharts and / or structural diagrams provided in this application. Specifically, each block of the method flowchart and / or structural diagram, as well as combinations of blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data storage device to create a machine, such that the instructions, which execute via the processor of the computer or other programmable data storage device, generate instructions for implementing the process... Figure 1 A schematic diagram of one or more processes and / or structures. Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data storage device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 A schematic diagram of one or more processes and / or structures. Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data storage device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable device for implementing the process. Figure 1 A process or multiple processes and / or structures illustrate the steps of the functions specified in one or more boxes.
[0318] The steps in the method of this application embodiment can be adjusted, combined, or deleted according to actual needs.
[0319] The modules in the device of this application embodiment can be merged, divided, and deleted according to actual needs.
[0320] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.
Claims
1. A data storage method, characterized in that, The method includes: Obtain the data to be processed; If a first associated data with a first inclusion relationship is found in the data storage table, the storage address of the data to be processed is determined according to the storage address of the first associated data; the first inclusion relationship refers to the relationship that the first associated data contains the data to be processed, and the first inclusion relationship indicates that the data volume of the first associated data is greater than or equal to the data volume of the data to be processed. If a second associated data with a second inclusion relationship is found in the data storage table, the data to be processed is stored in the data storage table, the storage address of the second associated data is updated according to the storage address of the data to be processed, and the second associated data is deleted from the data storage table; the second inclusion relationship refers to the relationship that the data to be processed contains the second associated data, and the second inclusion relationship indicates that the data volume of the data to be processed is greater than the data volume of the second associated data; Wherein, determining the storage address of the data to be processed based on the storage address of the first associated data includes: If the first associated data is different from the data to be processed, then the address offset of the data to be processed in the first associated data is obtained, and the storage address of the data to be processed is determined based on the address offset and the storage address of the first associated data.
2. The method as described in claim 1, characterized in that, The data type of the data to be processed is the first data type; The first data type refers to a data type that includes one element; The method further includes: Iterate through the s candidate data in the data storage table; s is a positive integer. If the data to be processed is the same as the j-th candidate data, then the j-th candidate data is determined to be a first associated data that has the first inclusion relationship with the data to be processed; j is a positive integer less than or equal to s; the j-th candidate data is the first data type; If the data to be processed is different from the j-th candidate data, then it is determined that there is no inclusion relationship between the j-th candidate data and the data to be processed; the j-th candidate data is the first data type.
3. The method as described in claim 1, characterized in that, The data type of the data to be processed is the first data type; The first data type refers to a data type that includes one element; The method further includes: Iterate through the s candidate data in the data storage table; s is a positive integer. If the j-th candidate data includes an element that is the same as the data to be processed, then the j-th candidate data is determined to be the first associated data that has the first inclusion relationship with the data to be processed; j is a positive integer less than or equal to s; the j-th candidate data is a second data type; the second data type refers to a data type that includes at least two elements; If the j-th candidate data does not contain any elements identical to the data to be processed, then it is determined that there is no inclusion relationship between the j-th candidate data and the data to be processed; the j-th candidate data is the second data type.
4. The method as described in claim 3, characterized in that, The method further includes: Obtain the component type of the j-th candidate data; the second data type refers to a data type that includes at least two elements; Obtain the format type of the data to be processed. If the component type of the j-th candidate data is different from the format type of the data to be processed, then determine that the j-th candidate data does not contain any elements that are the same as the data to be processed. If the component type of the j-th candidate data is the same as the format type of the data to be processed, then the elements included in the j-th candidate data are compared with the data to be processed in turn. If an element identical to the data to be processed is found in the j-th candidate data, then it is determined that the j-th candidate data includes an element identical to the data to be processed. If no element identical to the data to be processed is found in the j-th candidate data, then it is determined that the j-th candidate data does not include an element identical to the data to be processed.
5. The method as described in claim 1, characterized in that, The data type of the data to be processed is a second data type; the second data type refers to a data type that includes at least two elements; The method further includes: Iterate through the s candidate data in the data storage table; s is a positive integer. If the data to be processed is the same as the j-th candidate data, or the j-th candidate data includes the data to be processed, then the j-th candidate data is determined to be the first associated data that has the first inclusion relationship with the data to be processed; j is a positive integer less than or equal to s; If the data to be processed includes the j-th candidate data, then the j-th candidate data is determined to be second associated data that has the second inclusion relationship with the data to be processed.
6. The method as described in claim 5, characterized in that, The method further includes: If the data type of the j-th candidate data is the first data type, then it is determined that there is no inclusion relationship between the j-th candidate data and the data to be processed; the first data type refers to a data type that includes one element; If the data type of the j-th candidate data is the second data type, then obtain the component type of the j-th candidate data and the component type of the data to be processed; If the component type of the j-th candidate data is different from the component type of the data to be processed, then it is determined that there is no inclusion relationship between the j-th candidate data and the data to be processed.
7. The method as described in claim 6, characterized in that, The method further includes: If the component type of the j-th candidate data is the same as the component type of the data to be processed, then obtain the first element count of the elements included in the j-th candidate data and obtain the second element count of the elements included in the data to be processed. If the number of the first element is greater than or equal to the number of the second element, and there is a candidate subsequence in the j-th candidate data that is the same as the data to be processed, then the j-th candidate data is determined to include the data to be processed. If the number of the second element is greater than the number of the first element, and there is a processing sub-sequence in the data to be processed that is the same as the j-th candidate data, then it is determined that the data to be processed includes the j-th candidate data.
8. The method as described in claim 5, characterized in that, The method further includes: If the data type of the j-th candidate data is the first data type, then search for the element in the data to be processed that is the same as the j-th candidate data; If an element identical to the j-th candidate data is found in the data to be processed, then it is determined that the data to be processed includes the j-th candidate data. If no element identical to the j-th candidate data is found in the data to be processed, it is determined that there is no inclusion relationship between the j-th candidate data and the data to be processed.
9. The method as described in claim 1, characterized in that, Determining the storage address of the data to be processed based on the storage address of the first associated data includes: If the first associated data is the same as the data to be processed, then the storage address of the first associated data is determined as the storage address of the data to be processed.
10. The method as described in claim 1, characterized in that, The step of updating the storage address of the second associated data according to the storage address of the data to be processed includes: Obtain the associated position of the second associated data in the data to be processed, and determine the data associated address based on the associated position and the storage address of the data to be processed; Update the storage address of the second associated data to the data association address.
11. The method as described in claim 1, characterized in that, The method further includes: If no related data with an inclusion relationship to the data to be processed is found in the data storage table, the data to be processed is stored in the data storage table, and the storage address of the data to be processed is recorded.
12. The method as described in claim 1, characterized in that, The method further includes: In response to a processing request for a target service, execute the target service. If the target service includes the data to be processed, then the data to be processed is obtained from the data storage table based on the storage address of the data to be processed; The business data corresponding to the target business is generated based on the data to be processed.
13. A data storage device, characterized in that, The device includes: The data acquisition module is used to acquire the data to be processed. The address determination module is used to determine the storage address of the data to be processed based on the storage address of the first associated data if a first associated data with a first inclusion relationship is found in the data storage table; the first inclusion relationship refers to the relationship that the first associated data includes the data to be processed, and the first inclusion relationship indicates that the data volume of the first associated data is greater than or equal to the data volume of the data to be processed. The data storage module is used to store the data to be processed into the data storage table if a second associated data with a second inclusion relationship is found in the data storage table; The address update module is used to update the storage address of the second associated data according to the storage address of the data to be processed; The address deletion module is used to delete the second associated data in the data storage table; the second inclusion relationship refers to the relationship that the data to be processed contains the second associated data, and the second inclusion relationship indicates that the data volume of the data to be processed is greater than the data volume of the second associated data; The address determination module includes: The address generation unit is configured to, if the first associated data is different from the data to be processed, obtain the address offset of the data to be processed in the first associated data, and determine the storage address of the data to be processed based on the address offset and the storage address of the first associated data.
14. A computer device, characterized in that, Includes processor, memory, and input / output interfaces; The processor is connected to the memory and the input / output interface respectively, wherein the input / output interface is used to receive data and output data, the memory is used to store computer programs, and the processor is used to call the computer programs so that the computer device executes the method according to any one of claims 1-12.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted to be loaded and executed by a processor to cause a computer device having the processor to perform the method of any one of claims 1-12.
16. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the method described in any one of claims 1-12.
Citation Information
Patent Citations
Method for storing data block in memory device and memory device
CN104298614A
Reducing memory used by metadata for duplicate user defined types
US20060167900A1