Implementation method and equipment for optimizing packet vector hash table by using single instruction multiple data (SIMD) and readable medium

By splitting hash values ​​and optimizing the block vector hash table using SIMD instructions, the performance degradation problem of traditional hash tables under high load is solved, achieving more efficient memory access and space utilization.

CN120909503APending Publication Date: 2025-11-07BEIJING BAIGEFEICHI TECH LLC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510978110.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-16
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

Traditional hash table implementations suffer from problems such as discontinuous memory access, low efficiency in collision handling, and significant performance degradation under high load.

Method used

The implementation of the block vector hash table is optimized using Single Instruction Multiple Data (SIMD). By splitting the hash value into high-order and low-order parts, using control bytes to store slot status information, and utilizing SIMD instructions for parallel comparison, combined with an automatic expansion strategy controlled by load factor, the implementation method is optimized.

Benefits of technology

Significantly improves search performance, optimizes memory access patterns, reduces memory footprint, and increases space utilization, especially under high load conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120909503A_ABST
    Figure CN120909503A_ABST
Patent Text Reader

Abstract

The invention provides an implementation method for optimizing a packet vector hash table by using single instruction multiple data (SIMD), which is used for any key value pair, and comprises the following steps of: splitting a hash value, splitting the hash value of a current key into a low-order part and a high-order part, and setting a control byte to store the low-order part; a metadata array is designed, any key is grouped according to the initialization table capacity of the hash table, and information of each group is stored by using the control bytes; during operation, the control bytes in the group are compared in parallel by using an SIMD (Single Instruction Multiple Data) instruction, so that the optimization efficiency is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to an implementation method of optimizing group vector hash table using single instruction multiple data (SIMD). BACKGROUND

[0002] This section is intended to provide background information to facilitate a better understanding of embodiments of the present application recited in the claims. The description herein does not constitute admission of prior art.

[0003] In computer science, hash table is a data structure used for fast storage and lookup of key-value pairs. The implementation methods of traditional hash table, such as chaining hash method and open addressing method, have problems of non-continuous memory access, low conflict processing efficiency, and significant performance decline under high load.

[0004] Therefore, there is a need for a solution to solve the technical defects of the above-mentioned traditional hash table implementation methods and improve the lookup performance, memory access efficiency and space utilization. SUMMARY

[0005] Based on the above technical defects, the purpose of the present application is to provide an implementation method of optimizing group vector hash table using single instruction multiple data (SIMD) to solve the problems of non-continuous memory access, low conflict processing efficiency, and significant performance decline under high load in the prior art.

[0006] At the same time, the method of the present application is applicable to high-performance memory database systems, memory cache systems, distributed systems or real-time data processing systems.

[0007] The aspects of the present application provide an implementation method of optimizing group vector hash table using single instruction multiple data (SIMD) to improve the lookup performance, memory access efficiency and space utilization.

[0008] In one aspect of the present application, an implementation method of optimizing group vector hash table using single instruction multiple data (SIMD) is provided for key-value pairs, which includes: splitting hash value, splitting the hash value of the current key into low part and high part, and setting control byte to store the low part; designing metadata array, grouping any key according to hash table initialization table capacity, and using the control byte to store slot state information of each group; and in operation, using SIMD instruction to compare the control bytes in the group in parallel to realize optimization efficiency.

[0009] Further, the design of the metadata array also includes an initialization step: each group contains multiple slots, and the state information of the slots is set as occupied slot, empty slot or deleted slot.

[0010] Further, the design metadata array further comprises an initialization step of setting all control bytes as empty slot.

[0011] Further, the encoding rule of the control byte comprises: 0x00-0x7F represents an occupied slot; 0x80 represents an empty slot; and 0xFE represents a deleted slot.

[0012] Further, the group vector hash table comprises: a metadata array for storing control bytes; and a data array for storing key-value pairs; and the metadata array and the data array are stored separately.

[0013] Further, a group storage strategy is adopted, and the group size of the metadata array is 16 bytes, which is aligned with a 128-bit SIMD instruction set.

[0014] Further, when the hash value is 32 bits, the hash value is split into high 25 bits and low 7 bits, and the low 7 bits are used as control bytes; and when the hash value is 64 bits, the hash value is split into high 57 bits and low 7 bits, and the low 7 bits are used as control bytes.

[0015] Further, the write logic comprises: using SIMD to quickly screen positions with the same control bytes, and updating values.

[0016] Further, it is compared whether the position of each same control byte is the current key; if the position of the same control byte of the current group is the same key, the value is updated; if the position of the same control byte of the current group is not the same key, it is further screened whether the current group has an empty slot, (1) if the current group has an empty slot, the control byte of the empty slot is written into the control byte of the current key, and the key-value data is written into the corresponding data storage position; and (2) if the current group has no empty slot, the next group is continuously detected.

[0017] Further, the query logic comprises: the high part of the split hash value is used to locate the starting group of the current key storage, the high hash value is used to locate the starting group; a bit mask recording the matching position is generated by using the SIMD instruction_mm_cmpeq_epi8 instruction; and the keys of the matching position are traversed, and if the keys match, the value is returned, otherwise the next group is continuously detected or the query is terminated.

[0018] Further, the deletion logic comprises: if the current group has an empty slot, the deletion position is set as the empty slot; and if the current group has no empty slot, the deletion position is set as a tombstone marker.

[0019] Further, the method further comprises an automatic expansion step of triggering expansion when the number of elements reaches the product of the number of groups and the load factor.

[0020] Further, the method further comprises an automatic expansion step of triggering expansion when the number of continuously detected groups exceeds a threshold value.

[0021] In another aspect of the present application, an electronic device is provided, the device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the implementation method for using single instruction multiple data (SIMD) optimized grouping vector hash table as described above.

[0022] In another aspect of the present application, a computer readable storage medium is provided, which stores computer program instructions executable by a processor to implement the implementation method for using single instruction multiple data (SIMD) optimized grouping vector hash table.

[0023] In another aspect of the present application, a computer program product is provided, which comprises a computer program executable by a processor to implement the implementation method for using single instruction multiple data (SIMD) optimized grouping vector hash table.

[0024] The purpose of the present application is to provide an implementation method for using single instruction multiple data (SIMD) optimized grouping vector hash table to solve the problems of discontinuous memory access, low conflict processing efficiency, and significant performance decline under high load in the prior art. The present application has the following significant distinguishing features compared with the prior art: first, the innovative hash value splitting method (high 25 bits / low 7 bits); second, the special control byte encoding design (0x00-0x7F / 0x80 / 0xFE); third, the grouping detection mechanism combined with SIMD optimization; fourth, the automatic expansion strategy of the load factor control. The specific implementation mode of the present application includes: adopting the grouping strategy, performing batch detection on the whole group, and providing the premise of using SIMD instructions; using the SIMD instruction set to realize batch data comparison and improve the lookup efficiency; splitting the hash value of the key into two parts for query starting address positioning and metadata control byte, and optimizing the memory access mode. The present application achieves the following technical effects: first, significantly improving the lookup performance, especially under high load; second, improving the memory access mode and the cache efficiency; third, reducing the memory occupation and improving the space utilization. BRIEF DESCRIPTION OF DRAWINGS

[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiments or the prior art description will be briefly introduced as follows. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.

[0026] Other features, objects, and advantages of the application will become more apparent from the following detailed description when read in connection with the following drawings: Figure 1 A logic flow diagram illustrating an implementation method according to an embodiment of the present application; Figure 2 A 32-bit hash value splitting diagram according to the present application; Figure 3 A 64-bit hash value splitting diagram according to the present application Figure 4 A control byte encoding design diagram according to the present application; Figure 5 A SIMD optimized write logic flow diagram according to the present application; Figure 6 A SIMD optimized query logic flow diagram according to the present application; Figure 7 A structure diagram of an electronic device suitable for implementing the scheme according to an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the following will be combined with the accompanying drawings for the embodiments of the present application to clearly and completely describe the technical solutions of the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.

[0028] In a typical configuration of the present application, the devices of the terminal and the service network each include one or more processors, input / output interfaces, network interfaces and memories.

[0029] The memory can include non-permanent memory, random access memory and / or non-volatile memory in the form of computer readable medium, such as read-only memory or flash memory. The memory is an example of the computer readable medium.

[0030] The computer readable medium includes permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. The information can be computer program instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory, static random access memory, dynamic random access memory, other types of random access memory, read-only memory, electrically erasable programmable read-only memory, flash memory or other memory technology, read-only optical disc, digital versatile disc or other optical storage, magnetic cassette, magnetic tape disc storage or other magnetic storage device, or any other non-transmission medium that can be used to store information accessible by a computing device.

[0031] In actual scenarios, the execution subject of the method can be a user device, or a device integrated by a user device and a network device through a network, or an application program running on the above device, the user device including but not limited to computers, mobile phones, tablets, smart watches, bracelets and various terminal devices, and the network device including but not limited to network hosts, single network servers, multiple network server sets or computer sets based on cloud computing, which can be used to implement part of the processing functions when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing, wherein the cloud computing is a kind of distributed computing, and a virtual computer composed of a group of loosely coupled computer sets.

[0032] Embodiment one

[0033] The application provides an implementation method of optimizing a grouped vector hash table using single instruction multiple data (SIMD) for key-value pairs. The following will be described in conjunction with the specific implementation method of the application and the core components of the technical solution of the application: Step S100, split the hash value, split the hash value of the current key into a low part and a high part, and set the control byte to contain the low bit information of the hash value. One of the core components of the technical solution of the application is a hash value splitting method.

[0034] Specifically, the hash value is split into high / low two parts. If a 32-bit hash value is used, it is split into high 25 bits and low 7 bits. If a 64-bit hash value is used, it is split into 57 bits and 7 bits as shown in Figure 2 .

[0035] Further, because 7 bits only need 1 byte to store, the byte corresponding to 7 bits is called a control byte. Then 25 bits are stored using uint32 to locate the starting group of the current key storage.

[0036] For example, the hash value of a certain key (key) is 2324567033, the binary representation is 0b1000_1010_1011_1001_1101_0101_1111_1001, which is split into 0b1000_1010_1011_1001_1101_0101_1 and 0b111_1001, the front zero is filled to 0b0000_0001_0001_0101_0111_0011_1010_1011 and 0b0000_0000_0000_0000_0000_0000_0111_1001.

[0037] The specific algorithm is as follows: h1Mask32 uint32 = 0xffff_ff80 h2Mask32 uint32 = 0x0000_007f h1 = (hash & h1Mask32) >> 7 h2 = h & h2Mask32 In step S200, a metadata array is designed, any key is grouped according to the table capacity initialized by the hash table, and the information of each group is stored using the control byte.

[0038] The core component of the technical solution of the application corresponds to the second, grouping according to the table capacity initialized by the hash table.

[0039] Further, the grouping vector hash table comprises: a metadata array for storing control bytes; and a data array for storing key-value pairs; the metadata array and the data array are stored separately.

[0040] Further, a grouping storage strategy is adopted, and the grouping size of the metadata array is 16 bytes, which is aligned with the 128-bit SIMD instruction set.

[0041] Because 7-bit data is used as the control byte for comparison, plus one sign bit, a total of 8 bits, in order to better utilize the 128-bit SIMD parallel operation, 16 control bytes are taken as a group for batch comparison. Assuming that the initial capacity is 1000, and each group has 16 elements, a total of 1000 / 16 is rounded up to 63 groups.

[0042] The specific algorithm is as follows: __m128i ctrl = _mm_load_si128((__m128i )group); __m128i match = _mm_cmpeq_epi8(ctrl, target); int mask = _mm_movemask_epi8(match); Third, the load factor.

[0043] Further, the method further comprises an automatic expansion step: triggering expansion when the number of consecutive probe groups exceeds a threshold.

[0044] In order to avoid the control byte being full, resulting in the probe being degraded to full comparison, it is necessary to reduce the load, and only 14 elements are stored in each group of 16 slots (here, 14 can be 12, 13 or 15, and 14 is the best value obtained by balancing the space utilization rate and the probe degradation rate), and the maximum number of stored elements in each group is referred to as the load factor.

[0045] Group number adjustment. The number of groups in each group is adjusted correspondingly due to the reduction of the load (grouping according to the table capacity initialized by the hash table). Group number = round up (initial capacity / load factor).

[0046] Fourthly, the metadata array design.

[0047] Further, the design metadata array, further comprising the initialization step: each group contains a plurality of slots, the state information of the slot is set to occupied slot, empty slot or deleted slot.

[0048] As shown in Figure 3 The design metadata array, further comprising the initialization step: setting all control bytes to empty slot. The encoding rules of the control byte include: 0x00-0x7F represents occupied slot; 0x80 represents empty slot; 0xFE represents deleted slot.

[0049] Specifically, the state information of each slot is stored using a control byte. The control byte contains the low bit information of the hash value.

[0050] Specifically, a grouping storage strategy is adopted, and each group has a fixed size.

[0051] Specifically, the control byte encoding design: 0x00-0x7F: occupied (specific control byte, store the low 7 bits of the hash value). 0x80 (0b1000_0000): empty slot. 0xFE (0b1111_1110): deleted (tombstone), and the tombstone code here can be any number in 0x81-0xFF.

[0052] Specifically, the group size is fixed at 16 bytes, which is aligned with the SIMD instruction set.

[0053] Step S300, execute operation.

[0054] In the query or write or delete operation, the control byte in any group is compared in parallel by using the SIMD instruction, and the optimization lookup and write efficiency are realized.

[0055] The write logic includes: using SIMD to quickly filter the same control byte position, and updating the value. Further, it is compared whether the position of each same control byte is the current key; if the position of the same control byte in the current group is the same key, the value is updated; if the position of the same control byte in the current group is not the same key, it is further filtered whether the current group has an empty slot, (1) if the current group has an empty slot, the empty slot control byte is written into the control byte of the current key, and the corresponding data storage position is written into the key value data; (2) if the current group has no empty slot, the next group is continued to be detected.

[0056] Specifically, as shown in Figure 4The same position of the control byte is first screened by SIMD. If the position of each same byte is the current key, the value is updated. If the same key is not found in the current group of the same control byte position, the empty slot (0x80) is detected by SIMD based on the metadata array and the empty slot. If the empty slot is found, the empty slot control byte is written to the control byte of the current key, and the key value data is written to the corresponding data storage position.

[0057] The query logic includes: the high bit part of the split hash value is used to locate the starting group of the current key storage, the high bit hash value is used to locate the starting group, the bit mask is generated by using the SIMD instruction to compare the control byte in parallel, and the matching position is recorded; the keys of the matching position are traversed, and if the keys are matched, the value is returned, otherwise the next group is continued to be detected or the query is terminated.

[0058] Specifically, as Figure 5 shown, the bit mask technology is used to quickly locate the matching position, and the keys of the same position of the mask bit are traversed to determine whether they are the same as the query key. If they are the same, the corresponding value is returned. If the same key is not found in the current group of the same control byte position, the empty slot is detected by SIMD based on the metadata array and the empty slot (0x80). If the empty slot is found, the data corresponding to the current key does not exist. If the empty slot is not found, the next group is continued to be detected, and the above steps are repeated until the same key or the empty slot is found.

[0059] The deletion logic includes: if the current group has an empty slot, the deletion position is set to the empty slot; if the current group does not have an empty slot, the deletion position is set to the tombstone marker.

[0060] Specifically, it is judged whether the current group has an empty slot. If it has, the deletion position is set to the empty slot for position reuse. If the current group does not have an empty slot, the deletion position is set to the tombstone marker (0xFE) instead of physical deletion, and the empty slot is not set. This is to ensure that the number of hash collisions is located in the current group, but when the current group is not found, the next group is continued to be searched. When rehash is triggered, the tombstone marker is cleaned up.

[0061] Fifth, automatic expansion.

[0062] Further, the method further includes an automatic expansion step: when the number of elements reaches the number of groups multiplied by the load factor, expansion is triggered.

[0063] Specifically, when writing data, if the number of current elements reaches the number of groups times the load factor, expansion is triggered.

[0064] Sixth, key value data storage.

[0065] Further, the method further comprises a key-value data storage step: the key-value data storage adopts a grouping slotting manner, and is aligned with the grouping of the control bytes.

[0066] According to the data structure example of the metadata array, a template is used, so that the hash table of the application supports a wider range of data types.

[0067] The specific code is as follows: type KV[K comparable, V any] struct { Key K / / Any data type that can be compared Value V / / Any data type } The key-value data is grouped and slotted according to the grouping manner of the control bytes, and is stored in specific slot positions positioned by the control bytes. When searching, the control bytes are used to detect specific groups and slot positions, and the corresponding key-value data is obtained. When the keys are the same, the value content is returned.

[0068] The overall example of the hash structure (golang) is as follows: type ctrlGroup

[16] byte / / You can also use

[16] int8 as the control field type dataGroup[K comparable, V any]

[16] KV[K, V] type KV[K comparable, V any] struct { Key K / / Any data type that can be compared Value V / / Any data type } type VectorHash[K comparable, V any] struct { ctrls []ctrlGroup data []dataGroup[K, V] The present application has the following significant distinguishing features compared with the prior art: first, the innovative hash value splitting method (high 25 bits / low 7 bits); second, the special control byte coding design (0x00-0x7F / 0x80 / 0xFE); third, the grouping detection mechanism combined with the SIMD optimization; fourth, the automatic expansion strategy of the load factor control.

[0069] The specific implementation of the present application comprises: adopting a grouping strategy, performing batch detection in a group, and providing a use premise of a SIMD instruction; utilizing a SIMD instruction set to implement batch data comparison and improve search efficiency; splitting the hash value of a key into two parts for query start address positioning and metadata control bytes, and optimizing memory access mode. The present application achieves the following technical effects: first, significantly improves search performance, especially under high load conditions; second, improves memory access mode and improves cache efficiency; third, reduces memory occupation and improves space utilization. For example: performance improvement. The search operation performance is improved by 30-50%. The performance decay is smaller under high load conditions. Memory access efficiency is significantly improved. Resource utilization; memory occupation is reduced by 20-30%; cache hit rate is improved by 40-60%; space utilization is improved by 15-25%.

[0070] Embodiment two

[0071] Based on the same inventive concept, the electronic device provided in the embodiments of the present application corresponds to the method of optimizing the grouped vector hash table using single instruction multiple data (SIMD), and the problem solving principle is similar to the method. The electronic device provided in the embodiments of the present application comprises at least one processor, and a memory in communication connection with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method and / or technical solution of the plurality of embodiments of the present application.

[0072] The electronic device can be a user device, or a device integrated by a user device and a network device through a network, or also can be an application program running on the above-mentioned device, the user device includes but is not limited to computers, mobile phones, tablet computers, smart watches, wristbands and various terminal devices, and the network device includes but is not limited to network hosts, single network servers, multiple network server sets or computer sets based on cloud computing, which can be used to realize part of the processing function when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing.

[0073] Figure 7The structure of an electronic device suitable for implementing the method and / or technical solution in the embodiments of the present application is shown. The device 700 includes a central processing unit 701, which can perform various appropriate actions and processes according to programs stored in a read-only memory 702 or loaded into a random access memory 703 from a storage section 708. Various programs and data required for system operation are also stored in the random access memory 703. The central processing unit 701, the read-only memory 702, and the random access memory 703 are connected to each other through a bus 704. An input / output (I / O, Input / Output) interface 705 is also connected to the bus 704.

[0074] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, a touch screen, a microphone, an infrared sensor, and the like; an output section 707 including a cathode ray tube, a liquid crystal display, an LED display, an OLED display, and the like, and a speaker, and the like; a storage section 708 including one or more computer readable media such as a hard disk, an optical disk, a magnetic disk, a semiconductor memory, and the like; and a communication section 709 including a network interface card such as a local area network card, a modem, and the like. The communication section 709 performs communication processing via a network such as the Internet.

[0075] In particular, the method and / or embodiment in the embodiments of the present application can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product including a computer program carried on a computer readable medium, the computer program including program code for executing the method shown in the flowchart. When the computer program is executed by the central processing unit 701, the above-mentioned functions defined in the method of the present application are performed.

[0076] Embodiment Three

[0077] Another embodiment of the present application also provides a computer readable storage medium having stored thereon computer program instructions, which can be executed by a processor to implement the method and / or technical solution of any one or more embodiments of the present application.

[0078] Specifically, this embodiment may employ any combination of one or more computer-readable media. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical fiber, a portable compact disk read-only memory, an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.

[0079] The program code contained on a computer-readable medium may be transmitted using any suitable medium, including—but not limited to—wireless, wire, optical fiber, radio frequency, etc., or any suitable combination thereof.

[0080] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including local area networks (LANs) or wide area networks (WANs), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0081] The flow diagrams and block diagrams in the drawings are presented to illustrate the architecture, functionality, and operation of possible implementations of devices, methods and computer program products according to various embodiments disclosed. In this regard, each block in the flow diagrams and block diagrams can represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks can sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flow diagrams, and combinations thereof, can be implemented by special purpose hardware-based systems that perform the specified functions or operations, or combinations of special purpose hardware and

[0082] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiments, which will not be described here.

[0083] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the device embodiments described above are merely schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or page components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0084] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0085] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of hardware plus software functional unit.

[0086] Finally, it should be noted that the above examples are only used to illustrate the technical solutions of the present application, and are not intended to limit the same; although the present application has been described in detail with reference to the foregoing examples, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing examples, or make equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

[0087] Furthermore, the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. Multiple units or devices also can be presented by a single unit or device, for example, by software or hardware. The terms first, second, etc. are used to distinguish names, not to show any particular order.

Claims

1. An implementation method of optimizing a grouped vector hash table using single instruction multiple data (SIMD), for key-value pairs, the method comprising: splitting a hash value, splitting a hash value of a current key into a low part and a high part, setting a control byte to store the low part; designing a metadata array, grouping any key according to a hash table initialization table capacity, and storing information of each group using the control byte; in operation, achieving optimization efficiency by using SIMD instructions to compare control bytes within a group in parallel.

2. The method of claim 1, wherein the designing a metadata array further comprises an initialization step: each group contains multiple slots, setting state information of the slots as occupied slots, empty slots, or deleted slots; and setting all control bytes as empty slots.

3. The method of claim 2, the encoding rules of the control bytes comprising: 0x00-0x7F represents an occupied slot; 0x80 represents an empty slot; 0xFE represents a deleted slot.

4. The method of claim 1, adopting a grouping storage strategy, a grouping size of the metadata array is 16 bytes, aligned with a 128-bit SIMD instruction set.

5. The method of claim 3, the write logic comprising: By using SIMD, quickly screen the same control byte positions and update the values.

6. The method of claim 3, wherein the query logic comprises: the high part of the split hash value is used to locate the starting group where the current key is stored, and the high hash value is used to locate the starting group; using the SIMD instruction mm_cmpeq_epi8 instruction to generate a bit mask to record the matching positions, and comparing the control bytes in parallel; traversing the keys of the matching positions, if matching, return the value, otherwise continue to detect the next group or terminate the query.

7. The method of claim 3, the deletion logic comprising: If the current group has an empty slot, set the deleted position as an empty slot; If the current group has no empty slot, set the deleted position as a tombstone marker.

8. The method of claim 1, further comprising an automatic expansion step: triggering expansion when the number of consecutive groups detected exceeds a threshold.

9. An electronic device, comprising: at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 8.

10. A computer readable medium having stored thereon computer program instructions executable by a processor to implement the method of any one of claims 1 to 8.

11. A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1 to 8.