A data processing method and device, computer equipment, medium and product

CN122963549APending Publication Date: 2026-10-23TENCENT CLOUD COMPUTING (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510429092.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-07
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

[0003]然而,发明人在实践中发现,在计算机设备当前所接收到的函数为轻量函数时,若在编译时直接采用JIT编译对该函数所关联的所有函数进行全量预编译,则需要消耗较长的编译时间长,且会因为需要存储全量预编译所得到的编译结果而存在系统资源占用较高的现象

Benefits of technology

[0022]本申请实施例中,获取源代码数据中的任务处理函数的函数复杂度。若函数复杂度达到分层编译策略所指示的复杂度阈值,则将针对任务处理函数的编译方式确定为分层编译策略所指示的第一编译方式。根据第一编译方式对任务处理函数进行编译处理,得到第一类编译结果。可以根据函数复杂度灵活选择编译方式。将针对任务处理函数所使用的第一编译方式所对应的第一执行模式确定为主执行模式,并将分层编译策略中的第二编译方式所对应的第二执行模式确定为主执行模式的从执行模式。获取使用主执行模式执行第一类编译结果中的可执行代码所得到的第一执行时间,并获取使用从执行模式执行第二类编译结果中的数据结构体所得到的第二执行时间;数据结构体是根据第二编译方式对任务处理函数进行编译处理所得到的;主执行模式的执行次数大于从执行模式的执行次数;若第一执行时间和第二执行时间之间的时间差异数据达到执行模式切换条件,则将第二执行模式更新为主执行模式,并将第一执行模式更新为从执行模式。在调用任务处理函数获取对应的任务处理结果的过程中,将执行模式分成主执行模式和从执行模式,根据执行过程中的执行性能数据(具体是执行时间)动态切换执行模式,从而升执行效率,并节省资源。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122963549A_ABST
    Figure CN122963549A_ABST
Patent Text Reader

Abstract

The application discloses a data processing method and device, computer equipment, medium and product. The method comprises the following steps: acquiring function complexity of a task processing function in source code data. If the function complexity reaches a complexity threshold, the task processing function is compiled according to a first compilation mode. A first execution mode corresponding to the first compilation mode is determined as a main execution mode, and a second execution mode corresponding to a second compilation mode is determined as a slave execution mode. A first execution time of executing a first type of compilation result by using the main execution mode is acquired, and a second execution time of executing a second type of compilation result by using the slave execution mode is acquired. If time difference data between the first execution time and the second execution time reaches an execution mode switching condition, the second execution mode is updated as the main execution mode, and the first execution mode is updated as the slave execution mode. According to the method, the execution mode can be dynamically switched according to the execution time, the execution efficiency is improved, and resources are saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, specifically to a data processing method, a data processing device, a computer equipment, a computer-readable storage medium, and a computer program product. Background Technology

[0002] Currently, when a computer receives a function related to business processing, if a single compilation method (e.g., Just-In-Time Compilation, or JII compilation) is used during the compilation phase to compile the code data of the function, then in the subsequent business processing of the function, the execution mode corresponding to that single compilation method (e.g., JIT execution mode) needs to be directly adopted to process the function.

[0003] However, the inventors discovered in practice that when the function received by the computer is a lightweight function, directly using JIT compilation to perform full pre-compilation of all functions associated with that function during compilation consumes a long compilation time and results in high system resource consumption due to the need to store the compilation results obtained from full pre-compilation. Therefore, how to select an appropriate compilation method and execution mode for the currently acquired function, while reducing system resource consumption and improving function execution efficiency, has become an urgent technical problem to be solved. Summary of the Invention

[0004] This application provides a data processing method, apparatus, computer equipment, medium, and product. In the process of calling the task processing function to obtain the corresponding task processing result, the execution mode can be dynamically switched according to the execution time to improve execution efficiency and reduce unnecessary overhead.

[0005] One embodiment of this application discloses a data processing method, the method comprising:

[0006] Obtain the function complexity of the task processing function in the source code data;

[0007] If the complexity of the function reaches the complexity threshold indicated by the tiered compilation strategy, then the compilation method for the task processing function will be determined as the first compilation method indicated by the tiered compilation strategy.

[0008] The task processing function is compiled according to the first compilation method to obtain the first type of compilation result;

[0009] The first execution mode corresponding to the first compilation method used by the task processing function is determined as the main execution mode, and the second execution mode corresponding to the second compilation method in the layered compilation strategy is determined as the secondary execution mode of the main execution mode;

[0010] The execution time is obtained by executing the executable code in the first type of compilation result using the main execution mode, and the execution time is obtained by executing the data structure in the second type of compilation result using the slave execution mode; the data structure is obtained by compiling the task processing function according to the second compilation method; the number of executions in the main execution mode is greater than the number of executions in the slave execution mode;

[0011] If the time difference between the first execution time and the second execution time reaches the execution mode switching condition, then the second execution mode is updated to the primary execution mode, and the first execution mode is updated to the secondary execution mode.

[0012] One embodiment of this application discloses a data processing apparatus, which includes:

[0013] The acquisition module is used to obtain the function complexity of the task processing function in the source code data;

[0014] The determination module is used to determine the compilation method for the task processing function as the first compilation method indicated by the tiered compilation strategy if the complexity of the function reaches the complexity threshold indicated by the tiered compilation strategy.

[0015] The processing module is used to compile the task processing function according to the first compilation method to obtain a first type of compilation result;

[0016] The determining module is further configured to determine the first execution mode corresponding to the first compilation method used for the task processing function as the main execution mode, and to determine the second execution mode corresponding to the second compilation method in the layered compilation strategy as the secondary execution mode of the main execution mode;

[0017] The acquisition module is further configured to acquire a first execution time obtained by executing the executable code in the first type of compilation result using the main execution mode, and to acquire a second execution time obtained by executing the data structure in the second type of compilation result using the slave execution mode; the data structure is obtained by compiling the task processing function according to the second compilation method; the number of executions in the main execution mode is greater than the number of executions in the slave execution mode;

[0018] The update module is configured to update the second execution mode to the primary execution mode and the first execution mode to the secondary execution mode if the time difference data between the first execution time and the second execution time reaches the execution mode switching condition.

[0019] One aspect of this application discloses a computer device, which includes a processor adapted to implement one or more computer programs; and a computer-readable storage medium storing one or more computer programs adapted to be loaded by the processor and executed in accordance with the above-described data processing method.

[0020] One aspect of this application discloses a computer-readable storage medium storing one or more computer programs adapted to be loaded by a processor and executed by the above-described data processing method.

[0021] One embodiment of this application discloses a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the aforementioned data processing method.

[0022] In this embodiment, the function complexity of the task processing function in the source code data is obtained. If the function complexity reaches the complexity threshold indicated by the tiered compilation strategy, the compilation method for the task processing function is determined to be the first compilation method indicated by the tiered compilation strategy. The task processing function is compiled according to the first compilation method to obtain a first type of compilation result. The compilation method can be flexibly selected according to the function complexity. The first execution mode corresponding to the first compilation method used for the task processing function is determined as the main execution mode, and the second execution mode corresponding to the second compilation method in the tiered compilation strategy is determined as the secondary execution mode of the main execution mode. The first execution time obtained by executing the executable code in the first type of compilation result using the main execution mode is obtained, and the second execution time obtained by executing the data structure in the second type of compilation result using the secondary execution mode is obtained; the data structure is obtained by compiling the task processing function according to the second compilation method; the number of executions in the main execution mode is greater than the number of executions in the secondary execution mode; if the time difference between the first execution time and the second execution time reaches the execution mode switching condition, the second execution mode is updated to the main execution mode, and the first execution mode is updated to the secondary execution mode. During the process of calling the task processing function to obtain the corresponding task processing result, the execution mode is divided into main execution mode and slave execution mode. The execution mode is dynamically switched according to the execution performance data (specifically the execution time) during the execution process, thereby improving execution efficiency and saving resources. Attached Figure Description

[0023] 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.

[0024] Figure 1 This is a schematic diagram of the network architecture of a data processing system disclosed in an embodiment of this application;

[0025] Figure 2 This is a schematic diagram of the network architecture of another data processing system disclosed in an embodiment of this application;

[0026] Figure 3 This is a flowchart illustrating a data processing method disclosed in an embodiment of this application;

[0027] Figure 4 This is a schematic diagram of a function call relationship disclosed in an embodiment of this application;

[0028] Figure 5 This is a schematic diagram of an execution process disclosed in an embodiment of this application;

[0029] Figure 6 This is a flowchart illustrating another data processing method disclosed in an embodiment of this application;

[0030] Figure 7 This is a schematic diagram of the flow framework of a data processing method disclosed in an embodiment of this application;

[0031] Figure 8 This is a schematic diagram of a compilation and execution process disclosed in an embodiment of this application;

[0032] Figure 9 This is a schematic diagram of the structure of a data processing device disclosed in an embodiment of this application;

[0033] Figure 10 This is a schematic diagram of the structure of a computer device disclosed in an embodiment of this application. Detailed Implementation

[0034] 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 skilled in the art without creative effort are within the scope of protection of this application.

[0035] Before describing the embodiments of this application, the relevant terms involved in the embodiments of this application will be explained first:

[0036] I. Database: A database is a collection of related data stored in a computer system to facilitate the management, processing, and access of this data. Databases can be categorized into relational databases and non-relational databases.

[0037] A relational database is a database that uses a relational model to organize data. It stores data in rows and columns for easy user understanding. These rows and columns are called tables, and a group of tables constitutes a database. Users retrieve data from the database through queries, which are executable codes used to limit access to specific areas within the database. This application primarily relates to relational databases, which may include: Oracle databases, MySQL databases, SQL Server databases, DB2 databases, PostgreSQL databases, etc.

[0038] No relational databases are databases that do not require a fixed table structure, allow the addition of new fields and data types at runtime, are suitable for storing large amounts of unstructured and semi-structured data, and support horizontal scaling and distributed systems. No relational databases can include the following types: key-value databases, document-oriented databases, column-oriented databases, and graph databases.

[0039] For example, in the embodiments of this application, the database may be TDSQLPG (TDSQL for PostgreSQL), a distributed database system that integrates high scalability, high compatibility with SQL, complete distributed transaction support, multi-level disaster recovery and multi-dimensional resource isolation, etc. It adopts a shared-nothing cluster architecture and provides a complete set of solutions for disaster recovery, backup, recovery, security and auditing.

[0040] Databases can be widely used in the following business scenarios:

[0041] Enterprise Resource Planning (ERP) business scenario: Databases can be used to store and manage various resource information of an enterprise, including raw material procurement, production plans, inventory management, sales orders, customer information, etc. Through databases, enterprises can achieve data integration and sharing across various business processes, improve operational efficiency, optimize resource allocation, and help enterprises comprehensively manage their core business processes. If the embodiments of this application are applied to this scenario, for example, enterprise managers can call task processing functions for inventory management, and use the database to compile and execute these functions to obtain the corresponding inventory management results.

[0042] Customer Relationship Management (CRM) business scenario: The database stores customer basic information, purchase history, communication records, complaint feedback, and other data, primarily used to manage the relationship between the enterprise and its customers. Enterprises can analyze this data through the database to better understand customer needs, provide personalized services, and improve customer satisfaction and loyalty. If this application's embodiment is applied to this scenario, for example, enterprise managers can call a task processing function for a customer's purchase history, use the database to compile and execute the task processing function for that customer's purchase history, obtain the customer's purchase history results, and thus provide more accurate purchasing services to customers.

[0043] In e-commerce business scenarios, the database stores a large amount of data, including product information, user information, and transaction records. It supports various online shopping functions, such as product display, inventory management, order processing, and user reviews, ensuring stable platform operation and efficient service. If this embodiment of the application is applied to this scenario, for example, the platform administrator can call the task processing function for inventory management, and use the database to compile and execute the task processing function for inventory management to obtain the inventory management results, thereby enabling the platform administrator to manage the inventory.

[0044] Financial Industry Business Scenario: In this scenario, financial institutions such as banks, securities firms, and insurance companies need to process large amounts of transaction data and customer information. Specifically, databases can be used to store customer information, transaction records, wealth management product information, customer credit records, etc. If the embodiments of this application are applied to this scenario, for example, a bank's product department administrator can call the task processing function for wealth management product information, use the database to compile and execute the task processing function for wealth management product information, obtain the sales data of wealth management products, and then develop new wealth management products or recommend similar products based on the sales data to improve the bank's revenue.

[0045] In a medical business scenario, the database is primarily used to store patients' historical disease diagnosis results, examination reports, medical orders, medication information, and other medical data. If this embodiment of the application is applied to this scenario, for example, a doctor can call a task processing function for the patient's historical disease diagnosis results. The database then compiles and executes this task processing function to quickly obtain the patient's historical diagnosis results, assisting the doctor in rapid diagnosis and efficient determination of treatment plans.

[0046] In online education scenarios, schools and educational institutions can utilize databases to manage student information, course information, grade information, teaching resources, and more. If this embodiment of the application is applied to this scenario, for example, the school's academic affairs office can call a task processing function for course information, compile and execute the function using the database, and quickly obtain course information for each teacher. This facilitates course setup and adjustment, improving data support for teaching and academic affairs.

[0047] In logistics and supply chain business scenarios, databases can record information on the transportation, warehousing, and distribution of goods, including cargo information, transport vehicle information, delivery routes, and inventory levels. If this application's embodiment is applied to this scenario, for example, logistics managers can call task processing functions for cargo information, transport vehicle information, delivery routes, etc., and use the database to compile and execute these task processing functions, enabling real-time tracking and management of logistics information and improving supply chain efficiency and transparency.

[0048] Functional agency business scenario: Functional agencies include, but are not limited to, tax statistics agencies, security management agencies, and credit management agencies. In this scenario, the database is mainly used to store social security information, tax information, etc. If the embodiments of this application are applied to this scenario, for example, tax management personnel can call the task processing function for tax payment status, use the database to compile and execute the task processing function for tax payment status, determine the tax payment status, and then send reminder information to those who have not paid, so as to achieve efficient management of tax payment.

[0049] Internet of Things (IoT) Business Scenarios: With the development of IoT technology, a large number of devices and sensors will generate massive amounts of data. In IoT scenarios, databases can be used to store and manage this IoT data, enabling functions such as device status monitoring, data analysis, and predictive maintenance. Examples include environmental monitoring systems in smart cities and device management systems in industrial IoT. If the embodiments of this application are applied to an environmental monitoring system in a smart city, the task processing functions for environmental indicators can be called, and the database can be used to compile and execute the task processing functions for environmental indicators to determine environmental indicators over a period of time, thereby enabling environmental optimization measures such as expanding green areas.

[0050] Data analysis and data mining business scenarios: Databases are the foundation of data analysis and data mining, storing vast amounts of historical and business data. By analyzing and mining this data, potential business value, market trends, and object behavior patterns can be discovered, providing support for enterprise decision-making. If this application's embodiment is applied to a market research company, the company can utilize the data analysis task processing functions in the database to perform data analysis, providing market insights and marketing strategy recommendations to enterprises.

[0051] II. Source Code Data: This refers to the original code (i.e., source code) written in programming languages ​​(such as Python, Java, C++, etc.) as the data object, used for analysis, processing, or research. It can be a single file, a project codebase, or structured code information, typically containing elements such as program logic, algorithms, variables, and functions. It can also be understood as structured information centered on code, and has wide applications in software development, AI training, academic research, and other fields.

[0052] III. Task Processing Functions: Functions are high-level abstractions of code, improving readability, maintainability, and extensibility through encapsulation, reuse, and modularization. Source code data can include multiple task processing functions. Each task processing function can implement a specific task. For example, the task of "calculating employee bonuses" can be implemented using a corresponding task processing function. Specifically, a task processing function can refer to a PL function (a PL function is a subroutine in PL / SQL (Procedural Language / SQL) used to perform a specific task and return a value).

[0053] In this embodiment of the application, a business object (e.g., a code developer) can write a corresponding task processing function (e.g., a tax statistics function) for a specific task (e.g., a tax statistics task). At this time, the source code written by the code developer for the task processing function (e.g., the tax statistics function) is the aforementioned source code data. This means that the computer device can encapsulate the currently written source code data into a task processing function (e.g., a tax statistics function) to submit the task processing function (e.g., the tax statistics function) to a distributed database associated with the tax business scenario, so that tax personnel in the subsequent tax system can obtain the task processing function (e.g., the tax statistics function) from the distributed database to perform tax statistics.

[0054] For example, a business object (e.g., a code developer) can write a corresponding task processing function (e.g., a patient's history of illness) for a specific task (e.g., a patient's history of illness function). In this case, the source code written by the code developer for the task processing function (e.g., the patient's history of illness function) is the aforementioned source code data. This means that the computer device can encapsulate the currently written source code data into a task processing function (e.g., a patient's history of illness function) and submit the task processing function (e.g., a patient's history of illness function) to a distributed database associated with the medical business scenario, so that medical personnel in the subsequent medical system can obtain the task processing function (e.g., the patient's history of illness function) from the distributed database for disease statistics.

[0055] IV. Tiered Compilation Strategy: This refers to employing different compilation strategies under varying conditions. Specifically, it could mean using the first compilation method when the set conditions are met, and the second compilation method when the conditions are not met. Compilation is the process of converting source code written in a high-level language into machine language code that the target machine can directly execute. After compilation, a standalone executable file is generated, which can be run directly on the target machine.

[0056] The compilation method of a task processing function can be determined based on its complexity. In this embodiment, the layered compilation strategy indicates two compilation methods: interpreted compilation and JIT (Just-In-Time Compilation) compilation. Interpreted compilation involves the compiler parsing the functions in the source code data line by line to generate the corresponding data structure. JIT compilation is a special case of dynamic compilation, often equivalent to it. JIT compilation refers to the process of converting intermediate language (e.g., Microsoft Intermediate Language (MSIL)) into machine code at runtime. Unlike traditional static compilation, JIT compilation dynamically compiles code into machine language as needed at runtime, thus improving program flexibility and execution efficiency.

[0057] Different compilation methods correspond to different execution modes. In this embodiment, the execution modes include JIT execution mode and interpreted execution mode. JIT execution mode corresponds to JIT compilation, where the executor directly executes the machine code obtained from JIT compilation. Interpreted execution mode also corresponds to interpreted compilation, where the executor executes the data structures obtained from interpreted compilation. The efficiency of execution differs depending on the execution mode. Interpreted execution mode is relatively inefficient because it executes line by line, making it suitable for functions with low complexity. JIT execution mode, on the other hand, directly reads and executes the executable code, avoiding the looping process in line-by-line execution, resulting in higher efficiency and making it suitable for functions with higher complexity.

[0058] V. Adaptive Polling Algorithm: A decision-making mechanism for dynamically selecting the execution mode (such as JIT execution or interpreted execution), adjusting system behavior based on real-time performance indicators to optimize resource utilization and execution efficiency. In the embodiments of this application, polling is mainly implemented based on a counter. For example, after executing N times in the main execution mode, the secondary execution mode is executed M times, where N is greater than M. Specifically, it could be that the main execution mode is executed 100 times, and then the secondary execution mode is executed once.

[0059] VI. LLVM (Low Level Virtual Machine) Compiler Framework: This is a modular, reusable compiler infrastructure project widely used in the field of compiler technology. It is used to translate high-level language code into machine code, supporting multi-stage optimization and cross-platform compatibility. The LLVM compiler framework processing flow includes: front-end processing, optimization stage, and back-end generation. Front-end processing involves different front-end compilers (such as Clang) parsing the source code data into a syntax tree structure (AST), and then converting the AST into LLVM IR (intermediate code). The optimization stage involves the optimizer performing a series of optimization operations on the generated LLVM IR to improve code quality and execution efficiency. Back-end generation converts the optimized IR into assembly code or machine code for the target machine, ultimately generating an executable file.

[0060] For example, there exists a loop, with the following code:

[0061] The loop iterates 1000 times:

[0062] a:=1+1;

[0063] a:=1+2;

[0064] a:=4*1;

[0065] b: = 1 + 2 + a + (3 + 3) * 5;

[0066] end loop;

[0067] The above loop exists within a customer's stored procedure. In PLpg / SQL, the original execution flow and the current execution flow optimized using LLVM can be shown in Table 1 below:

[0068] Table 1

[0069]

[0070]

[0071] As shown in Table 1, the original process assigns values ​​sequentially in a loop. However, with JIT execution (i.e., the LLVM optimized process), the loop statements are significantly simplified due to LLVM optimization. Specifically, the original process's statements "Calculate the value of expression 1+1 to 2 using the SQL engine; assign the value of a to 2; calculate the value of expression 1+2 to 3 using the SQL engine; assign the value of a to 3; calculate the value of expression 4*1 to 4 using the SQL engine" are reduced. Therefore, using JIT execution improves execution efficiency.

[0072] VII. Function Complexity Evaluation Mechanism: Primarily used to measure the complexity of functions, helping developers understand the maintainability, readability, and performance of their code. Dynamic evaluation can be performed using quantitative metrics (instruction complexity, global variable complexity, function call relationship complexity, etc.).

[0073] 8. Dual Cache Mechanism: This is a widely used technique in the computer field that improves performance by using two buffers (usually memory regions). The core advantage of the dual cache mechanism lies in performance improvement. By rationally allocating and using two buffers, tasks such as data processing can be performed in parallel or sequentially, thereby optimizing the overall system performance. In this embodiment, since a first compilation method and a second compilation method are involved, a dual cache mechanism is used to store the first type of compilation results corresponding to the first compilation method and the second type of compilation results corresponding to the second compilation method in different buffers. For example, one buffer can be used to cache the machine code generated by JIT compilation, and another buffer can be used to cache the data structures that are interpreted and executed during compilation, thereby reducing the overhead of repeated compilation and improving execution efficiency.

[0074] 9. Syntax Tree (AST): Also known as an Abstract Syntax Tree, it is an abstract representation of the syntactic structure of source code. It displays the syntactic structure of the code in a tree-like structure, where each node represents a syntactic construct in the source code, and the edges represent the relationships between these constructs. The functions of the syntax tree are as follows: 1. Compilers and interpreters use the syntax tree to understand the structure of the source code, thereby performing code analysis, optimization, and generating target code. 2. Static code analysis tools use the syntax tree to check for errors, style issues, and security vulnerabilities in the code. 3. Code transformation can be achieved by modifying the syntax tree, such as code refactoring and code generation.

[0075] The data processing method provided in this application mainly targets the compilation and execution process of functions. Currently, when a computer device receives a function related to business processing, if a single compilation method (e.g., Just-In-Time Compilation, or JII compilation) is used during the compilation stage to compile the function's code data, then in the subsequent business processing of the function, the execution mode corresponding to that single compilation method (e.g., JIT execution mode) needs to be directly adopted to process the function. However, the inventors have found in practice that when the function currently received by the computer device is a lightweight function, if JIT compilation is directly used during compilation to perform full pre-compilation of all functions associated with that function, it will consume a long compilation time and result in high system resource consumption due to the need to store the compilation results obtained from the full pre-compilation.

[0076] Therefore, to solve this problem, this application applies an adaptive polling algorithm to the execution process, switching execution modes based on execution time to improve execution efficiency and save resources. The general process is as follows: ① Obtain the function complexity of the task processing function in the source code data. ② If the function complexity reaches the complexity threshold indicated by the tiered compilation strategy, the compilation method for the task processing function is determined as the first compilation method indicated by the tiered compilation strategy. ③ Compile the task processing function according to the first compilation method to obtain the first type of compilation result. ④ Determine the first execution mode corresponding to the first compilation method used for the task processing function as the main execution mode, and determine the second execution mode corresponding to the second compilation method in the tiered compilation strategy as the secondary execution mode of the main execution mode. ⑤ Obtain the first execution time obtained by executing the executable code in the first type of compilation result using the main execution mode, and obtain the second execution time obtained by executing the data structure in the second type of compilation result using the slave execution mode; the data structure is obtained by compiling the task processing function according to the second compilation method; the number of executions in the main execution mode is greater than the number of executions in the slave execution mode; ⑥ If the time difference between the first execution time and the second execution time reaches the execution mode switching condition, then update the second execution mode to the main execution mode and update the first execution mode to the slave execution mode.

[0077] In this embodiment, the execution mode is divided into a master execution mode and a slave execution mode. When the execution mode switching conditions are met, the master and slave execution modes are switched. This corresponds to an adaptive polling algorithm, which dynamically switches the execution mode based on the execution performance data (specifically, the execution time) during the execution process. This can optimize resource utilization and effectively improve execution efficiency.

[0078] Please see Figure 1 This is a schematic diagram of the system architecture of a data processing system disclosed in an embodiment of this application, such as... Figure 1 As shown, the system architecture may include a data processing server 100 and a terminal device cluster. The terminal device cluster may include one or more terminal devices; the number of terminal devices in the terminal device cluster is not limited here. Figure 1As shown, the terminal devices in the terminal device cluster may specifically include: terminal device 200a, terminal device 200b, terminal device 200c, ..., terminal device 200n. Communication connections can exist between the terminal devices in the cluster; for example, there is a communication connection between terminal device 200a and terminal device 200b, and between terminal device 200a and terminal device 200c. Simultaneously, any terminal device in the terminal device cluster can have a communication connection with the data processing server 100, so that each terminal device in the cluster can interact with the data processing server 100 through this communication connection. For example, there is a communication connection between terminal device 200a and data processing server 100. The above communication connection is not limited to a specific method; it can be established directly or indirectly through wired communication, wireless communication, or other methods, such as through a local area network (LAN), wide area network (WAN), or mobile internet. This application does not impose any limitations on this. Optionally, the system architecture may also include intermediate nodes (such as routers), through which terminal devices can transmit data.

[0079] Each terminal device in this terminal device cluster can include: smartphones, tablets, laptops, desktop computers, wearable devices (such as smartwatches and smart bracelets), smart home devices, head-mounted devices, smart vehicle terminals, and other intelligent terminals (which may have rendering capabilities). It should be understood that, as... Figure 1 Each terminal device in the terminal device cluster shown can have an application client installed. When the application client runs on each terminal device, it can interact with the aforementioned... Figure 1 Data interaction occurs between the data processing servers 100 shown.

[0080] The data processing server 100 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server 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, CDN (Content Delivery Network), and big data and artificial intelligence platforms. This application embodiment does not limit this. It is understood that a database runs on the data processing server 100, and this database can implement the data processing methods provided in this application embodiment. Figure 1 This is merely an illustrative representation of the system architecture of a data processing system and is not intended to be limiting.

[0081] In this application, cloud technology refers to a hosting technology that unifies hardware, software, network, and other resources within a wide area network (WAN) or local area network (LAN) to achieve data computation, storage, processing, and sharing. Cloud technology is a general term encompassing network technology, information technology, integration technology, management platform technology, and application technology applied to cloud computing business models. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. In the embodiments of this application, the database requires a large number of server nodes to store and process data; the cloud platform can easily create and manage these nodes. Alternatively, cloud technology can be combined with the database, where the database is responsible for storing and managing massive amounts of data, while cloud technology provides powerful computing capabilities for data processing and analysis.

[0082] It is understood that users can write source code data through any terminal device in the terminal device cluster, and then send the source code data to the database in the data processing server 100. After receiving the source code data, the data processing server 100 compiles and executes it to realize the relevant functions of the database, such as storing, managing, and retrieving data. Optionally, in some feasible embodiments, the database product can also be installed as program software on the terminal device. After the user starts the database product, the user writes code on the product interface and compiles and runs the code by clicking the "compile and execute" control to obtain the execution result. In the following description, the data processing method of this application embodiment is described using a server as an example.

[0083] Based on the above explanation, a data processing system can also be like... Figure 2 As shown, Figure 2As shown, the data processing system includes at least a first terminal device 101, a database 102, and a data processing server 110. The first terminal device 101 can be a terminal device used by a business object (such as a developer, specifically user u1). The developer can input source code data on the first terminal device 101, and different source code data can implement different business functions. The first terminal device 101 can also be a terminal device used by another business object (such as a user with a request). The user with a request can send a call request to the data processing server 110 through the first terminal device 101 to obtain the corresponding processing result. The developer and the user with a request can be the same business object or different business objects. The database 102 can be used to store source code data, such as the source code of function 1, the source code of function 2, and the source code of function 3, etc. The data processing server 110 is mainly used to receive function call requests sent by users with requests, to compile the functions, and obtain the corresponding processing results. It should be understood that both the first terminal device 101 and the database 102 can establish a communication connection with the data processing server 110.

[0084] like Figure 2As shown, when the data processing method provided in this application embodiment is applied to the system, the specific process can be as follows: S1: The first terminal device 101 sends a function call request to the data processing server 110; S2: The data processing server 110 obtains the source code of function 2 from the database 102; S3: The data processing server 110 determines the function complexity of function 2; S4: It is determined whether the function complexity of function 2 reaches the complexity threshold, wherein the complexity threshold is defined in the hierarchical compilation strategy. When the function complexity of function 2 reaches the complexity threshold, S5 is executed: The first compilation tool in the hierarchical compilation strategy (the compilation tool corresponding to the first compilation method, for example, for JIT compilation, the compilation tool can refer to the LLVM compiler) is used to compile the source code of function 2 to obtain the first type of compilation result, and the second compilation tool (the compilation tool corresponding to the second compilation method) is used to compile the source code of function 2 to obtain the second type of compilation result. S6: Determine the first execution mode as the primary execution mode and execute the first type of compilation result to obtain the first execution time; S7: Determine the second execution mode as the secondary execution mode and execute the second type of compilation result to obtain the second execution time; S8: Determine whether to switch execution modes based on the first and second execution times; if yes, proceed to step S9: switch execution modes; if no, maintain the execution modes unchanged, i.e., the primary execution mode remains the first execution mode, and the secondary execution mode remains the second execution mode. S9: The data processing server 110 returns the processing result of function 2 to the first terminal device 101. Regardless of whether the executable code is executed in the primary execution mode or the data structure is executed in the secondary execution mode, a task processing result is obtained each time it is executed to meet the user's needs.

[0085] The compilation and execution processes mentioned above are all performed by the data processing server. It should be noted that the compilation process mentioned above can also be performed by the terminal device, and the execution process can be performed by the data processing server. This application embodiment does not limit this.

[0086] It should be understood that the data processing server 110 may run a database, which can implement the relevant steps of the data processing method. Alternatively, the data processing server 110 can also be understood as an independent server. If relevant data processing is required, a communication connection needs to be established between other servers and the data processing server 110. After receiving the source code data, the other servers send it to the data processing server 110 for data processing.

[0087] It should be understood that Figure 2The first and second terminal devices shown may specifically include: smartphones, tablets, laptops, desktop computers, wearable devices, smart home devices (e.g., smart TVs), and other smart terminals with video data processing capabilities (e.g., video data playback capabilities). It should also be understood that the data processing server 110 may be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server 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, CDN, and big data and artificial intelligence platforms. This application embodiment does not limit this aspect.

[0088] In some feasible embodiments, the data processing system provided in this application embodiment can be deployed in an e-commerce business scenario. In this case, the database 102 stores the source code of functions such as product information functions, user information functions, and transaction record functions. Business objects (such as product back-end management personnel) can periodically call the product information function through the first terminal device 101 to query the sales status of products, thereby replenishing or removing products from the shelves, increasing sales and ensuring user demand. Alternatively, the data processing system provided in this application embodiment can also be deployed in an enterprise resource planning business scenario. In this case, the database 102 stores the source code of functions such as enterprise employee basic information functions, enterprise employee job assignment functions, and enterprise employee bonus status functions. If a business object (such as enterprise management personnel) needs to view the bonus status of enterprise employees, they can call the bonus status function through the first terminal device 101 to query the bonus status of enterprise employees, thereby enabling enterprise management personnel to grasp the internal performance of the enterprise, so as to facilitate the allocation of corresponding work content to various enterprise employees and improve the internal management efficiency of the enterprise.

[0089] It should be noted that the data collection and processing described in this application should be strictly in accordance with the requirements of relevant laws and regulations, obtaining the informed consent or separate consent of the personal information subject, and conducting subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.

[0090] Based on the data processing system described above, the data processing method proposed in the embodiments of this application will be described in detail below. Please refer to... Figure 3 , Figure 3 This is a flowchart illustrating a data processing method provided in an embodiment of this application. It is understood that the method provided in this embodiment can be executed by a computer device, which can be a terminal device running a database or a server running a database. For ease of understanding, this embodiment uses the computer device as a server as an example to illustrate how the server switches execution modes, such as... Figure 3 As shown, the method may include at least, but is not limited to, the following steps S301-S306:

[0091] S301: Get the function complexity of the task processing function in the source code data.

[0092] In one possible implementation, the server can pre-store functions implementing different business functions in a database, and then perform complexity analysis on these functions to obtain the function complexity of each function. Thus, when the server receives a call request for a specific function (i.e., a task processing function, for example, a function specified for a particular task), it can further execute step S301 according to the call request, so that the pre-stored function (i.e., the task processing function) can be adaptively compiled and executed according to a tiered compilation strategy.

[0093] Alternatively, in another implementation, the server may, upon receiving source code data for a function specified for a task (i.e., the task processing function here), simultaneously store the source code data in a database (e.g., the aforementioned distributed database) and execute step S301 to perform complexity analysis on the function stored in the distributed database, obtain the function complexity, and then, based on the function complexity, adaptively determine the appropriate compilation method from the tiered compilation strategy to compile the source code data of the function in real time. In this way, when the server receives a call request for the function, the timeliness of executing the code using the compilation result obtained through the appropriate compilation method can be improved.

[0094] Therefore, this application embodiment will not limit the timing of obtaining the call request. For example, the call request may be obtained before compilation and execution, or it may be obtained after compilation and execution.

[0095] For example, in some feasible embodiments, after detecting a submission instruction for source code data, the terminal device can directly send the source code data to the server. Upon receiving the source code data, the server can directly compile and execute it. Alternatively, the source code data can be stored in a database. If the source code data for the task processing function is this source code data, then the source code data can be retrieved from the database for compilation and execution.

[0096] The process of determining the function complexity of the task processing function in the source code data by the server can be as follows: Obtain the target processing function from among the multiple processing functions carried in the source code data, and use this target processing function as the task processing function to be processed. The target processing function can be any one of the source code data functions. Obtain the syntax tree structure corresponding to the task processing function, perform structural analysis on the syntax tree structure to obtain structural analysis information, and use this structural analysis information to evaluate the complexity of the task processing function, thus obtaining its function complexity.

[0097] In some feasible embodiments, the structural analysis information includes at least the number of instructions, the number of global variables, and the number of nested call relationships. The number of instructions refers to the number of instructions extracted from the syntax tree structure. Specifically, the number of instructions can be obtained by traversing the syntax tree structure. The number of global variables is determined by the array length of the data group extracted from the syntax tree structure. An array storing global variables is defined in the syntax tree structure, and the number of global variables can be determined based on the length of the array. The number of nested call relationships is determined by the number of associated functions extracted from the syntax tree structure that have function call relationships with the task processing function.

[0098] Therefore, by using structural analysis information to evaluate the complexity of the task processing function, the function complexity can be obtained. The corresponding process is as follows: First, obtain the function complexity evaluation strategy for the task processing function. Based on the function complexity evaluation strategy, determine the first weight corresponding to the number of instructions, the second weight corresponding to the number of global variables, and the third weight corresponding to the number of nested call relationships. In the function complexity evaluation strategy, weight data with different information is defined. For example, the first weight corresponding to the number of instructions can be 1, the second weight corresponding to the number of global variables can be 5, and the third weight corresponding to the number of nested call relationships can also be 1. The weight values ​​can be obtained from experimental data or set by experts. Further, based on the number of instructions, the first weight, the number of global variables, the second weight, the number of nested call relationships, and the third weight, perform complexity evaluation on the task processing function to obtain its function complexity.

[0099] In this process, the complexity evaluation can be performed as follows: multiply the number of instructions by a first weight to obtain a first value; multiply the number of global variables by a second weight to obtain a second value; multiply the number of nested call relationships by a third weight to obtain a third value; finally, add the first, second, and third values ​​to obtain the function complexity of the task processing function. This process is called weighted summation. In addition, a weighted average can be used, i.e., (first value + second value + third value) / (first weight + second weight + third weight), or a weighted variance can be used. The purpose of adding weights is to make the obtained function complexity more accurate.

[0100] In this embodiment, the nested call relationships used in function complexity calculation are determined based on the function call relationships. Therefore, the function call relationships in the source code data are particularly important for function complexity calculation. Figure 4 The diagram shown is a schematic representation of a function call relationship disclosed in an embodiment of this application, based on... Figure 4 It can be seen that function A calls function B, and function B calls functions C and D. Therefore, to determine the function complexity of function A, we need to first determine the function complexities of functions B, C, and D in turn.

[0101] Specifically, the function complexity of function C = number of instructions in function C * first weight + number of global variables in function C * second weight + 0 (since function C does not call other functions, the nesting call relationship is 0); the function complexity of function D = number of instructions in function D * first weight + number of global variables in function D * second weight + 0 (since function D does not call other functions, the nesting call relationship is also 0); the function complexity of function B = number of instructions in function B * first weight + number of global variables in function B * second weight + function complexity of function C * third weight + function complexity of function D * third weight; the function complexity of function A = number of instructions in function A * first weight + number of global variables in function B * second weight + function complexity of function B * third weight.

[0102] Assuming the first weight is 1, the second weight is 5, and the third weight is 1, the number of instructions, global variables, and nested call relationships of function C are 50, 1, and 0 respectively; the number of instructions, global variables, and nested call relationships of function D are 20, 3, and 0 respectively. Therefore, the function complexity of function C is 50*1 + 1*5 + 0 = 55; the function complexity of function D is 20*1 + 3*5 + 0 = 35. Assuming the number of instructions and global variables of function B are 100 and 0 respectively, and the nested call relationship of function B is equal to the function complexity of functions C and D, the function complexity of function B is 100*1 + 0*5 + 55*1 + 35*1 = 190. Assuming the number of instructions and global variables of function A are 200 and 4 respectively, and the nested call relationship of function A is equal to the function complexity of function B, the function complexity of function A is 200*1 + 4*5 + 190*1 = 410. Based on this logic, no matter how complex the function call relationships are, the function complexity can be calculated using this logic.

[0103] Optionally, the structural analysis information corresponding to the syntax tree structure of a function, in addition to including the number of instructions, the number of global variables, and the number of nested call relationships, can also include the numerical values ​​of the algorithmic logic structure and the recursion depth of the task processing function. Therefore, the function complexity can be further determined as follows: Based on the function complexity evaluation strategy, determine the fourth weight corresponding to the numerical value of the algorithmic logic structure and the fifth weight corresponding to the recursion depth. Based on the number of instructions, the first weight, the number of global variables, the second weight, the number of nested call relationships, the third weight, the numerical value of the algorithmic logic structure, the fourth weight, the recursion depth, and the fifth weight, perform complexity evaluation on the task processing function to obtain its function complexity.

[0104] It should be understood that function complexity calculation is closely related to the function's syntax tree structure. As technology continues to advance, function complexity analysis can use more parameters, including but not limited to the number of instructions, the number of global variables, the number of nested call relationships, the numerical value of the function's algorithmic logic structure, and the recursion depth.

[0105] The syntax tree structure of the task processing function usually requires the help of a lexical analyzer and a syntax analyzer. Alternatively, specialized tools or programming languages ​​can be used to implement lexical analysis and syntax analysis. Specifically, the generation process can be as follows: lexical analysis decomposes the input function source code string into individual lexical units (Tokens). Syntax analysis builds a syntax tree based on the lexical units obtained from lexical analysis and according to the syntax rules.

[0106] S302: If the function complexity reaches the complexity threshold indicated by the tiered compilation strategy, then the compilation method for the task processing function will be determined as the first compilation method indicated by the tiered compilation strategy.

[0107] In some feasible implementations, the tiered compilation strategy defines multiple compilation methods, and different compilation methods can be used in different complexity ranges depending on the function complexity.

[0108] In this embodiment, the target compilation method for a task processing function can be determined by the complexity threshold indicated by the hierarchical compilation strategy and the complexity threshold. The complexity threshold and the complexity threshold are compared. If the comparison result indicates that the function complexity reaches the complexity threshold indicated by the hierarchical compilation strategy (i.e., the function complexity is greater than or equal to the complexity threshold), then the target compilation method for the task processing function is determined to be the first compilation method and the second compilation method indicated by the hierarchical compilation strategy. Since the function complexity reaches the complexity threshold, the function is relatively complex. Therefore, both the first and second compilation methods can be selected for compilation. The compilation result obtained by the first compilation method is executable code, which can be executed efficiently by the executor. The compilation result obtained by the second compilation method is a data structure, which is faster to execute and compile for simple functions. Therefore, for task processing functions with high complexity, using both the first and second compilation methods allows for dynamic selection of the execution mode during subsequent execution, thereby improving subsequent execution efficiency.

[0109] If the comparison result indicates that the function complexity does not reach the complexity threshold indicated by the tiered compilation strategy (i.e., the function complexity is less than the threshold), then the compilation method for the task processing function will be determined as the second compilation method indicated by the tiered compilation strategy. The fact that the function complexity does not reach the threshold indicates that the function is relatively simple; therefore, the second compilation method can be selected. The compilation result obtained by the second compilation method is a data structure, which is executed line by line by the executor. Because the function is relatively simple, using the second compilation method saves overhead. If the function were simple, using the first compilation method would incur additional overhead.

[0110] S303: Compile the task processing function according to the first compilation method to obtain the first type of compilation result.

[0111] In some feasible embodiments, the process of compiling the task processing function using the first compilation method may include: obtaining the syntax tree structure of the task processing function (the process of determining the syntax tree structure of the task processing function has been described in step S301 and will not be repeated here); converting the syntax tree structure corresponding to the task processing function into intermediate code corresponding to the first compiler of the first compilation method; simply put, the format of the syntax tree structure needs to be converted into an input format that the first compiler can recognize so that the first compiler can recognize and process the task processing function; calling the first compiler to compile the intermediate code to obtain the executable code corresponding to the task processing function, and using the executable code as the first type of compilation result of the task processing function. In the embodiments of this application, the first compiler used may be the LLVM compiler. The LLVM compiler exhibits significant advantages due to its multi-level customizable code optimization, cross-platform compatibility based on intermediate representation, modular and easily extensible and highly reusable design, powerful performance analysis and debugging functions, and a complete ecosystem supported by an active community. Therefore, using this compiler can improve compilation efficiency.

[0112] Furthermore, when compiling the task processing function according to the first compilation method to obtain the first type of compilation result, the executable code in the first type of compilation result can be stored in the first cache space, which is a cache space in the multi-cache space. The executable code is obtained by compiling the target code data corresponding to the task processing function; the target code data is the code data in the source code data. For the task processing function, the target code data is the code data corresponding to the task processing function in the source code data, and this target code data is the intermediate code after the aforementioned syntax analysis and conversion.

[0113] As can be seen from step S302, when the function complexity does not reach the complexity threshold indicated by the hierarchical compilation strategy, the second compilation method is used. Correspondingly, the process of compiling the task processing function according to the second compilation method to obtain the second type of compilation result can be as follows: obtain the syntax tree structure corresponding to the task processing function; use the second compiler corresponding to the second compilation method to compile the syntax tree structure corresponding to the task processing function to obtain the instruction structure of at least one intermediate processing instruction for the task processing function; determine the instruction structure of at least one intermediate processing instruction as the second type of compilation result. The instruction structure of the intermediate processing instruction is called a data structure.

[0114] Furthermore, the instruction structure of at least one intermediate processing instruction in the second type of compilation result is stored as a data structure in the second cache space of the multiple cache spaces.

[0115] In this embodiment, the first cache space and the second cache space are two independent cache spaces. In one possible implementation, the first cache space and the second cache space can be cache spaces in different databases, such as the first cache space belonging to database A and the second cache space belonging to database B. In another possible implementation, the first cache space and the second cache space can be cache spaces in the same database. When they are in the same database, different modules are used as the corresponding cache spaces.

[0116] In this embodiment, a multi-caching mechanism is employed when storing compilation results. Different compilation results are stored in different cache spaces. In addition to the first and second cache spaces, optional third or fourth cache spaces may be included if other compilation methods exist. This allows the executor to directly retrieve the code data corresponding to the task processing function from the cache space without recompiling sequentially, thus improving execution efficiency.

[0117] Based on the above process, it can be seen that the cache space stores the compilation results of different task processing functions. If the function complexity of the task processing function reaches the complexity threshold, two compilation methods will be used to compile the task processing function, and the compilation results will be stored in the first cache space and the second cache space, respectively. If the function complexity of the task processing function does not reach the complexity threshold, the first compilation method is not required, and the second compilation method is used directly to compile the task processing function, and the compilation result is stored in the corresponding cache space.

[0118] S304: Determine the first execution mode corresponding to the first compilation method used for the task processing function as the primary execution mode, and determine the second execution mode corresponding to the second compilation method in the layered compilation strategy as the secondary execution mode of the primary execution mode.

[0119] To improve execution efficiency, a primary execution mode and a secondary execution mode can be set during execution. The primary execution mode is the main execution mode, and the secondary execution mode is the auxiliary execution mode. The role of the secondary execution mode is to detect the execution efficiency of the primary execution mode. In one feasible embodiment, when the function complexity reaches the complexity threshold indicated by the tiered compilation strategy, the first compilation mode is used. Therefore, the first execution mode corresponding to the first compilation mode used for the task processing function is determined as the primary execution mode, and the second execution mode corresponding to the second compilation mode in the tiered compilation strategy is determined as the secondary execution mode of the primary execution mode. Here, the primary and secondary execution modes are temporary. In this solution, the primary and secondary execution modes can be switched. Whether to switch depends on whether the execution efficiency changes. The execution efficiency can be determined based on the execution time of the primary execution mode and the execution time of the secondary execution mode. See step S305 for details. The purpose of switching is to improve execution efficiency and enhance the user experience.

[0120] S305: Obtain the first execution time obtained by executing the executable code in the first type of compilation result using the main execution mode, and obtain the second execution time obtained by executing the data structure in the second type of compilation result using the slave execution mode; the data structure is obtained by compiling the task processing function according to the second compilation method; the number of executions in the main execution mode is greater than the number of executions in the slave execution mode.

[0121] As can be seen from the above steps, if the task processing function is a complex function (the function's complexity reaches the complexity threshold), the task processing function will be compiled using the first compilation method and the second compilation method respectively. Therefore, under this premise, the executable code in the first type of compilation result is stored in the first cache space in the multi-cache space, and the data structure in the second type of compilation result is stored in the second cache space. The second cache space is a cache space independent of the first cache space in the multi-cache space.

[0122] When a request to call a task processing function is detected or received, the complexity of the task processing function is first determined. If the task processing function is a complex function, the server obtains the first executor corresponding to the first execution mode and retrieves executable code from the first cache space through the first executor. The executable code is then executed through the first executor associated with the main execution mode. Simultaneously, a polling counter is obtained for polling processing. During the execution of the executable code by the first executor, the polling counter records the code execution time and the number of code executions. In this embodiment, the polling counter is used to record the number of executions and the execution time. In addition, the polling counter is also configured with polling conditions. When the code execution time or the number of code executions reaches the polling condition configured by the polling counter, the polling counter will prompt the server to perform performance testing, that is, to use the second execution mode to test the execution efficiency of the first execution mode. The specific process is as follows: obtain the second executor corresponding to the second execution mode, obtain the data structure from the second cache space through the second executor, and execute the data structure through the second executor. At the same time, the polling counter also records the execution time and the number of times the data structure is executed. Based on the number of code executions and the code execution time, the first execution time is determined, and based on the execution time and the number of times the data structure is executed, the second execution time is determined.

[0123] Furthermore, in a computer system, pointers are used to access memory addresses. Therefore, when the first executor retrieves executable code from the first cache space, it can do so using the first pointer. Similarly, when the second executor retrieves structure data from the second cache space, it can do so using the second pointer, ensuring that the data is retrieved accurately.

[0124] The execution time recorded by the polling counter is divided into two types: cumulative time and a time list (i.e., one execution time for each execution). In one possible implementation, if the code execution count refers to the first total execution count corresponding to the main execution mode accumulated by the polling counter, and the code execution duration is obtained by accumulating the execution duration of each time the executable code is executed using the first executor, then the first execution time is determined based on the code execution count and the code execution duration. This includes obtaining the ratio between the code execution duration and the code execution count, and using this ratio as the first execution time. For example, if the total number of code executions is 15 and the code execution duration is 2565ms, then the ratio between the code execution duration and the code execution count is 2565 / 15 = 171ms, so the first execution time is 172ms.

[0125] Similarly, if the number of structure executions refers to the total number of executions corresponding to the execution mode accumulated by the polling counter, and the structure execution duration is obtained by accumulating the execution duration of each execution of the data structure using the second executor by the polling counter; in this case, the second execution time is determined based on the number of structure executions and the structure execution duration, including: obtaining the ratio between the structure execution duration and the number of structure executions; and using the ratio as the second execution time.

[0126] In another possible implementation, if the number of code executions refers to the total number of executions corresponding to the main execution mode accumulated by the polling counter, and the code execution duration is a list of execution durations obtained by the polling counter for each execution of executable code using the first executor, then the first execution time is determined based on the number of code executions and the code execution duration. This includes: adding up all the execution durations included in the total code execution duration to obtain the total code execution duration; determining the ratio between the total code execution duration and the number of code executions; and using the ratio as the first execution time.

[0127] Similarly, if the number of structure executions refers to the total number of executions corresponding to the execution mode accumulated by the polling counter, and the structure execution duration is the list of execution durations obtained by the polling counter for each execution of the data structure using the second executor; in this case, the second execution time is determined based on the number of structure executions and the structure execution duration, including: adding up the various execution durations included in the total structure execution duration to obtain the total structure execution duration, determining the ratio between the total structure execution duration and the number of structure executions; and using the ratio as the second execution time.

[0128] Because the first execution mode is the master execution mode and the second execution mode is the slave execution mode at the current moment, the number of times the above code is executed (the number of times it is executed in the master execution mode) is greater than the number of times the structure is executed (the number of times it is executed in the slave execution mode).

[0129] In this embodiment, the polling condition can be related to either the number of executions or the execution duration. A polling condition related to the number of executions means that the polling condition is set based on the number of executions. After every N executions in the main execution mode, M probes are performed using the slave execution mode. For example, the polling condition could be that after the main execution mode executes 100 times, 3 probes are performed using the slave execution mode. Whether or not probes are performed is also related to the total number of times the task processing function is called. If the total number of times the user calls the task processing function is less than 100, all calls are executed in the main execution mode to obtain the corresponding task processing result. If the total number of times the user calls the task processing function is greater than 100, the main execution mode is executed 100 times first, followed by 3 calls in the slave execution mode. The number of times the slave execution mode is used can be included in the total number of calls (i.e., the corresponding task processing result needs to be obtained), or it can be excluded from the total number of calls (i.e., the task processing result does not need to be recorded, it is only used for probing).

[0130] Furthermore, polling conditions can also be related to execution time. This means that the polling conditions are set based on the execution duration. After the main execution mode executes for the first duration, the slave execution mode is used to probe for the second duration. For example, the polling condition could be that after the main execution mode executes for 30 seconds, the slave execution mode probes for 3 seconds. It should be understood that whether or not probing is performed is still related to the total number of times the task processing function is called. If the number of times the main execution mode executes within 30 seconds has already met the total number of times the task processing function has been called, then the main execution mode is used for all executions, thus obtaining the corresponding task processing result. If the number of times the main execution mode executes within 30 seconds is less than the total number of times the task processing function has been called, then the slave execution mode is used for probing.

[0131] Optionally, to improve execution efficiency, the polling conditions can be dynamically set based on the total number of calls to the task processing function. If the total number of calls is 100, the polling conditions can be set to execute the main execution mode 10 times, and then use the slave execution mode for detection; if the total number of calls is 100, the polling conditions can be set to execute the main execution mode 100 times, and then use the slave execution mode for detection.

[0132] S306: If the time difference data between the first execution time and the second execution time reaches the execution mode switching condition, then the second execution mode will be updated to the primary execution mode, and the first execution mode will be updated to the secondary execution mode.

[0133] Before determining whether to switch execution modes, it is necessary to determine the magnitude of the first execution time and the second execution time. If the second execution time is greater than or equal to the first execution time, it is not necessary to calculate the difference between the first execution time and the second execution time, because it can be seen by directly comparing the magnitudes that using the second execution mode does not reduce the time. Therefore, the first execution mode is still used, that is, the main execution mode is maintained as the first execution mode, and the slave execution mode is maintained as the first execution mode.

[0134] If the second execution time is less than the first execution time, the time difference between the first and second execution times is determined. This time difference refers to a value obtained through a series of calculations involving the first and second execution times. For example, it could be obtained by subtracting the second execution time from the first execution time, then dividing this time difference by the first execution time, i.e., time difference = (first execution time - second execution time) / first execution time. Next, the time difference threshold indicating the execution mode switching condition is obtained. If the time difference is greater than or equal to the time difference threshold, it is determined that the time difference between the first and second execution times meets the execution mode switching condition. The time difference threshold can be customized, for example, set to 0.2. When the execution mode switching condition is met, the second execution mode is updated to the primary execution mode, and the first execution mode is updated to the secondary execution mode.

[0135] Furthermore, the third execution time is obtained when executing the data structure in the second type of compilation result using the main execution mode; and the fourth execution time is obtained when executing the executable code in the first type of compilation result using the slave execution mode. If the time difference between the third and fourth execution times reaches the execution mode switching condition, the first execution mode is updated to the main execution mode, and the second execution mode is updated to the slave execution mode. Following this logic, the main and slave execution modes are continuously switched based on the execution time to ensure execution efficiency. The process for determining the third and fourth execution times can be found in the process for determining the first and second execution times, and will not be repeated here.

[0136] If the time difference data is less than the time difference threshold indicated by the execution mode switching condition, it is determined that the time difference data between the first execution time and the second execution time has not met the execution mode switching condition. The main execution mode is maintained as the first execution mode, and the slave execution mode is maintained as the first execution mode. Steps S305 and S306 are repeated until all the call requests of the processing functions are completed.

[0137] like Figure 5 The diagram shown is a schematic representation of an execution process disclosed in an embodiment of this application. Figure 5As can be seen, when executing the task processing function using the executor, it first executes three times in the first execution mode (main execution mode), then performs a probe (using the slave execution mode). If the probe finds that the execution mode switching condition is met, the execution mode is switched to the second execution mode (at this time, the second execution mode is the main execution mode), and execution continues three times, followed by another probe, and so on, until all call requests are completed. For example, the first execution mode can be the JIT execution mode, and the second execution mode can be the interpreted compilation execution mode. When the function complexity of the task processing function exceeds a complexity threshold, the JIT execution mode is used first. When polling the condition, the interpreted compilation execution mode is used for probing, and then the execution mode switching is determined based on the execution time of the probe and the execution time of the JIT execution mode.

[0138] based on Figure 5 The execution process can be obtained by using a loop counter to determine the execution time of each execution, as shown in Table 2.

[0139] Table 2

[0140] First Execution Mode 148.382ms First Execution Mode 152.743ms First Execution Mode 146.901ms Second execution mode 123.327ms Second execution mode 128.229ms Second execution mode 130.229ms Second execution mode 150.229ms First Execution Mode 150.327ms Second execution mode 122.229ms Second execution mode 124.229ms

[0141] As shown in Table 2, the task processing function initially uses the first execution mode as its primary execution mode. Table 2 records the execution times for each mode. After executing three times in the first execution mode, a second execution mode is used for probing. Calculations show that the time difference data met the execution mode switching condition during the first probing, so the primary execution mode is updated to the second execution mode, and the secondary execution mode is updated back to the first execution mode. After executing three times in the primary execution mode, a second probing is performed using the secondary execution mode. Calculations show that the time difference data did not meet the execution mode switching condition during the second probing, so the primary execution mode remains the second execution mode, and the secondary execution mode remains the first execution mode. Execution continues using the second execution mode until the required number of calls is reached, at which point the task processing result is returned to the user.

[0142] In some feasible embodiments, if the task processing function does not belong to the complex function class (i.e. the function complexity has not reached the complexity threshold), the data structure of the task processing function is directly obtained from the second cache space through the second executor, and the data structure is executed through the second executor to obtain the task processing result.

[0143] Furthermore, after receiving the task processing result, the server also needs to return the task processing result for the task processing function to the user terminal. During the executor's execution, whether executing executable code in the main execution mode or executing data structures in the secondary execution mode, a task processing result is obtained each time it is executed. These task processing results can be returned to the user terminal as a set, or they can be returned to the user terminal sequentially. For example, if a user calls the task processing function 100 times, normally 100 task processing results need to be output. These 100 task processing results can be returned to the user terminal all at once after the server executes the task processing function 100 times; or they can be returned to the user terminal one task processing result after each execution of the task processing function. In this embodiment, the return method is not limited.

[0144] This application embodiment mainly describes the process of determining function complexity and the switching process between master and slave execution modes. Specifically, the function complexity of the task processing function in the source code data is obtained. If the function complexity reaches the complexity threshold indicated by the tiered compilation strategy, the compilation method for the task processing function is determined to be the first compilation method indicated by the tiered compilation strategy. The task processing function is compiled according to the first compilation method to obtain a first type of compilation result. The first execution mode corresponding to the first compilation method used for the task processing function is determined as the master execution mode, and the second execution mode corresponding to the second compilation method in the tiered compilation strategy is determined as the slave execution mode of the master execution mode. The first execution time obtained by executing the executable code in the first type of compilation result using the master execution mode is obtained, and the second execution time obtained by executing the data structure in the second type of compilation result using the slave execution mode is obtained; the data structure is obtained by compiling the task processing function according to the second compilation method; the number of executions in the master execution mode is greater than the number of executions in the slave execution mode; if the time difference between the first execution time and the second execution time reaches the execution mode switching condition, the second execution mode is updated to the master execution mode, and the first execution mode is updated to the slave execution mode. In this embodiment, the execution mode is divided into a master execution mode and a slave execution mode. When the execution mode switching conditions are met, the master and slave execution modes are switched. Specifically, the execution mode is dynamically switched based on the execution performance data (specifically, the execution time) during the execution process, which can optimize resource utilization and effectively improve execution efficiency.

[0145] Please see Figure 6 This is a flowchart illustrating another data processing method provided in an embodiment of this application. This flowchart can be executed by a computer device, which can be a terminal device running a database or a server running a database. For ease of understanding, Figure 6Taking this computer device as a server as an example, the overall process of the data processing method is explained, such as... Figure 6 As shown, the method may include at least, but is not limited to, the following steps S601-S612:

[0146] S601: Get the function complexity of the task processing function in the source code data.

[0147] S602: Determine whether the function complexity of the task processing function has reached the complexity threshold indicated by the tiered compilation strategy.

[0148] If the complexity of the task processing function reaches the complexity threshold indicated by the tiered compilation strategy, then execute steps S603-S608. If the complexity of the task processing function does not reach the complexity threshold indicated by the tiered compilation strategy, then execute steps S609 and S610.

[0149] S603: The compilation method for the task processing function is determined to be the first compilation method indicated by the tiered compilation strategy, and the task processing function is compiled according to the first compilation method to obtain the first type of compilation result.

[0150] In step S603, when the task processing function is compiled according to the first compilation method, the first type of compilation result mainly includes the executable code corresponding to the task processing function, which is stored in the first cache space. When the task processing function is a complex function, in addition to compiling it according to the first compilation method, it also needs to be compiled according to the second compilation method to obtain a second type of compilation result including a data structure, which is then stored in the second cache space.

[0151] S604: Determine the first execution mode corresponding to the first compilation method used for the task processing function as the primary execution mode, and determine the second execution mode corresponding to the second compilation method in the layered compilation strategy as the secondary execution mode of the primary execution mode.

[0152] S605: Obtain the first execution time obtained by executing the executable code in the first type of compilation result using the main execution mode, and obtain the second execution time obtained by executing the data structure in the second type of compilation result using the secondary execution mode.

[0153] The process is as follows: First, obtain the first executor corresponding to the first execution mode; retrieve executable code from the first cache space using the first executor; obtain a polling counter for polling processing; when the executable code is executed using the first executor associated with the main execution mode, record the code execution time and number of code executions using the polling counter; when the code execution time or number of code executions reaches the polling condition configured by the polling counter, obtain the second executor corresponding to the second execution mode; retrieve a data structure from the second cache space using the second executor; when the data structure is executed using the second executor, record the structure execution time and number of structure executions using the polling counter; determine the first execution time based on the number of code executions and the code execution time, and determine the second execution time based on the structure execution time and the number of structure executions. This process has been described in detail in step S305 and will not be repeated here.

[0154] S606: Determine whether the time difference data between the first execution time and the second execution time meets the conditions for switching execution modes.

[0155] If the time difference data between the first execution time and the second execution time meets the execution mode switching condition, then step S607 is executed; if the time difference data between the first execution time and the second execution time does not meet the execution mode switching condition, then the main execution mode is maintained as the first execution mode, and the slave execution mode is maintained as the second execution mode, and step S605 is executed repeatedly.

[0156] S607: Update the second execution mode to the primary execution mode and update the first execution mode to the secondary execution mode.

[0157] S608: Obtain the third execution time obtained by executing the data structure in the second type of compilation result using the main execution mode; and obtain the fourth execution time obtained by executing the executable code in the first type of compilation result using the secondary execution mode.

[0158] The process is roughly as follows: First, obtain the second executor corresponding to the second execution mode. Then, obtain the executable code of the data structure for the task processing function from the second cache space using the second executor. Second, obtain a polling counter for polling processing. When executing the data structure using the second executor associated with the main execution mode, record the execution time and number of times the data structure is executed using the polling counter. When the execution time or number of times the data structure is executed reaches the polling condition configured by the polling counter, obtain the first executor corresponding to the first execution mode. Then, obtain the executable code from the first cache space using the first executor. When executing the executable code using the first executor, record the execution time and number of times the executable code is executed using the polling counter. Third, determine the third execution time based on the execution time and number of times the data structure is executed, and finally, determine the fourth execution time based on the number of times the data structure is executed and the execution time.

[0159] S609: Determine whether the time difference data between the third execution time and the fourth execution time meets the conditions for switching execution modes.

[0160] If the time difference data between the third execution time and the fourth execution time meets the execution mode switching condition, then step S604 is executed; if the time difference data between the third execution time and the fourth execution time does not meet the execution mode switching condition, then the main execution mode is maintained as the second execution mode, and the slave execution mode is maintained as the first execution mode, and step S608 is executed repeatedly.

[0161] Under this branch, repeat steps S604-S609 until all call requests to the task processing function are completed, and finally output the task processing result.

[0162] S610: The compilation method for the task processing function is determined to be the second compilation method indicated by the tiered compilation strategy, and the task processing function is compiled using the second compilation method to obtain the second type of compilation result.

[0163] S611: Obtain the second executor corresponding to the second execution mode of the second compilation method, obtain the data structure through the second executor, and execute the data structure through the second executor to obtain the task execution result of the task processing function.

[0164] S612: Obtain the task execution result of the task processing function.

[0165] Furthermore, the above steps S601-S612 can be summarized as follows: Figure 7The flowchart shown illustrates the following steps for the server: S1, receiving the source code data of the task processing function; S2, performing syntax analysis on the source code data of the task processing function; S3, generating the syntax tree structure of the task processing function; S4, determining the function complexity of the task processing function based on the syntax tree structure; S5, determining whether the function complexity of the task processing function reaches a complexity threshold. If the function complexity reaches the complexity threshold, the steps in block 710 are executed, including: passing the syntax tree structure to the intermediate code conversion module; converting it into intermediate code equivalent to the task processing function; compiling the intermediate code using a compilation tool (e.g., the LLVM compiler); and generating a compilation result including executable code. The executor starts running, reads the executable code from the cache space, and executes the executable code. If the function complexity does not reach the complexity threshold, the steps in block 720 are executed, including: performing semantic analysis on the syntax tree structure; generating parsing execution commands based on the semantic analysis results; and the executor executing the parsing execution commands step by step. Figure 7 This clearly demonstrates the differences in compilation and execution at different function complexities, and any task processing function can be processed according to this logic.

[0166] Furthermore, taking the task processing function as a PL function as an example, the compilation and execution flow corresponding to the embodiments of this application can be as follows: Figure 8 As shown, the PL function is first analyzed to obtain a syntax tree. The function complexity is then determined based on the syntax tree. Two branches are executed based on the function complexity: one branch is when the function complexity is greater than or equal to a complexity threshold. Under this branch, the syntax tree is sent to the IR CODE conversion module. The IR CODE conversion module converts the PL function's syntax tree into an IR CODE that the LLVM compiler can recognize. After the IR CODE is compiled by the LLVM compiler, executable code is generated in memory. When the executor executes, it reads the executable code from memory and executes it to obtain the execution result of the PL function.

[0167] Another branch is where the function complexity is less than a complexity threshold. Under this branch, semantic analysis is performed on the syntax tree of the PL function, and it is compiled and parsed line by line to generate parsed execution commands. For example... Figure 8 As shown in 810, it includes multiple lines of PL commands, including but not limited to "assignment", "condition", "loop", and "return". During execution, the executor executes them line by line in the order they were compiled and parsed, thus obtaining the corresponding execution results.

[0168] In this embodiment, the compilation and execution process under different function complexity conditions is clearly illustrated in conjunction with the overall data flow. It can be concluded that when the function complexity is low, the second compilation method and the second execution mode are directly used for compilation and execution. Due to the low complexity, this method saves execution resources and avoids waste. When the function complexity is high, a polling approach is used to dynamically switch between the first and second execution modes based on the specific execution time. This adaptively selects the most efficient execution mode, thereby improving execution efficiency.

[0169] Based on the above method embodiments, this application also provides a schematic diagram of the structure of a data processing apparatus. Please refer to... Figure 9 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application. Figure 9 As shown, the data processing device 900 can be a computer program (including program code) running on a computer device, for example, the data processing device 900 is an application software; the device can be used to execute the corresponding steps in the data processing method provided in the embodiments of this application. Figure 9 As shown, the data processing device 900 can run in a data processing server and may include: an acquisition module 901, a determination module 902, a compilation module 903, an update module 904, an evaluation module 905, a storage module 906, and an execution module 907.

[0170] Module 901 is used to obtain the function complexity of the task processing function in the source code data;

[0171] The determination module 902 is used to determine the compilation method for the task processing function as the first compilation method indicated by the layered compilation strategy if the complexity of the function reaches the complexity threshold indicated by the layered compilation strategy.

[0172] The compilation module 903 is used to compile the task processing function according to the first compilation method to obtain a first type of compilation result;

[0173] The determining module 902 is further configured to determine the first execution mode corresponding to the first compilation method used for the task processing function as the main execution mode, and determine the second execution mode corresponding to the second compilation method in the layered compilation strategy as the slave execution mode of the main execution mode;

[0174] The acquisition module 901 is further configured to acquire a first execution time obtained by executing the executable code in the first type of compilation result using the main execution mode, and to acquire a second execution time obtained by executing the data structure in the second type of compilation result using the slave execution mode; the data structure is obtained by compiling the task processing function according to the second compilation method; the number of executions in the main execution mode is greater than the number of executions in the slave execution mode;

[0175] The update module 904 is used to update the second execution mode to the main execution mode and the first execution mode to the slave execution mode if the time difference data between the first execution time and the second execution time reaches the execution mode switching condition.

[0176] In one feasible embodiment, when the acquisition module 901 acquires the function complexity of the task processing function in the source code data, it specifically performs the following steps:

[0177] Obtain the target processing function from the multiple processing functions carried in the source code data, and use the target processing function as the task processing function to be processed;

[0178] Obtain the syntax tree structure corresponding to the task processing function, perform structural analysis on the syntax tree structure, and obtain structural analysis information for the syntax tree structure;

[0179] The complexity of the task processing function is obtained by performing a complexity evaluation on the structure analysis information.

[0180] In one feasible embodiment, the structural analysis information includes at least the number of instructions, the number of global variables, and the number of nested call relationships; the number of instructions refers to the number of instructions extracted from the syntax tree structure, the number of global variables is determined by the array length of the data group extracted from the syntax tree structure, and the number of nested call relationships is determined by the number of associated functions extracted from the syntax tree structure that have function call relationships with the task processing function;

[0181] When the evaluation module 905 performs a complexity evaluation on the task processing function using the structural analysis information to obtain the function complexity of the task processing function, it specifically performs the following steps:

[0182] Obtain a function complexity evaluation strategy for the task processing function, and determine a first weight corresponding to the number of instructions, a second weight corresponding to the number of global variables, and a third weight corresponding to the number of nested call relationships based on the function complexity evaluation strategy;

[0183] Based on the number of instructions, the first weight, the number of global variables, the second weight, the number of nested call relationships, and the third weight, the complexity of the task processing function is evaluated to obtain the function complexity of the task processing function.

[0184] In one feasible embodiment, when the compilation module 903 compiles the task processing function according to the first compilation method and obtains the first type of compilation result, it specifically performs the following steps:

[0185] Obtain the syntax tree structure corresponding to the task processing function;

[0186] The syntax tree structure corresponding to the task processing function is converted into intermediate code corresponding to the first compiler corresponding to the first compilation method;

[0187] The first compiler is invoked to compile the intermediate code to obtain the executable code corresponding to the task processing function, and the executable code is used as the first type of compilation result of the task processing function.

[0188] In one feasible embodiment, the storage module 906 is used to store the executable code in the first type of compilation result into a first cache space when the task processing function is compiled according to the first compilation method to obtain a first type of compilation result. The first cache space is a cache space in a multi-cache space. The executable code is obtained by compiling the target code data corresponding to the task processing function. The target code data is the code data in the source code data.

[0189] In one feasible embodiment, the compilation module 903 is used to compile the task processing function according to the second compilation method to obtain an instruction structure for at least one intermediate processing instruction for the task processing function.

[0190] The storage module 906 is used to determine the instruction structure of the at least one intermediate processing instruction as the second type of compilation result, and store the instruction structure of the at least one intermediate processing instruction in the second type of compilation result as the data structure in the second cache space of the multiple cache spaces.

[0191] In one feasible embodiment, the executable code is stored in a first cache space among multiple cache spaces, and the data structure is stored in a second cache space, wherein the second cache space is a cache space among the multiple cache spaces that is independent of the first cache space;

[0192] The acquisition module 901 is further configured to acquire the first executor corresponding to the first execution mode, and acquire the executable code from the first cache space through the first executor; acquire a polling counter for polling processing, and when the executable code is executed through the first executor associated with the main execution mode, record the code execution time and code execution count obtained by executing the executable code through the polling counter; when the code execution time or code execution count reaches the polling condition configured by the polling counter, acquire the second executor corresponding to the second execution mode, acquire the data structure from the second cache space through the second executor, and when the data structure is executed through the second executor, record the structure execution time and structure execution count obtained by executing the data structure through the polling counter;

[0193] The determining module 902 is further configured to determine the first execution time based on the number of times the code is executed and the execution duration of the code, and to determine the second execution time based on the execution duration of the structure and the number of times the structure is executed.

[0194] In one feasible embodiment, the number of code executions refers to the first total number of executions corresponding to the main execution mode accumulated and recorded by the polling counter, and the code execution time is obtained by accumulating the execution time obtained each time the first executor is used to execute the executable code by the polling counter;

[0195] When determining the first execution time based on the number of code executions and the code execution duration, the determining module 902 specifically performs the following steps:

[0196] Obtain the ratio between the code execution time and the number of code executions;

[0197] The ratio is used as the first execution time.

[0198] In one feasible embodiment, the acquisition module 901 is further configured to acquire the time difference threshold of the execution mode switching condition indication; and acquire the time difference data between the first execution time and the second execution time;

[0199] The determining module 902 is further configured to determine that the time difference data between the first execution time and the second execution time has reached the execution mode switching condition if the time difference data is less than or equal to the time difference threshold indicated by the execution mode switching condition.

[0200] In one feasible embodiment, the determining module 902 is further configured to maintain the primary execution mode as the first execution mode and maintain the secondary execution mode as the first execution mode if the time difference data between the first execution time and the second execution time does not meet the execution mode switching condition.

[0201] In one feasible embodiment, the determining module 902 is further configured to determine the compilation method for the task processing function as the second compilation method indicated by the layered compilation strategy if the function complexity does not reach the complexity threshold indicated by the layered compilation strategy.

[0202] The acquisition module 901 is further configured to acquire the syntax tree structure corresponding to the task processing function; the compilation module 903 is further configured to use the second compiler corresponding to the second compilation method to compile the syntax tree structure corresponding to the task processing function to obtain a second type of compilation result including data structures; the storage module 906 is further configured to store the second type of compilation result in the second cache space of the multiple cache spaces.

[0203] Upon receiving a call request for the task processing function, the acquisition module 901 is further configured to acquire the second executor under the second execution mode corresponding to the second compilation method, and to acquire the data structure from the second cache space through the second executor. The execution module 907 is configured to execute the data structure through the second executor to obtain the task execution result of the task processing function.

[0204] In one feasible embodiment, the acquisition module 901 is further configured to acquire a third execution time obtained by executing the data structure in the second type of compilation result using the main execution mode; and acquire a fourth execution time obtained by executing the executable code in the first type of compilation result using the secondary execution mode;

[0205] The update module 904 is further configured to update the first execution mode to the main execution mode and the second execution mode to the slave execution mode if the time difference data between the third execution time and the fourth execution time reaches the execution mode switching condition.

[0206] It is understood that the functions of each functional module of the data processing device 900 provided in the embodiments of this application can be specifically implemented according to the methods in the above method embodiments. The specific implementation process can be referred to the relevant descriptions in the above method embodiments, which will not be repeated here.

[0207] In feasible embodiments, the data processing device 900 provided in this application embodiment can be implemented in software. The data processing device 900 can be stored in a memory and can be software in the form of programs and plug-ins. It includes a series of modules, including an acquisition module 901, a determination module 902, a compilation module 903, an update module 904, an evaluation module 905, a storage module 906, and an execution module 907. The acquisition module 901, determination module 902, compilation module 903, update module 904, evaluation module 905, storage module 906, and execution module 907 are used to implement the data processing method provided in this application embodiment.

[0208] In other feasible embodiments, the data processing device 900 provided in this application embodiment can also be implemented in a combination of hardware and software. As an example, the data processing device 900 provided in this application embodiment can be a processor in the form of a hardware decoding processor, which is programmed to implement the data processing method provided in this application embodiment. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.

[0209] Further, please see Figure 10 , Figure 10 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 10 As shown, the computer device 1000 can be a server, and the client can be the aforementioned... Figure 1The corresponding embodiment refers to the data processing server 100. At this time, the computer device 1000 may include: a processor 1001, a network interface 1004, and a memory 1005. Furthermore, the computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. The communication bus 1002 is used to implement communication between these components. The user interface 1003 may include a display screen and a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as at least one disk storage device. Optionally, the memory 1005 may also be at least one storage device located remotely from the aforementioned processor 1001. Figure 10 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a device control application program.

[0210] The network interface 1004 in the computer device 1000 can also provide network communication functions, and the optional user interface 1003 can also include a display screen and a keyboard. Figure 10 In the computer device 1000 shown, the network interface 1004 provides network communication functionality; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005 to implement the aforementioned... Figure 3 , Figure 6 , Figure 7 or Figure 8 The corresponding embodiments describe the data processing methods.

[0211] In this embodiment of the application, the processor 1001 can be used to load and execute the device control application stored in the memory 1005, as follows:

[0212] Obtain the function complexity of the task processing function in the source code data;

[0213] If the complexity of the function reaches the complexity threshold indicated by the tiered compilation strategy, then the compilation method for the task processing function will be determined as the first compilation method indicated by the tiered compilation strategy.

[0214] The task processing function is compiled according to the first compilation method to obtain the first type of compilation result;

[0215] The first execution mode corresponding to the first compilation method used by the task processing function is determined as the main execution mode, and the second execution mode corresponding to the second compilation method in the layered compilation strategy is determined as the secondary execution mode of the main execution mode;

[0216] The execution time is obtained by executing the executable code in the first type of compilation result using the main execution mode, and the execution time is obtained by executing the data structure in the second type of compilation result using the slave execution mode; the data structure is obtained by compiling the task processing function according to the second compilation method; the number of executions in the main execution mode is greater than the number of executions in the slave execution mode;

[0217] If the time difference between the first execution time and the second execution time reaches the execution mode switching condition, then the second execution mode is updated to the primary execution mode, and the first execution mode is updated to the secondary execution mode.

[0218] In one feasible embodiment, when the processor 1001 calls the function complexity of the device control application loading and executing the task processing function in the source code data stored in the memory 1005, it specifically performs the following steps:

[0219] Obtain the target processing function from the multiple processing functions carried in the source code data, and use the target processing function as the task processing function to be processed;

[0220] Obtain the syntax tree structure corresponding to the task processing function, perform structural analysis on the syntax tree structure, and obtain structural analysis information for the syntax tree structure;

[0221] The complexity of the task processing function is obtained by performing a complexity evaluation on the structure analysis information.

[0222] In one feasible embodiment, the structural analysis information includes at least the number of instructions, the number of global variables, and the number of nested call relationships; the number of instructions refers to the number of instructions extracted from the syntax tree structure, the number of global variables is determined by the array length of the data group extracted from the syntax tree structure, and the number of nested call relationships is determined by the number of associated functions extracted from the syntax tree structure that have function call relationships with the task processing function;

[0223] When the processor 1001 calls the device control application stored in the memory 1005 to load and execute the task processing function to perform complexity evaluation processing based on the structure analysis information, and obtains the function complexity of the task processing function, it specifically performs the following steps:

[0224] Obtain a function complexity evaluation strategy for the task processing function, and determine a first weight corresponding to the number of instructions, a second weight corresponding to the number of global variables, and a third weight corresponding to the number of nested call relationships based on the function complexity evaluation strategy;

[0225] Based on the number of instructions, the first weight, the number of global variables, the second weight, the number of nested call relationships, and the third weight, the complexity of the task processing function is evaluated to obtain the function complexity of the task processing function.

[0226] In one feasible embodiment, when the processor 1001 calls the device control application stored in the memory 1005 to load and execute the task processing function according to the first compilation method to obtain a first type of compilation result, it specifically performs the following steps:

[0227] Obtain the syntax tree structure corresponding to the task processing function;

[0228] The syntax tree structure corresponding to the task processing function is converted into intermediate code corresponding to the first compiler corresponding to the first compilation method;

[0229] The first compiler is invoked to compile the intermediate code to obtain the executable code corresponding to the task processing function, and the executable code is used as the first type of compilation result of the task processing function.

[0230] In one feasible embodiment, the processor 1001 is used to load and execute the device control application stored in the memory 1005, as follows:

[0231] When the task processing function is compiled according to the first compilation method to obtain a first type of compilation result, the executable code in the first type of compilation result is stored in a first cache space. The first cache space is a cache space in a multi-cache space. The executable code is obtained by compiling the target code data corresponding to the task processing function. The target code data is the code data in the source code data.

[0232] In one feasible embodiment, the processor 1001 is used to load and execute the device control application stored in the memory 1005, as follows:

[0233] The task processing function is compiled according to the second compilation method to obtain an instruction structure for at least one intermediate processing instruction for the task processing function;

[0234] The instruction structure of the at least one intermediate processing instruction is determined as the second type of compilation result, and the instruction structure of the at least one intermediate processing instruction in the second type of compilation result is stored as the data structure in the second cache space of the multiple cache spaces.

[0235] In one feasible embodiment, the executable code is stored in a first cache space among multiple cache spaces, and the data structure is stored in a second cache space, wherein the second cache space is a cache space among the multiple cache spaces that is independent of the first cache space;

[0236] Processor 1001 is used to load and execute the device control application stored in memory 1005, and perform the following steps:

[0237] Obtain the first executor corresponding to the first execution mode, and obtain the executable code from the first cache space through the first executor;

[0238] Obtain a polling counter for polling processing. When the executable code is executed by the first executor associated with the main execution mode, the polling counter records the code execution time and the number of code executions.

[0239] When the code execution time or the number of code executions reaches the polling condition configured by the polling counter, the second executor corresponding to the second execution mode is obtained, and the data structure is obtained from the second cache space through the second executor. When the data structure is executed through the second executor, the structure execution time and the number of structure executions obtained by executing the data structure are recorded by the polling counter.

[0240] The first execution time is determined based on the number of times the code is executed and the execution duration of the code, and the second execution time is determined based on the execution duration of the structure and the number of times the structure is executed.

[0241] In one feasible embodiment, the number of code executions refers to the first total number of executions corresponding to the main execution mode accumulated and recorded by the polling counter, and the code execution time is obtained by accumulating the execution time obtained each time the first executor is used to execute the executable code by the polling counter;

[0242] When the processor 1001 calls the device control application stored in the memory 1005 to load and execute, and determines the first execution time based on the number of code executions and the code execution duration, it specifically performs the following steps:

[0243] Obtain the ratio between the code execution time and the number of code executions;

[0244] The ratio is used as the first execution time.

[0245] In one feasible embodiment, the processor 1001 is used to load and execute the device control application stored in the memory 1005, as follows:

[0246] Obtain the time difference threshold of the execution mode switching condition indication; and obtain the time difference data between the first execution time and the second execution time;

[0247] If the time difference data is less than or equal to the time difference threshold indicated by the execution mode switching condition, then it is determined that the time difference data between the first execution time and the second execution time has reached the execution mode switching condition.

[0248] In one feasible embodiment, the processor 1001 is used to load and execute the device control application stored in the memory 1005, as follows:

[0249] If the time difference between the first execution time and the second execution time does not meet the execution mode switching condition, then the primary execution mode is maintained as the first execution mode, and the secondary execution mode is maintained as the first execution mode.

[0250] In one feasible embodiment, the processor 1001 is used to load and execute the device control application stored in the memory 1005, as follows:

[0251] If the complexity of the function does not reach the complexity threshold indicated by the hierarchical compilation strategy, then the compilation method for the task processing function will be determined as the second compilation method indicated by the hierarchical compilation strategy.

[0252] Obtain the syntax tree structure corresponding to the task processing function; use the second compiler corresponding to the second compilation method to compile the syntax tree structure corresponding to the task processing function to obtain a second type of compilation result including data structures, and store the second type of compilation result in the second cache space of the multiple cache space;

[0253] Upon receiving a call request for the task processing function, the system obtains the second executor corresponding to the second execution mode of the second compilation method, retrieves the data structure from the second cache space through the second executor, executes the data structure through the second executor, and obtains the task execution result of the task processing function.

[0254] In one feasible embodiment, the processor 1001 is used to load and execute the device control application stored in the memory 1005, as follows:

[0255] Obtain the third execution time obtained by executing the data structure in the second type of compilation result using the main execution mode; and obtain the fourth execution time obtained by executing the executable code in the first type of compilation result using the secondary execution mode;

[0256] If the time difference between the third execution time and the fourth execution time reaches the execution mode switching condition, then the first execution mode is updated to the primary execution mode, and the second execution mode is updated to the secondary execution mode.

[0257] Furthermore, it should be noted that this application embodiment also provides a computer storage medium, which stores a computer program executed by the aforementioned data processing device. The computer program includes program instructions, and when the processor executes the program instructions, it can execute the aforementioned... Figure 3 , Figure 6 , Figure 7 as well as Figure 8 The description of the data processing method in the corresponding embodiments is already provided and will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the embodiments of the computer storage medium involved in this application, please refer to the description of the method embodiments of this application.

[0258] It is understood that embodiments of this application also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. The 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 aforementioned... Figure 3 , Figure 6 , Figure 7 as well as Figure 8 The description of the data processing method in the corresponding embodiments is already provided and will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the embodiments of the computer storage medium involved in this application, please refer to the description of the method embodiments of this application.

[0259] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0260] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, and the division of modules described above is only a logical functional division. In actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0261] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0262] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A data processing method, characterized in that, The method includes: Obtain the function complexity of the task processing function in the source code data; If the complexity of the function reaches the complexity threshold indicated by the tiered compilation strategy, then the compilation method for the task processing function will be determined as the first compilation method indicated by the tiered compilation strategy. The task processing function is compiled according to the first compilation method to obtain the first type of compilation result; The first execution mode corresponding to the first compilation method used by the task processing function is determined as the main execution mode, and the second execution mode corresponding to the second compilation method in the layered compilation strategy is determined as the secondary execution mode of the main execution mode; The execution time is obtained by executing the executable code in the first type of compilation result using the main execution mode, and the execution time is obtained by executing the data structure in the second type of compilation result using the slave execution mode; the data structure is obtained by compiling the task processing function according to the second compilation method; the number of executions in the main execution mode is greater than the number of executions in the slave execution mode; If the time difference between the first execution time and the second execution time reaches the execution mode switching condition, then the second execution mode is updated to the primary execution mode, and the first execution mode is updated to the secondary execution mode.

2. The method according to claim 1, characterized in that, The function complexity of the task processing function obtained from the source code data includes: Obtain the target processing function from the multiple processing functions carried in the source code data, and use the target processing function as the task processing function to be processed; Obtain the syntax tree structure corresponding to the task processing function, perform structural analysis on the syntax tree structure, and obtain structural analysis information for the syntax tree structure; The complexity of the task processing function is obtained by performing a complexity evaluation on the structure analysis information.

3. The method according to claim 2, characterized in that, The structural analysis information includes at least the number of instructions, the number of global variables, and the number of nested call relationships; the number of instructions refers to the number of instructions extracted from the syntax tree structure, the number of global variables is determined by the array length of the data group extracted from the syntax tree structure, and the number of nested call relationships is determined by the number of associated functions extracted from the syntax tree structure that have function call relationships with the task processing function. The process of evaluating the complexity of the task processing function using the structural analysis information to obtain the function complexity of the task processing function includes: Obtain a function complexity evaluation strategy for the task processing function, and determine a first weight corresponding to the number of instructions, a second weight corresponding to the number of global variables, and a third weight corresponding to the number of nested call relationships based on the function complexity evaluation strategy; Based on the number of instructions, the first weight, the number of global variables, the second weight, the number of nested call relationships, and the third weight, the complexity of the task processing function is evaluated to obtain the function complexity of the task processing function.

4. The method according to claim 1, characterized in that, The process of compiling the task processing function according to the first compilation method to obtain the first type of compilation result includes: Obtain the syntax tree structure corresponding to the task processing function; The syntax tree structure corresponding to the task processing function is converted into intermediate code corresponding to the first compiler corresponding to the first compilation method; The first compiler is invoked to compile the intermediate code to obtain the executable code corresponding to the task processing function, and the executable code is used as the first type of compilation result of the task processing function.

5. The method according to claim 1 or 4, characterized in that, The method further includes: When the task processing function is compiled according to the first compilation method to obtain a first type of compilation result, the executable code in the first type of compilation result is stored in a first cache space. The first cache space is a cache space in a multi-cache space. The executable code is obtained by compiling the target code data corresponding to the task processing function. The target code data is the code data in the source code data.

6. The method according to claim 1, characterized in that, The method further includes: The task processing function is compiled according to the second compilation method to obtain an instruction structure for at least one intermediate processing instruction for the task processing function; The instruction structure of the at least one intermediate processing instruction is determined as the second type of compilation result, and the instruction structure of the at least one intermediate processing instruction in the second type of compilation result is stored as the data structure in the second cache space of the multiple cache spaces.

7. The method according to claim 1, characterized in that, The executable code is stored in a first cache space among multiple cache spaces, and the data structure is stored in a second cache space, which is a cache space among the multiple cache spaces that is independent of the first cache space; The method further includes: Obtain the first executor corresponding to the first execution mode, and obtain the executable code from the first cache space through the first executor; Obtain a polling counter for polling processing. When the executable code is executed by the first executor associated with the main execution mode, the polling counter records the code execution time and the number of code executions. When the code execution time or the number of code executions reaches the polling condition configured by the polling counter, the second executor corresponding to the second execution mode is obtained, and the data structure is obtained from the second cache space through the second executor. When the data structure is executed through the second executor, the structure execution time and the number of structure executions obtained by executing the data structure are recorded by the polling counter. The first execution time is determined based on the number of times the code is executed and the execution duration of the code, and the second execution time is determined based on the execution duration of the structure and the number of times the structure is executed.

8. The method according to claim 7, characterized in that, The code execution count refers to the total number of executions corresponding to the main execution mode accumulated and recorded by the polling counter. The code execution time is obtained by accumulating the execution time obtained each time the first executor is used to execute the executable code by the polling counter. Determining the first execution time based on the number of code executions and the code execution duration includes: Obtain the ratio between the code execution time and the number of code executions; The ratio is used as the first execution time.

9. The method according to claim 1, characterized in that, The method further includes: Obtain the time difference threshold of the execution mode switching condition indication; and obtain the time difference data between the first execution time and the second execution time; If the time difference data is greater than or equal to the time difference threshold indicated by the execution mode switching condition, then it is determined that the time difference data between the first execution time and the second execution time has reached the execution mode switching condition.

10. The method according to claim 1 or 9, characterized in that, The method further includes: If the time difference between the first execution time and the second execution time does not meet the execution mode switching condition, then the primary execution mode remains the first execution mode, and the secondary execution mode remains the second execution mode.

11. The method according to claim 1, characterized in that, The method further includes: If the complexity of the function does not reach the complexity threshold indicated by the hierarchical compilation strategy, then the compilation method for the task processing function will be determined as the second compilation method indicated by the hierarchical compilation strategy. Obtain the syntax tree structure corresponding to the task processing function, use the second compiler corresponding to the second compilation method to compile the syntax tree structure corresponding to the task processing function, obtain the second type of compilation result including data structure, and store the second type of compilation result in the second cache space of the multiple cache space; Upon receiving a call request for the task processing function, the system obtains the second executor corresponding to the second execution mode of the second compilation method, retrieves the data structure from the second cache space through the second executor, and executes the data structure through the second executor to obtain the task execution result of the task processing function.

12. The method according to claim 1, characterized in that, The method further includes: Obtain the third execution time obtained by executing the data structure in the second type of compilation result using the main execution mode; and obtain the fourth execution time obtained by executing the executable code in the first type of compilation result using the secondary execution mode; If the time difference between the third execution time and the fourth execution time reaches the execution mode switching condition, then the first execution mode is updated to the primary execution mode, and the second execution mode is updated to the secondary execution mode.

13. A data processing apparatus, characterized in that, The device includes: The acquisition module is used to obtain the function complexity of the task processing function in the source code data; The determination module is used to determine the compilation method for the task processing function as the first compilation method indicated by the tiered compilation strategy if the complexity of the function reaches the complexity threshold indicated by the tiered compilation strategy. The processing module is used to compile the task processing function according to the first compilation method to obtain a first type of compilation result; The determining module is further configured to determine the first execution mode corresponding to the first compilation method used for the task processing function as the main execution mode, and to determine the second execution mode corresponding to the second compilation method in the layered compilation strategy as the secondary execution mode of the main execution mode; The acquisition module is further configured to acquire a first execution time obtained by executing the executable code in the first type of compilation result using the main execution mode, and to acquire a second execution time obtained by executing the data structure in the second type of compilation result using the slave execution mode; the data structure is obtained by compiling the task processing function according to the second compilation method; the number of executions in the main execution mode is greater than the number of executions in the slave execution mode; The update module is configured to update the second execution mode to the primary execution mode and the first execution mode to the secondary execution mode if the time difference data between the first execution time and the second execution time reaches the execution mode switching condition.

14. A computer device, characterized in that, The computer device includes: A processor, suitable for implementing one or more computer programs; and, A computer-readable storage medium storing one or more computer programs adapted to be loaded by the processor and executed as described in any one of claims 1-12.

15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more computer programs, which are adapted to be loaded by a processor and executed by the data processing method as described in any one of claims 1-12.

16. A computer program product, characterized in that, The computer program product includes a computer program stored in a computer-readable storage medium, a processor of a computer device reading the computer program from the computer-readable storage medium, and the processor executing the computer program to cause the computer device to perform the data processing method as described in any one of claims 1-12.