Task processing method and device, electronic equipment, medium and program product
By syntax parsing and serializing the program files on the server side, and generating binary data and sending them directly to the terminal, the complexity and time-consuming problem of terminal devices handling real-time tasks in a virtual machine environment is solved, and more efficient task processing is achieved.
Patent Information
- Application Number
- CN202410018322.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-04
- Publication Date
- 2025-07-04
AI Technical Summary
In the prior art, when a terminal device processes program files for real-time tasks through a virtual machine environment, it is necessary to convert the program files into an intermediate structure for compilation, resulting in complex and time-consuming processing flow, which increases the computing pressure and time-consuming of the terminal.
The program file to be executed is syntax parsed and serialized on the server side, generates binary data, and directly sent to the terminal for processing through the native data interface. The terminal can perform real-time tasks without compiling.
It reduces the computing pressure and time-consuming of the terminal, improves the response speed, reduces data transfer and memory overhead, and improves the processing efficiency of the terminal.
Smart Images

Figure CN120256039A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to a task processing method, apparatus, electronic device, medium, and program product. Background Art
[0002] Currently, many application programs use program files such as scripts to implement specific tasks, such as functions or effects. These program files can contain a series of code logics for executing specific tasks or operations. For example, JavaScript scripts can be used to implement interactive effects such as form validation, dynamic content loading, event handling, etc., to quickly implement various functions and be flexibly adjusted and extended according to requirements.
[0003] In the prior art, in order to facilitate the terminal to process tasks in real time, a virtual machine is often set up on the terminal device to interpret and process the program files of real-time tasks. However, since the virtual machine environment is isolated from the native environment of the terminal, it is often necessary to convert the program file into an intermediate structure such as JSON and then transfer it to the virtual machine environment for compilation processing, resulting in a complex and time-consuming process for processing the program file. Summary of the Invention
[0004] Embodiments of this application provide a task processing method, apparatus, electronic device, medium, and program product, which can reduce the computing pressure and time consumption of the terminal and improve the response speed of the terminal.
[0005] Embodiments of this application provide a task processing method applied to a server. The method includes: obtaining a to-be-executed program file of the real-time task according to the real-time task triggered by a target application running on the terminal, where the to-be-executed program file is a program file corresponding to a native data structure; performing syntax parsing on the to-be-executed program file to obtain a syntax structure representation of the to-be-executed program file; performing serialization processing on the syntax structure representation to obtain binary data; and sending the binary data to the terminal so that the terminal processes the binary data through a native data interface to process the real-time task, where the native data interface is an interface corresponding to the native data structure.
[0006] In some embodiments, after performing syntax parsing on the to-be-executed program file to obtain a syntax structure representation of the to-be-executed program file and before performing serialization processing on the syntax structure representation to obtain binary data, the method further includes: performing symbol parsing on the syntax structure representation to establish an index table of the syntax structure representation, where the index table stores the definition and reference relationships of symbols in the syntax structure representation, so that when the terminal processes the real-time task, it can query the definition and reference relationships of the symbols through the index table.
[0007] In some embodiments, after parsing the syntax of the program file to be executed to obtain a syntax structure representation of the program file to be executed, and before serializing the syntax structure representation to obtain binary data, the method further includes: optimizing the syntax structure representation to obtain an optimized syntax structure representation, so as to serialize the optimized syntax structure to obtain the binary data, where the structure optimization includes one or more of formal parameter optimization, inlining optimization, constant folding, and dead code elimination.
[0008] An embodiment of the present application provides a task processing method, which is applied to a terminal. The method includes: obtaining binary data corresponding to a real-time task triggered by a target application running on the terminal, where the binary data is obtained by a server processing a syntax structure representation of a program file to be executed for the real-time task, and the program file to be executed is a program file corresponding to a native data structure; performing deserialization processing on the binary data to obtain a syntax structure representation; parsing the syntax structure representation to load symbols in the syntax structure representation; based on the symbols, calling a native data interface corresponding to the target application, where the native data interface is an interface corresponding to the native data structure; and processing the real-time task through the native data interface.
[0009] In some embodiments, the real-time task includes a data update task. Processing the real-time task through the native data interface includes: obtaining, through the native data interface, operation data corresponding to the target application, where the operation data includes historical operation data and real-time operation data corresponding to the data update task; clustering the operation data according to the real-time operation data to obtain target operation data associated with the real-time operation data; classifying the target operation data to determine an update intention; and updating the target application according to the update intention.
[0010] In some embodiments, the real-time task includes an event integration task. Processing the real-time task through the native data interface includes: obtaining, through the native data interface, an original event sequence; integrating the original event sequence to obtain a processed event sequence; determining the priority of each event in the processed event sequence according to the historical operation data; sorting each event in the processed event sequence according to the priority to obtain a target event sequence, and sending the target event sequence to the server so that the server processes the target event sequence.
[0011] In some embodiments, before invoking the native data interface corresponding to the target application based on the symbol, it further includes: creating the native data interface, where the native data interface is related to the system type of the target application; mapping the native data interface to a preset interface specification to obtain a mapping relationship;
[0012] Processing the real-time task through the native data interface includes: determining the preset interface specification corresponding to the native data interface through the mapping relationship; and invoking the processing module corresponding to the native data interface to process the binary data according to the preset interface specification, where the processing module is a module common to multiple system types.
[0013] In some embodiments, before obtaining the binary data corresponding to the real-time task triggered by the target application running on the terminal, it further includes: generating a task request corresponding to the real-time task in response to a specified real-time event of the target application; and sending the task request to a server so that the server returns the binary data according to the task request.
[0014] An embodiment of the present application further provides a task processing device applied to a server. The device includes: a first acquisition unit for acquiring a program file to be executed for the real-time task according to the real-time task triggered by the target application running on the terminal, where the program file to be executed is a program file corresponding to a native data structure; a syntax parsing unit for performing syntax parsing on the program file to be executed to obtain a syntax structure representation of the program file to be executed; a serialization unit for performing serialization processing on the syntax structure representation to obtain binary data; and a sending unit for sending the binary data to the terminal so that the terminal processes the binary data through a native data interface to process the real-time task, where the native data interface is an interface corresponding to the native data structure.
[0015] An embodiment of the present application further provides a task processing device applied to a terminal. The device includes: a second acquisition unit for acquiring binary data corresponding to the real-time task triggered by the target application running on the terminal, where the binary data is obtained by the server processing the syntax structure representation of the program file to be executed for the real-time task, and the program file to be executed is a program file corresponding to a native data structure; an anti-serialization unit for performing anti-serialization processing on the binary data to obtain a syntax structure representation; a structure parsing unit for parsing the syntax structure representation to load symbols in the syntax structure representation; a calling unit for calling the native data interface corresponding to the target application, where the native data interface is an interface corresponding to the native data structure; and a processing unit for processing the real-time task through the native data interface.
[0016] An embodiment of the present application further provides an electronic device, including a processor and a memory, where the memory stores multiple instructions; the processor loads the instructions from the memory to execute the steps in any one of the task processing methods provided by the embodiments of the present application.
[0017] An embodiment of the present application further provides a computer-readable storage medium, which stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the steps in any one of the task processing methods provided by the embodiments of the present application.
[0018] An embodiment of the present application further provides a computer program product, including a computer program or instructions, and when the computer program or instructions are executed by a processor, the steps in any one of the task processing methods provided by the embodiments of the present application are implemented.
[0019] An embodiment of the present application can obtain a program file to be executed for the real-time task according to the real-time task triggered by the target application running on the terminal, where the program file to be executed is a program file corresponding to the native data structure; perform syntax parsing on the program file to be executed to obtain a syntax structure representation of the program file to be executed; perform serialization processing on the syntax structure representation to obtain binary data; send the binary data to the terminal so that the terminal processes the binary data through the native data interface corresponding to the native data structure to process the real-time task, and the native data interface is an interface corresponding to the native data structure.
[0020] In the present application, the program file to be executed for the real-time task of the target application is parsed into a syntax structure representation, and then serialized to obtain binary data and sent to the terminal. In this way, the terminal receives the binary data after syntax parsing. By calling the native data interface corresponding to the native data structure of the program file to be executed, the real-time task can be directly processed without further compilation, reducing the computing pressure and time consumption of the terminal and improving the response speed of the terminal. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative efforts.
[0022] Figure 1a is a schematic diagram of the scenario of the task processing method provided by the embodiment of the present application;
[0023] Figure 1b is a schematic flowchart of the task processing method provided by the embodiment of the present application;
[0024] Figure 2a It is a schematic flowchart of a task processing method provided by another embodiment of the present application;
[0025] Figure 2b It is a schematic diagram of a rearrangement display interface of a target application provided by an embodiment of the present application;
[0026] Figure 2c It is a schematic diagram of a recommended content display interface of a target application provided by an embodiment of the present application;
[0027] Figure 2d It is a schematic diagram of a content upload interface of a target application provided by an embodiment of the present application;
[0028] Figure 3a It is a schematic structural diagram of a task processing system provided by an embodiment of the present application;
[0029] Figure 3b It is a schematic flowchart of a task processing method provided by still another embodiment of the present application;
[0030] Figure 3c It is a schematic flowchart of yet another task processing method provided by still another embodiment of the present application;
[0031] Figure 3d It is a schematic diagram of the interaction between a program file system and a native environment provided by an embodiment of the present application;
[0032] Figure 3e It is a schematic diagram of a test comparison result provided by an embodiment of the present application;
[0033] Figure 4 It is a schematic structural diagram of a task processing device provided by an embodiment of the present application;
[0034] Figure 5 It is a schematic structural diagram of a task processing device provided by another embodiment of the present application;
[0035] Figure 6 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0036] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application.
[0037] Embodiments of the present application provide a task processing method, device, electronic device, medium, and program product.
[0038] Among them, the task processing device can be specifically integrated in an electronic device, which can be a device such as a terminal, a server, etc. Among them, the terminal includes but is not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, etc. Embodiments of the present invention can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, intelligent transportation, assisted driving, etc.; the server can be a single server or a server cluster composed of multiple servers.
[0039] In some embodiments, the task processing device can also be integrated in multiple electronic devices. For example, the task processing device can be integrated in multiple servers, and multiple servers are used to implement the task processing method of this application.
[0040] In some embodiments, the server can also be implemented in the form of a terminal.
[0041] For example, referring to Figure 1a , the content push method can be implemented by a server. The server can obtain a task request corresponding to a real-time task of a target application from a terminal through a network, and obtain a to-be-executed program file of the real-time task according to the real-time task triggered by the target application running on the terminal. The to-be-executed program file is a program file corresponding to a native data structure; perform syntax parsing on the to-be-executed program file to obtain a syntax structure representation of the to-be-executed program file; perform serialization processing on the syntax structure representation to obtain binary data; send the binary data to the terminal so that the terminal processes the binary data through a native data interface to process the real-time task, and the native data interface is an interface corresponding to the native data structure.
[0042] In the embodiments of the present application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of the overall module or unit that includes the function of the module or unit.
[0043] The following will be described in detail respectively. It should be noted that the order of the following embodiments does not limit the preferred order of the embodiments. It can be understood that in the specific implementation of the present application, when it comes to data related to users such as feature information and operations, when the embodiments of the present application are applied to specific products or technologies, user permission or consent needs to be obtained, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions.
[0044] In this embodiment, a task processing method is provided, such as Figure 1bAs shown, taking the application of this task processing method to a server as an example, the specific process of this task processing method can be as follows:
[0045] 110. Obtain the program file to be executed for the real-time task triggered by the target application running on the terminal. The program file to be executed is the program file corresponding to the native data structure.
[0046] Among them, the target application refers to the application program used to execute the program file. The target application can be various different applications, etc. Specifically, in the embodiments of this application, by running the target application on the terminal, the target application can be an independent application program such as a desktop application program or a mobile application program, or a non-independent application program such as a small program, a plugin or extension of other application programs, etc., which are embedded in other platforms or applications.
[0047] In practical applications, the task processing method provided in the embodiments of this application can be applied in different application scenarios. In different scenarios, the target application can vary according to specific requirements and different application scenarios. For example, the target application can be a social application, a video application, an e-commerce application or an education application, etc.
[0048] Among them, the real-time task refers to the task to be completed at the current time. For example, the real-time task can include types of tasks such as automation tasks, batch processing jobs or implementing specific functions of the target application. For example, in a specific application scenario, the real-time task can be a data update task, an event integration task, etc.
[0049] Among them, the program file refers to the executable file of the application program. The program file can be an executable file written in a specific descriptive language and in accordance with a certain format, such as a script. The program file to be executed refers to the executable file to be executed, that is, the program file to be executed is the program file used to process the real-time task.
[0050] Among them, the native data structure refers to the basic data type of the written program file. For example, the native data structure can be one or more native data structures defined in different programming languages, or a custom native data structure.
[0051] For example, the task processing method provided in the embodiments of this application can be applied to a server. The server can obtain the program file to be executed for the real-time task triggered by the target application from the server memory based on the request sent by the terminal, or based on some specific conditions, so as to send the processed program file to be executed to the terminal for the terminal to execute. For various target applications, the program file to be executed can contain a series of instructions, logics and algorithms so that the terminal can process the real-time task.
[0052] For example, in some embodiments, a to-be-executed program file of a target application may be obtained based on a request sent by a terminal. The request may be a request corresponding to a specific event sent by the terminal, and the to-be-executed program file is used to implement a task (i.e., a real-time task) corresponding to the specific event. For example, the specific event may be an event generated by a specific interaction operation between an object using the terminal and the target application. The interaction operation may include clicking a control, inputting text, etc. For example, an object using the terminal may click a specific control of the target application, and the terminal sends a request for obtaining a program file in response to the click operation, so that the server obtains a corresponding to-be-executed program file from the server memory according to the obtaining request. The to-be-executed program file may implement the function of the specific control clicked by the object using the terminal. For example, if the specific control is an upload control, the to-be-executed program file is used to process the operation and logic of the upload control, so that the terminal implements the upload function.
[0053] Again, in some embodiments, a to-be-executed program file of a target application may be obtained based on specific conditions. The to-be-processed program is used to implement a task (i.e., a real-time task) corresponding to the specific conditions. For example, the specific conditions may be conditions set based on factors such as time, update, etc. For example, in a content rearrangement scenario of the target application, the specific condition may be a rearrangement period or a content update of the rearrangement. In an event filtering and aggregation scenario of the target application, the specific condition may be an event update of the target application, and so on.
[0054] In some embodiments, the to-be-executed program file is a dynamic script, so that the terminal can execute corresponding script code (i.e., the to-be-executed program file) during operation to improve the efficiency and flexibility of real-time task processing. A dynamic script refers to code that can be dynamically loaded and executed at runtime. Specifically, the server may dynamically generate or select a corresponding script as a dynamic script according to the information and context of the real-time task. The dynamic script may include logic such as conditional judgment, loop, function call, etc., to be used for processing the real-time task.
[0055] 120. Perform syntax parsing on the to-be-executed program file to obtain a syntax structure representation of the to-be-executed program file.
[0056] Among them, syntax parsing refers to the process of parsing a string or code into various syntax phrases according to the syntax rules in the source language. The various syntax phrases obtained by the parsing are the syntax structure representations, and the syntax structure representations may be an Abstract Syntax Tree (AST). An abstract syntax tree is a tree-like structure used to represent the syntax structure of a programming language, where nodes represent operators or expressions, and child nodes represent operands or sub-expressions.
[0057] For example, lexical analysis can be performed on the program file to be executed first. Lexical analysis converts the character stream of the program file to be executed into tokens through a lexer. Tokens are the smallest units with syntactic meanings, such as keywords, identifiers, operators, etc. The goal of lexical analysis is to identify and extract tokens and remove unnecessary whitespace characters and comments. Then, syntactic analysis is performed on the obtained token sequence. Syntactic analysis converts the token sequence into an abstract syntax tree (AST) through a parser according to the syntax rules of the programming language.
[0058] In some embodiments, symbolic parsing of the syntactic structure representation can be performed on the server in advance, so that the terminal can directly execute the program file to be executed to process real-time tasks without having to perform the symbolic parsing process, thereby transferring complex computing tasks to the server, reducing the computing pressure and time consumption of the terminal, and improving the response speed of the terminal. Specifically, after performing syntactic parsing on the program file to be executed to obtain the syntactic structure representation of the program file to be executed, and before performing serialization processing on the syntactic structure representation to obtain binary data, it further includes:
[0059] Performing symbolic parsing on the syntactic structure representation to establish an index table for the syntactic structure representation. The index table stores the definition and reference relationships of symbols in the syntactic structure representation, so that when the terminal processes real-time tasks, it can query the definition and reference relationships of symbols through the index table.
[0060] Among them, symbolic parsing refers to the process of identifying symbols from the syntactic structure representation to establish an index table. Symbols can include identifiers of named entities such as variables and functions. The index table records information such as the type and scope corresponding to each symbol in the form of key-value pairs, and the symbol is the name of a symbol such as a variable or a function.
[0061] For example, the server can traverse the syntax elements represented by the syntax structure, identify all symbols such as variables and functions, and create an index table to store their information. When traversing the definition of a variable or function, its information is added to the index table. For a variable, information such as its name, type, and scope is recorded; for a function, information such as the function name, parameter list, return type, and scope is recorded to implement the symbol definition represented by the syntax structure. When traversing the reference to a variable or function, it is checked whether there is a definition of the symbol in the index table. If it exists, the relevant information of the symbol, such as type and scope, can be obtained. If it does not exist, it indicates that there is a reference error and error handling is required. At the same time, during the process of traversing the syntax elements represented by the syntax structure, the reference relationship of the symbols is recorded in the index table. For example, for a function call, the relationship between the caller and the called function can be recorded. Through pre-parsing and definition, based on the information in the index table, the legality, correct scope, and type of variables and functions can be ensured, potential errors can be discovered in advance, and preparatory work can be done for code execution, so that the terminal can accurately find and use these symbols through the definition and reference relationship of variable and function symbols in the index table during subsequent code execution. In addition, since different terminals may use different programming languages or development frameworks, the implementation methods and rules of symbol parsing may vary. By performing unified symbol parsing on the server, it can be ensured that all clients perform symbol parsing according to the same rules, reducing problems caused by parsing differences.
[0062] In some embodiments, the syntax structure representation can be structurally optimized in one or more ways to improve the processing efficiency of real-time tasks. Specifically, after performing syntax parsing on the program file to be executed to obtain the syntax structure representation of the program file to be executed, and before performing serialization processing on the syntax structure representation to obtain binary data, it further includes:
[0063] Structurally optimize the syntax structure representation to obtain an optimized syntax structure representation, so as to perform serialization processing on the optimized syntax structure to obtain binary data. The structural optimization includes one or more of formal parameter optimization, inlining optimization, constant folding, and dead code elimination.
[0064] Among them, structural optimization refers to optimizing the syntax structure representation to optimize the performance of the syntax structure representation.
[0065] For example, the server can process function parameters to reduce the number of parameter transmissions or reduce parameter copy operations when calling a function, so as to optimize the formal parameters and improve the processing efficiency of real-time tasks. For example, commonly used parameters can be saved in registers to avoid reloading them every time a function is called. The server can directly insert the function body at the function call site to avoid the overhead of function calls, so as to achieve inlining optimization and improve the processing efficiency of real-time tasks. This is applicable to functions that are frequently called and have a small function body. The server can calculate and simplify the constants in the expression and directly replace the original expression with the result, so as to achieve constant folding, thereby reducing the computational amount at runtime and improving the processing efficiency of real-time tasks. The server can identify, through static analysis, the code in the source code that has no actual effect, such as code that will not be executed and code that will not affect the program output, and delete it from the target code, so as to achieve dead code elimination, reduce the redundant process of processing real-time tasks, and thus improve the processing efficiency of real-time tasks.
[0066] 130. Serialize the syntactic structure representation to obtain binary data.
[0067] Among them, serialization processing refers to the process of converting the syntactic structure representation into binary data. Binary data refers to the data representation form composed of 0 and 1.
[0068] For example, according to a preset binary format such as Protocol Buffer, FlatBuffer, MessagePack, or a custom binary format, etc., select the serialization library corresponding to the binary format to convert each field in the syntactic structure representation into the data types supported by the serialization format, and convert it into binary data.
[0069] 140. Send the binary data to the terminal so that the terminal can process the binary data through the native data interface to process real-time tasks. The native data interface is the interface corresponding to the native data structure.
[0070] Among them, the interface, that is, Application Programming Interface, abbreviated as API, refers to the convention and specification for communication and interaction between different components in a software system. The API defines a set of available methods, functions, protocols, and tools to implement various functions and services without directly accessing the underlying code or data. The native data interface can include a set of operation methods or functions corresponding to the native structure. It defines how to use and process the native data structure, including operations such as creating, reading, updating, and deleting data. In this way, the native data interface provides a set of specifications and conventions, enabling the program to effectively operate and manage the native data structure.
[0071] For example, the terminal can use the tools and libraries provided by the programming language to process binary data, convert the binary data into a readable data format, or perform specific operation processes to execute the program file to be executed and implement corresponding real-time tasks. Among them, the tools and libraries provided by the programming language include a set of operation methods or functions corresponding to the native structure (i.e., the native data interface).
[0072] In some embodiments, when sending the binary data to the terminal, the index table represented by the syntax structure can be sent to the terminal together to reduce the number of communications between the server and the terminal, improve the transmission efficiency, and reduce the network overhead.
[0073] For example, in some embodiments, the syntax structure representation and the index table represented by the syntax structure can be serialized to obtain binary data containing the syntax structure representation and the index table represented by the syntax structure. In this way, the server transmits the binary data corresponding to the program file to be executed and the binary data of the corresponding index table to the terminal together to reduce the number of communications between the server and the terminal, improve the transmission efficiency, and reduce the network overhead.
[0074] The program file processing solution provided by the embodiments of this application can be applied to various application program scenarios. For example, taking a social application as an example, according to the real-time task triggered by the target application running on the terminal, obtain the program file to be executed for the real-time task. The program file to be executed is the program file corresponding to the native data structure; perform syntax parsing on the program file to be executed to obtain the syntax structure representation of the program file to be executed; perform serialization processing on the syntax structure representation to obtain binary data; send the binary data to the terminal so that the terminal can process the binary data through the native data interface to process the real-time task. The native data interface is the interface corresponding to the native data structure.
[0075] As can be seen from the above, the embodiments of this application parse the program file to be executed for the real-time task of the target application into a syntax structure representation, and then perform serialization processing to obtain binary data and send it to the terminal. In this way, the terminal receives the binary data after syntax parsing. By calling the native data interface corresponding to the native data structure of the program file to be executed, it can process the real-time task without further compilation, reducing the computing pressure and time consumption of the terminal and improving the response speed of the terminal.
[0076] In this embodiment, a task processing method is provided, as Figure 2a shown. Taking the application of this task processing method to the terminal as an example, the specific process of this task processing method can be as follows:
[0077] 210. Obtain the binary data corresponding to the real-time task triggered by the target application running on the terminal.
[0078] The binary data is represented by the syntax structure of the program file to be executed for the real-time task processed by the server, and the program file to be executed is the program file corresponding to the native data structure. For example, when the terminal runs the target application and needs to process any real-time task of the target application, it can obtain the binary data obtained by the server's processing of the program file to be executed for the real-time task. The processing process of the server can refer to the foregoing embodiments and will not be elaborated here.
[0079] In some embodiments, a task request can be sent to the server in response to a specified real-time event, and the binary data returned by the server can be obtained, so that the terminal can process the real-time task corresponding to the specified real-time event in real time through the binary data, so as to achieve flexible and real-time task processing on the terminal and improve the response ability to real-time events. Specifically, before obtaining the binary data corresponding to the real-time task triggered by the target application running on the terminal, it further includes:
[0080] Generating a task request corresponding to the real-time task in response to the specified real-time event of the target application;
[0081] Sending the task request to the server so that the server can return the binary data according to the task request.
[0082] Among them, the real-time event refers to an event that needs to be processed immediately when it occurs. For example, the real-time event can include one or more of a data update event, a user operation event, a system status event, and a time trigger event, etc. The specified real-time event is a real-time event set according to actual needs or application scenarios. The specified real-time event corresponds to a real-time task, that is, when the specified real-time event occurs, the real-time task is used to respond to and process the specified real-time event.
[0083] Among them, the task request is a request to the server to request the binary data corresponding to the real-time task. For example, the task request can include a request type, parameters, context information, and client information, etc. Among them, the request type is used to indicate the operation type for the server to obtain the binary data of the program file to be executed, such as "obtain dynamic script"; the parameters include any parameters or configuration information required to obtain the dynamic script, such as specific actions to be executed, attributes of the event, relevant data, etc.; the context information can include context information such as the device information and session status of the current terminal, so that the server can generate the corresponding program file to be executed according to different situations; the identifier is used to uniquely identify the required program file to be executed, such as the identifier can be the name, ID or other identifier of the script; the client information can include information about the source of the request, such as the IP address of the client, etc.
[0084] For example, when the terminal detects a specified real-time event, it can generate a task request for a real-time task used to respond to and process the specified real-time event (i.e., a real-time task triggered by the target application running on the terminal), and serialize and transmit the task request to the server in JSON or other formats. After receiving the task request, the server parses the parameters and data therein to dynamically generate or select a corresponding program file to be executed (i.e., obtain the program file to be executed for the real-time task), and obtain the binary data of the program file to be executed, and return the binary data to the terminal.
[0085] In practical applications, real-time tasks can include various tasks. For example, real-time tasks can include data update tasks, event integration tasks, etc. Data update tasks can include rearrangement tasks, upload tasks, etc. Taking the rearrangement task as an example of a real-time task, the specified real-time event includes a rearrangement content update event such as a user refresh operation, a user opening the application home page and other specific operations or specific time points such as reaching the rearrangement period. Taking the upload task as an example of a real-time task, the specified real-time event includes a user's upload operation. Taking the event integration task as an example of a real-time task, the specified real-time event includes detecting at least one pending event to be sent to the server for processing, or reaching a specific time point, etc. For example, when the user performs a specific operation, a real-time task such as a rearrangement task or an upload task is triggered. For another example, when a specific time point is reached, an event integration task is triggered.
[0086] 220. Perform deserialization processing on the binary data to obtain a syntax structure representation.
[0087] Among them, deserialization processing refers to the process of restoring binary data into a syntax structure representation.
[0088] For example, after receiving the binary data corresponding to the program file to be executed, the terminal can use the object deserialization method provided by the corresponding deserialization library or framework to restore the binary data into a syntax structure representation. For example, in Java, the readObject() method of the ObjectInputStream class can be used for object deserialization; in Python, the load() function of the pickle module can be used for object deserialization.
[0089] In some embodiments, when the binary data includes a syntax structure representation and the binary data of the syntax structure representation, performing deserialization processing on the binary data can obtain a syntax structure representation and an index table of the syntax structure representation.
[0090] 230. Parse the syntax structure representation to load the symbols in the syntax structure representation.
[0091] The parsing process of the syntax structure representation can be the interpretation process of the syntax structure representation. For example, the terminal can traverse the syntax structure representation, identify symbols such as variables and functions therein, and load the identified variables, functions, etc. into the memory for subsequent code analysis and execution.
[0092] 240. Based on the symbols, call the native data interface corresponding to the target application, where the native data interface is the interface corresponding to the native data structure.
[0093] For example, the terminal can, according to the requirements of the real-time task, call the native data interface corresponding to the target application through the variables, functions, etc. symbols pre-loaded into the memory to perform corresponding operations such as calculation, data storage, network communication, etc. to process the real-time task. For example, for real-time tasks such as data update tasks and event integration tasks, the terminal can, according to the variables, functions, etc. symbols loaded into the memory, process corresponding data update, event integration, etc. calculation processes, and obtain the result of the terminal processing the real-time task, that is, the terminal processing result.
[0094] 250. Process the real-time task through the native data interface.
[0095] For example, some common functions of the target application such as file operations, network requests, encryption and decryption, etc. can be encapsulated into native data interfaces and registered in the global environment of the terminal to build a preset API (Application Programming Interface) set. After the terminal loads and identifies the variables, functions, etc. symbols in the syntax structure representation into the memory, it can use the variables, functions, etc. symbols loaded into the memory to call the corresponding API methods (i.e., native data interfaces) in the preset API set to process the real-time task. When the API finishes processing the real-time task, it will return the result to the application program, and these results can be the values of variables, the return values of functions, or other data. The application program can use these results to update the UI interface, generate reports, or perform other operations to process the real-time task.
[0096] In some embodiments, a mapping relationship between the native data interface and the preset interface specification can be established to call a cross-system general native module to improve code reusability, scalability, and unified data processing logic, and increase the flexibility, maintainability, and utilization rate of code data. Specifically, before calling the native data interface corresponding to the target application based on the symbols, it further includes:
[0097] Create a native data interface, where the native data interface is related to the system type of the target application;
[0098] Map the native data interface to the preset interface specification to obtain the mapping relationship;
[0099] Processing the real-time task through the native data interface includes:
[0100] Determine the preset interface specification corresponding to the native data interface through the mapping relationship;
[0101] According to the preset interface specification, call the processing module corresponding to the native data interface to process the binary data. The processing module is a module that is common to multiple system types.
[0102] Among them, the system type of the target application refers to the specific environment or platform on which the application program runs. For example, the target application is an application program based on the operating system of the terminal. Therefore, the system type of the target application can be the type of the operating system of the terminal, such as the types of operating systems such as Android and iOS.
[0103] Among them, the preset interface specification refers to a set of interface methods and rules for describing how to use and access the functions and behaviors of the processing module. The processing module refers to a set of code logics that are common to multiple system types and are used to implement specific functions or behaviors. The processing model is usually defined in the interface specification and is implemented by specific implementation classes.
[0104] For example, the native data interface applicable to the system type can be created in advance according to the system type of the target application. This interface can define methods for reading, writing, modifying, etc. the binary data of the program file to be executed. Then map the native data interface to the preset interface specification to establish an association relationship between them, so as to ensure that when the native data interface is called, the correct preset interface specification is used for operation. In this way, when the terminal processes the implementation task, the preset interface specification corresponding to the native data interface can be determined according to the mapping relationship. This specification describes how to call and use the native data interface and the expected output and behavior. Then, according to the preset interface specification, call the general processing module corresponding to the data processing logic of the native data interface to process the binary data.
[0105] It can be understood that there can be multiple processing modules corresponding to different data processing logics. Each processing module can be used to process the same data processing logic of different system types, such as data processing logics such as decoding, encryption, and compression. For example, for any data processing logic such as compression in a real-time task, the native data interfaces created by different system types are different, but when the terminals of different system types process this real-time task, the same processing module can be called through the mapping relationship between the native data interface and the preset interface specification to process this data processing logic. In this way, by establishing the mapping relationship between the native data interface and the preset interface specification, a general native module across systems can be called to improve code reusability, scalability, and unified data processing logic, and increase the flexibility, maintainability, and utilization rate of code data.
[0106] In some embodiments, real-time tasks can be processed based on an index table represented by a syntax structure. For example, real-time tasks can be processed based on the index table and an application programming interface. Specifically, the terminal API will utilize the symbol information in the index table to process real-time tasks. For instance, when the API needs to access a certain variable defined in the program, it can use the variable address stored in the index table to obtain the value of the variable. Similarly, when the API needs to call a certain function defined in the program, it can use the function address stored in the index table to call the function.
[0107] In some embodiments, real-time operation data can be clustered with historical operation data to discover target operation data associated with the real-time operation data, thereby using more associated data to provide more basis for determining an update intention, increasing the accuracy of determining the update intention, and providing an update result for the target application that better meets the current data update task. Specifically, the real-time task includes a data update task, and the real-time task is processed through a native data interface, including:
[0108] Through the native data interface, obtain the operation data corresponding to the target application, where the operation data includes historical operation data and real-time operation data corresponding to the data update task;
[0109] According to the real-time operation data, cluster the operation data to obtain target operation data associated with the real-time operation data;
[0110] Classify the target operation data to determine the update intention;
[0111] Update the target application according to the update intention.
[0112] Among them, the data update task refers to the task of updating data for the target application. For example, the data update task can include one or more of rearrangement tasks, upload tasks, etc.
[0113] Among them, the real-time operation data refers to the operation data of the operation (i.e., real-time operation) that triggers the data update task. For example, taking the real-time task as a rearrangement task, the real-time operation data can include data of specific operations that trigger specified real-time events such as user refresh operations, user opening the application home page, etc., such as operation time, filtering conditions such as region, type, content keywords, etc., and the filtering conditions can be obtained from user input or the target application's marked information about the user; taking the real-time task as an upload task, the real-time operation data can include data of user upload operations, such as uploaded videos, titles of the videos, video classifications, associated topics, and release times, etc.
[0114] Among them, historical operation data refers to the operation data of operations before real-time operations (i.e., historical operations). For example, the historical operation data can be the operation data within a historical time period before the real-time operation, and this historical time period can be set according to actual requirements or application scenarios. For example, the historical time period can include one hour, one day, or one month before the real-time operation, etc. For example, the historical operation data can include the operation data of the user's historical operations on the target application within the past day. For example, any historical operation data can include the operation time, filtering conditions, comment information, etc. of this historical operation, and this historical operation can include any operation of the user on the target application, such as viewing operations, comment operations, refresh operations, upload operations, etc.
[0115] Among them, clustering processing refers to the process of dividing operation data into groups with similar characteristics through clustering algorithms. For example, clustering algorithms can include, but are not limited to, one or a combination of more than one of the K-means clustering algorithm, density clustering algorithm, mean shift clustering algorithm, etc. For example, the operation data of any operation can be used as a data point in the clustering processing. The operation data of the real-time operation and the operation data of multiple historical operations are clustered to obtain multiple groups, and each group includes at least one data point. The operation data of the operations within the group where the data point corresponding to the operation data of the real-time operation is located can be used as the operation data of the target operation (i.e., the target operation data). In this way, through the clustering processing of the operation data, one or more historical operations that are most relevant to the real-time operation within the historical time period can be grouped together to determine the target operation data related to the real-time operation data.
[0116] Among them, classification processing refers to the process of classifying the attributes of the target operation data to determine the corresponding update intention. For example, methods such as a pre-trained classification network model and a linear regression model can be used to evaluate the target operation data to obtain the update intention. The pre-trained classification network model can include, but is not limited to, one or a combination of more than one of the multi-layer perceptron (MLP), convolutional neural network (CNN), recurrent neural network (RNN), long short-term memory network (LSTM), etc.
[0117] Among them, the update intention refers to the specific operation of the data update task to be executed. For example, taking the real-time task as a rearrangement task, the update intention can be the rearrangement order or priority, etc.; taking the real-time task as an upload task, the update intention can be an upload decision, such as whether to upload or whether to upload in advance.
[0118] For example, taking the real-time task as the rearrangement task, in response to the user's refresh operation on the home page content (i.e., the rearranged content) of the running target application, the terminal generates a task request corresponding to the rearrangement task and sends the task request to the server so that the server returns binary data according to the task request. The terminal performs deserialization processing on the binary data, parses to obtain symbols, and based on the symbols, calls the corresponding native data interfaces. The historical operation data and real-time operation data are obtained through the native data interfaces, and the processing module determines the target operation data related to the real-time operation data through clustering processing. After encoding the target operation data, it is classified through a pre-trained classification network model such as a multi-layer perceptron to output a probability value, and the category corresponding to the probability value is used as the update intention, such as the update intention being the priority of different types of rearranged content. In this way, multiple rearranged contents can be arranged in the rearrangement display interface of the target application as shown in Figure 2b according to the priority, and the rearranged priority order (Rearranged Video 1 - Rearranged Video 6) is displayed in the layout on the home page of the target application to update the target application running on each terminal in real time and flexibly. Or, as shown in Figure 2c the recommended content display interface of the target application, the content with the highest priority in the rearranged content, such as Video A, is displayed on the recommended page of the target application. In this way, personalized recommendations can be realized for the object of the using terminal according to the feature information, so as to increase the diversity of the target application displayed on different terminals.
[0119] Another example, taking the real-time task as the upload task, the user can perform an upload operation in the content upload interface of the target application as shown in Figure 2d , such as uploading Video B from local storage, inputting the title of Video B, and setting the video classification, associated topics, and release time of Video B, etc. In response to the user's upload operation during running, the terminal generates a task request corresponding to the upload task and sends the task request to the server so that the server returns binary data according to the task request. The terminal performs deserialization processing on the binary data, parses to obtain symbols, and based on the symbols, calls the corresponding native data interfaces. The historical operation data and real-time operation data are obtained through the native data interfaces, and the processing module determines the target operation data related to the real-time operation data through clustering processing. After encoding the target operation data, it is classified through a pre-trained classification network model such as a multi-layer perceptron to output a probability value, and the category corresponding to the probability value is used as the update intention, such as the update intention being to help the user upload the content to the server in advance. In this way, Video B in the local storage can be uploaded to the server in advance before the user clicks the "Publish" control in the content upload interface, so as to decide whether to help the user upload the content to the server in advance through the update intention and improve the conversion rate.
[0120] In some embodiments, by pre-integrating events in the terminal for an event sequence, the event sequence can be simplified and data redundancy can be reduced, so as to improve the effect of event sequence transmission and processing, greatly reduce the server computing and storage costs, and improve real-time performance at the same time. At the same time, sort the event sequence according to historical operation data to give priority to processing the events most relevant to user operations, improve the response speed of such events, and enhance the user interaction experience. Specifically, the real-time tasks include event integration tasks. Through the native data interface, the real-time tasks are processed, including:
[0121] Obtain the original event sequence through the native data interface;
[0122] Integrate events for the original event sequence to obtain a processed event sequence;
[0123] Determine the priority of each event in the processed event sequence according to historical operation data;
[0124] Sort each event in the processed event sequence according to the priority to obtain a target event sequence, and send the target event sequence to the server for the server to process the target event sequence.
[0125] Among them, the original event sequence refers to the sequence composed of events to be sent to the server for processing. The events in the original event sequence can be various types of events, specifically depending on the application scenario and requirements. For example, the events in the original event sequence can include but are not limited to user events, system events, log events, location events, network events, etc.
[0126] Among them, event integration refers to the process of merging events with the same attributes or relevance, such as merging consecutive events of the same type into one event.
[0127] Among them, the priority of an event refers to the urgency of processing the event. For example, the priority can be represented by the relevance between historical operation data and the event. Specifically, methods such as information matching method and machine learning can be used to determine the relevance between historical operation data and the event. For example, the information matching method can compare the information in the historical operation data with the corresponding information of the event, determine the number of information in the historical operation data that matches each event, and use the number of timestamps as the priority of the event. The more the number of timestamps, the higher the priority. Among them, the information used for matching in the information matching method can include but are not limited to one or more of timestamps, types, keywords, etc. For example, timestamps with the same timestamp or a time interval less than a preset time interval can be regarded as matching, and the same or similar types or keywords can be regarded as matching.
[0128] For example, when the terminal detects multiple pending events to be sent to the server for processing, the terminal can generate a task request corresponding to the event integration task and send the task request to the server, so that the server returns binary data according to the task request. The terminal performs deserialization processing on the binary data, parses to obtain symbols, and calls the corresponding native data interface based on the symbols. The original event sequence and historical operation data are obtained through the native data interface, and the processing module determines the correlation between the historical operation data and each event in the processed event sequence, uses the correlation as the priority of each event, sorts each event according to the correlation from high to low, and uses the sorted event sequence as the target event sequence. The target event sequence is sent to the server, so that the server processes the events in the target event sequence in order according to the order of the events in the target event sequence and the correlation from high to low. In this way, by integrating events in the event sequence, the event sequence can be simplified and data redundancy can be reduced to improve the effect of event sequence transmission and processing. At the same time, the event sequence is sorted according to the historical operation data to give priority to processing the events most relevant to the user operation, improve the response speed of such events, and enhance the user interaction experience.
[0129] In practical applications, real-time tasks can be divided into local task types or remote task types, etc. Among them, the local task type refers to the task processed by the terminal, and the remote task refers to the task that requires the participation of the server for processing. In the embodiment of the present application, part of the remote task type of task is processed by the terminal and part is processed by the server.
[0130] In some embodiments, when the real-time task is of the local task type, the target application running on the terminal can be directly updated according to the terminal processing result, so as to update the target applications running on each terminal in real time and flexibly, and increase the diversity of the target application displayed on different terminals. Among them, the terminal processing result refers to the result of the terminal processing the real-time task. For example, in the rearrangement task, the terminal processing result may include an update intention, and the terminal can update the content of the target application according to the update intention.
[0131] In some embodiments, when the real-time task is of the remote task type, the terminal processing result can be returned to the server, and then the server completes the real-time task based on the terminal processing result, so as to flexibly utilize the computing resources of the terminal and the server and achieve the efficient utilization of the computing resources. For example, in the upload task, the terminal processing result may include an update intention, the terminal can initiate a connection request to the server according to the update intention and establish a connection, and the terminal can upload the upload content corresponding to the user upload operation to the server through the established connection. Another example is that in the event integration task, the terminal processing result may include a target event sequence, and the terminal can return the target event sequence to the server for processing.
[0132] The program file processing solution provided by the embodiments of this application can be applied to various application scenarios. For example, taking a social application as an example, obtain the binary data corresponding to the real-time task triggered by the target application running on the terminal. The binary data is obtained by representing the syntax structure of the to-be-executed program file for processing the real-time task by the server. The to-be-executed program file is the program file corresponding to the native data structure; perform deserialization processing on the binary data to obtain the syntax structure representation; parse the syntax structure representation to load the symbols in the syntax structure representation; based on the symbols, call the native data interface corresponding to the target application. The native data interface is the interface corresponding to the native data structure; process the real-time task through the native data interface.
[0133] As can be seen from the above, in the embodiments of this application, the binary data after syntax parsing corresponding to the to-be-executed program file can be deserialized into a syntax structure representation. In this way, when the terminal processes a real-time task, by calling the native data interface corresponding to the native data structure of the to-be-executed program file, it can process the real-time task without further compilation, reducing the computing pressure and time consumption and improving the response speed.
[0134] According to the method described in the above embodiments, further detailed description will be given below.
[0135] In this embodiment, taking the terminal stream processing scenario applied to a video application as an example, the method of the embodiments of this application will be described in detail.
[0136] The task processing method provided by the embodiments of this application can be implemented by a task processing system. As Figure 3a shown in the structural schematic diagram of the task processing system, the task processing system may include a compilation module and a running module. Among them, the compilation module is deployed on the server, and the server may be a cloud server. The running module is deployed on the terminal. In the embodiments of this application, the to-be-executed program file is a dynamic script, and the program file system may be a script engine (JSY).
[0137] The compilation module includes a semantic definition sub-module (DSL template module), a compilation sub-module, and a serialization sub-module. Among them, the semantic definition sub-module can be used to perform DSL language definition. In addition to the naturally built-in main language JSY, the DSL template module can also extend other languages. The server can perform syntax and lexical analysis and syntax tree generation through the semantic definition sub-module. The compilation sub-module can be used for symbol parsing and definition, and syntax tree compilation optimization. The serialization sub-module can be used for binaryization of the syntax tree.
[0138] The running module includes a deserialization sub-module, a running sub-module, and an injection management sub-module. Among them, the deserialization sub-module can be used for binary reduction of the syntax tree. The running sub-module can be used for interpretive execution of the syntax tree, and the injection management sub-module can be used to manage the API set of the native environment, specifically including Native (local) method management and Native variable management.
[0139] Both the compilation module and the running module follow a predefined syntax tree definition. The syntax tree definition includes symbol definition (including externally injected symbols), scope definition, variable storage Space definition, and syntax tree node definition to support the syntax and lexical analysis and syntax tree generation process in the compilation module and the interpretive execution process of the syntax tree in the running module.
[0140] Such as Figure 3b shown, the specific process of a task processing method is as follows:
[0141] 310. The terminal responds to a specified real-time event of the target application, generates a task request corresponding to the real-time task, and sends the task request to the server.
[0142] 320. The server receives the task request to obtain the program file to be executed for the real-time task according to the real-time task of the target application.
[0143] For example, when the terminal runs a video application and detects a specified real-time event, it can generate a task request for the real-time task used to respond to and process the specified real-time event, and serialize and transmit the task request in JSON or other formats to the server. After receiving the task request, the server parses the parameters and data therein to dynamically generate or select the corresponding program file to be executed.
[0144] 330. The server performs syntax parsing on the program file to be executed to obtain the syntax structure representation of the program file to be executed.
[0145] Such as Figure 3c shown in the flowchart of the task processing method, this task processing method can be divided into a language definition stage, a compilation stage, a publishing stage, and a running stage. For example, in the semantic definition stage, the server can pre-define the DSL language through the DSL template module (i.e., the semantic definition sub-module). In addition to the naturally built-in main language JSY, the DSL template module allows the business to write grammar files by itself to expand other languages to adapt to the script language preferences of different businesses. For example, languages A and B can be predefined in advance. Thus, as Figure 3cAs shown, the server can use the DSL template module to perform lexical analysis (Antlr4) on the dynamic script source code in different languages such as Language A and Language B, perform syntax parsing, and generate a unified syntax tree, so as to obtain an AST abstract syntax tree (i.e., a syntax structure representation) from the unified syntax tree. Among them, a Lexer lexical analyzer can be used for lexical analysis, and a Parser compiler can be used for syntax parsing.
[0146] For example, in order to extremely compress the information density of the AST abstract syntax tree and further reduce the cost of parsing the AST abstract syntax tree during the terminal runtime, the AST abstract syntax tree will not be directly sent to the terminal, but will first go through a compilation optimization pipeline in the compilation module of the server to obtain an optimized AST abstract syntax tree (i.e., an optimized syntax structure representation). As Figure 3c shown, during the compilation stage, the server can perform symbol parsing and definition such as symbol parsing and symbol definition on the generated unified AST abstract syntax tree through the compilation sub-module, and perform syntax tree compilation optimization such as inlining parameter optimization, inlining function optimization, dead code elimination, constant folding, etc. Specifically, after the server performs syntax parsing on the program file to be executed and obtains the syntax structure representation of the program file to be executed, it also includes: the server performs symbol parsing (i.e., symbol parsing and definition) on the syntax structure representation and establishes an index table for the syntax structure representation. The index table stores the definition and reference relationships of symbols in the syntax structure representation, so that when the terminal processes real-time tasks, it can query the definition and reference relationships of symbols through the index table. The server performs structural optimization (syntax tree compilation optimization) on the syntax structure representation to obtain an optimized syntax structure representation, so that the server can perform serialization processing on the optimized syntax structure to obtain binary data.
[0147] Thus, in the embodiment of the present application, through the script engine (JSY), while maintaining the advantages of dynamic scripts, a large amount of work is advanced to the compilation module, and a series of optimization measures are implanted, such as pre-parsing and defining variables and function symbols for the script source code, saving query time through indexation (i.e., the index table of the syntax structure representation). While completing the first round of pruning and compression of the source AST abstract syntax tree, the information density of the new AST abstract syntax tree is higher. In terms of detailed implementation, through means such as parameter optimization, inlining optimization, constant folding, and dead code elimination, the parsing cost of the AST abstract syntax tree is further reduced, and the cost of interpretation and execution during the runtime is greatly reduced.
[0148] 340. The server performs serialization processing on the optimized syntax structure to obtain binary data.
[0149] For example, as Figure 3cAs shown in the figure, during the compilation phase, the server can serialize the optimized AST syntax tree through the serialization sub-module (i.e., binary-ize the syntax tree) to obtain a syntax binary file (i.e., binary data). The binary data can be in the FlatBuffer format. FlatBuffer is an efficient binary serialization library with high performance and low memory footprint, thus having good deserialization performance in the terminal.
[0150] 350. The server sends the binary data to the terminal.
[0151] For example, as Figure 3c shown in the figure, during the distribution phase, the server can send the script source code file (i.e., binary data) after a series of optimization processes to the terminal through the Content Delivery Network (CDN). In actual applications, this step can be automatically completed through the release verification pipeline.
[0152] 360. The terminal performs deserialization processing on the binary data to obtain a syntax structure representation.
[0153] 370. The terminal parses the syntax structure representation to load the symbols in the syntax structure representation.
[0154] 380. The terminal calls the native data interface corresponding to the target application based on the symbols;
[0155] 390. The terminal processes real-time tasks through the native data interface.
[0156] For example, as Figure 3c shown in the figure, during the running phase, after the App (i.e., video application) running on the terminal is started, it can deserialize the script binary data file through the deserialization sub-module of the terminal (i.e., restore the binary syntax tree), then parse the AST abstract syntax tree through the running sub-module and load symbols such as variables and functions into memory (i.e., interpret and execute the syntax tree), and inject the API set that comes with the native platform (i.e., terminal environment) through the injection management sub-module, specifically including Native method management and Native variable management, and interpret and execute the code through interaction with Native access to process the corresponding real-time tasks.
[0157] Accordingly, embodiments of the present application can deploy the compilation process of code (i.e., the syntax parsing and serialization processing process) in the compilation module of the server, and deploy the interpretation process of code (i.e., the parsing of the syntax structure representation and the native interface call and processing process) in the running module of the terminal, so as to separate interpretation from compilation, implement an extremely minimalist interpreter on the terminal, reduce the computing pressure and time consumption of the terminal. At the same time, an extremely minimalist interpreter is implemented based on the native data interface, maintaining a running environment consistent with the native at runtime, achieving data memory sharing, supporting direct access to native data structures on the script side, and improving the response speed of the terminal.
[0158] In addition, embodiments of the present application parse the AST and load symbols such as variables and functions into memory, and inject a set of APIs that are ready to use on the native platform, so as to call a general processing module through the interface specification corresponding to the native data interface in a top-level injection manner, so as to expand the native API access capability and make the native interface call during script runtime lossless. For example, as Figure 3dSchematic diagram of the interaction between the shown program file system and the native environment. In the native environment, the terminal can detect real-time events corresponding to user behaviors such as liking, exposure, swiping, and playing in the video application. Taking the detection of the user's play behavior for any video as an example, relevant data of this play behavior, such as native data structures like NSDictionary, NSArray, NSBlock, and id, can be obtained and stored in memory for use when executing code. When the terminal detects a specified real-time event such as a play behavior, the dynamic script code of this play behavior can be lexically parsed and syntactically parsed through the compilation module of the server to generate a syntax tree. Then, through processes such as syntax tree structure reconstruction, symbol parsing, symbol definition, symbol indexation (i.e., establishing an index table represented by the syntax structure), syntax tree compilation, and serialization, the binary data is sent to the terminal. The terminal restores the syntax tree through deserialization and loads the syntax tree, and then it is interpreted by the interpreter within the terminal. In the terminal interpreter, the nodes of the syntax tree can be traversed (i.e., node traversal) to perform specific operations or functions (i.e., node execution) on each node in the tree structure, and operations such as reading, writing, allocating, and releasing memory (i.e., memory operations) can be performed, and functions can be called to execute corresponding code blocks (i.e., function execution). Specifically, during the process of traversing the syntax tree, n nodes such as FuncA and FuncB in the syntax tree can be traversed based on the global scope (Global Scope) (i.e., node traversal). In memory operations, a global space (Global Space) can be set in memory to store global variables and global functions, and a local memory (Local Memory) and a stack (Stack) can be set in memory to implement a local space (Local Space). The local memory is the memory space used for each function execution, and the stack is used to manage function calls and local memory spaces. When the terminal interpreter interprets the restored syntax tree, it can provide the interpreter with the ability to access the native platform (i.e., the native environment) by calling the API set of the native environment.
[0159] Among them, if the real-time task is a local task, the target application running on the terminal is updated according to the terminal processing result of the local task. If the real-time task is a remote task, the terminal processing result of the remote task is sent to the server.
[0160] For example, the script engine (JSY) can be applied to the terminal stream processing and end-side intelligence scenarios of video applications, mainly including three categories of scenarios: end-cloud rearrangement (i.e., real-time tasks are rearrangement tasks). In the information flow scenarios of long and short videos, a terminal sorting system is built based on JSY to complete the real-time collection and processing of feature information, and perform real-time end-side rearrangement on the content returned by the cloud to improve the recommendation effect; intelligent decision-making (i.e., real-time tasks are intelligent decision-making tasks). In the scenario where users upload pictures and videos, real-time intention analysis is performed through JSY to decide whether to help users upload content in advance and improve conversion; big data cost reduction and efficiency improvement (i.e., real-time tasks are filtering and aggregation tasks). JSY is used to complete the filtering and aggregation of the original event sequence in real time within the terminal, and return the processed event sequence to the cloud, greatly reducing the cloud computing and storage costs, and improving the real-time performance at the same time.
[0161] In the terminal stream processing scenario of video applications, it is often necessary to dynamically generate and run dynamic scripts according to the needs of video applications. In related technologies, in order to implement dynamic logic processing on the terminal, a virtual machine solution is usually adopted to run a virtual machine on the terminal to achieve dynamic interaction and effects of video applications on the terminal. For example, the virtual machine solution can include a JS script solution, such as JSV8 on Android, JavaScriptCore on iOS, or a Python VM solution. This method relies on integrating an independent virtual machine environment (memory isolated from the native environment) within the native environment, which will bring additional costs when communicating with the native environment. Among them, VM refers to a virtual machine environment such as JS, Python, etc., and the native environment refers to the App (iOS / Android) environment, that is, the environment of the video application.
[0162] Applying the virtual machine solution in the terminal stream processing scenario in related technologies has the following disadvantages: 1. Data transfer with the native is cross-domain. It is necessary to serialize the native data structure into an intermediate structure (such as JSON) and then transfer it to the virtual machine environment. After processing, it also needs to be converted back to the intermediate structure when transferring back to the native, so that each data transfer requires serialization and deserialization once, resulting in low transmission efficiency; 2. Since the memory cannot be shared, after the data is transferred, a memory copy will be performed within the virtual machine environment to map and generate an independent data structure, bringing additional memory overhead; 3. The virtual machine solution runs in an independent thread. Every time an API provided by the native is called, a context switch will occur, bringing additional thread synchronization costs; 4. In Android, there are also cross-platform problems in native communication, that is, the communication cost between the Java layer and the C++ layer will also affect the communication efficiency; 5. The integration volume of JSV8 and PythonVM is relatively large, which has a serious impact on the size of the App package. Especially when a large number of events flood in at the same time, the above disadvantages will lead to serious performance problems.
[0163] In contrast, the task processing method provided by the embodiment of the present application maintains a running environment consistent with the native environment during the operation of the script engine (JSY), realizing a lightweight interpreter on both sides, enabling zero-cost access and call of native data and native APIs, and greatly reducing the memory and operation pressure in the terminal stream processing scenario. At the same time, based on the symbol pre-parse and compilation optimization of the syntax tree during the compilation period, the time-consuming for parsing the AST is minimized, providing high event processing performance during the operation period.
[0164] To verify the effect of the task processing method provided by the embodiment of the present application, the task processing method of the embodiment of the present application (hereinafter referred to as the present application) is tested and compared with the virtual machine solutions (JS virtual machine and Python virtual machine) in the related art, and the schematic diagram of the test comparison results as shown in Figure 3e is obtained. The figure respectively shows the test comparison results for the Android and iOS native environments, and the test data is JSON 10K. It can be seen from the figure that in terms of data processing time-consuming, in the Android environment, the present application (JSC in the figure) is reduced by more than 99% compared with the existing JS virtual machine and Python virtual machine solutions; in the iOS environment, the present application (JSC in the figure) is reduced by more than 88% compared with the existing JS virtual machine and Python virtual machine solutions; in terms of memory peak value, in the Android environment, the present application (JSC in the figure) is reduced by more than 91% compared with the existing JS virtual machine and Python virtual machine solutions; in the iOS environment, the present application (JSC in the figure) is reduced by more than 97% compared with the existing JS virtual machine and Python virtual machine solutions; in terms of package size, in the Android environment, the present application (JSC in the figure) is reduced by more than 99% compared with the existing JS virtual machine and Python virtual machine solutions; in the iOS environment, the present application (JSC in the figure) is reduced by more than 91% compared with the existing JS virtual machine and Python virtual machine solutions. Obviously, the task processing method provided by the embodiment of the present application can reduce data processing time-consuming, memory occupation and communication data volume, so as to improve the efficiency of the terminal for processing real-time tasks.
[0165] To better implement the above method, the embodiment of the present application also provides a task processing device, which can be specifically integrated in an electronic device, and the electronic device can be a device such as a terminal, a server, etc. Among them, the terminal can be a device such as a mobile phone, a tablet computer, a smart Bluetooth device, a notebook computer, a personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers.
[0166] For example, in this embodiment, taking the task processing device specifically integrated in the server as an example, the method of the embodiment of the present application will be described in detail.
[0167] For example, as Figure 4As shown, the task processing device may include a first acquisition unit 410, a syntax parsing unit 420, a serialization unit 430, and a sending unit 440, as follows:
[0168] (1) The first acquisition unit 410
[0169] is configured to obtain the program file to be executed for the real-time task triggered by the target application running on the terminal, and the program file to be executed is the program file corresponding to the native data structure.
[0170] (2) The syntax parsing unit 420
[0171] is configured to perform syntax parsing on the program file to be executed to obtain a syntax structure representation of the program file to be executed.
[0172] In some embodiments, the task processing device further includes an indexing unit, including: an indexing unit configured to perform symbol parsing on the syntax structure representation to establish an index table of the syntax structure representation, and the index table stores the definition and reference relationships of the symbols in the syntax structure representation, so that when the terminal processes the real-time task, the definition and reference relationships of the symbols can be queried through the index table.
[0173] In some embodiments, the task processing device further includes an optimization unit, including: an optimization unit configured to perform structural optimization on the syntax structure representation to obtain an optimized syntax structure representation, so as to perform serialization processing on the optimized syntax structure to obtain binary data, and the structural optimization includes one or more of formal parameter optimization, inlining optimization, constant folding, and dead code elimination.
[0174] (3) The serialization unit 430
[0175] is configured to perform serialization processing on the syntax structure representation to obtain binary data.
[0176] (4) The sending unit 440
[0177] is configured to send the binary data to the terminal, so that the terminal processes the binary data through the native data interface to process the real-time task, and the native data interface is the interface corresponding to the native data structure.
[0178] In specific implementation, the above units can be implemented as independent entities, or can be arbitrarily combined and implemented as the same or several entities. For the specific implementation of the above units, reference can be made to the foregoing method embodiments, which will not be elaborated herein.
[0179] As can be seen from the above, the task processing device of this embodiment includes a first acquisition unit, a syntax parsing unit, a serialization unit, and a sending unit. Among them, the first acquisition unit is used to obtain the program file to be executed of the real-time task according to the real-time task triggered by the target application running on the terminal, and the program file to be executed is the program file corresponding to the native data structure; the syntax parsing unit is used to perform syntax parsing on the program file to be executed to obtain the syntax structure representation of the program file to be executed; the serialization unit is used to perform serialization processing on the syntax structure representation to obtain binary data; the sending unit is used to send the binary data to the terminal so that the terminal processes the binary data through the native data interface corresponding to the native data structure to process the real-time task, and the native data interface is the interface corresponding to the native data structure.
[0180] Therefore, in the embodiment of this application, the program file to be executed of the real-time task of the target application is parsed into a syntax structure representation, and then serialized to obtain binary data and sent to the terminal. In this way, the terminal receives the binary data after syntax parsing, and by calling the native data interface corresponding to the native data structure of the program file to be executed, it can process the real-time task without further compilation, reducing the computing pressure and time consumption of the terminal and improving the response speed of the terminal.
[0181] To better implement the above method, the embodiment of this application also provides a task processing device, which can be specifically integrated in an electronic device, and the electronic device can be a terminal, a server, or other devices. Among them, the terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop computer, a personal computer, or other devices; the server can be a single server or a server cluster composed of multiple servers.
[0182] For example, in this embodiment, the method of the embodiment of this application will be described in detail by taking the task processing device as being specifically integrated in the terminal as an example.
[0183] For example, as Figure 5 shown, the task processing device may include a second acquisition unit 510, a deserialization unit 520, a structure parsing unit 530, a calling unit 540, and a processing unit 550, as follows:
[0184] (1) The second acquisition unit 510
[0185] is used to obtain the binary data corresponding to the real-time task triggered by the target application running on the terminal, and the binary data is obtained by the server processing the syntax structure representation of the program file to be executed of the real-time task, and the program file to be executed is the program file corresponding to the native data structure.
[0186] In some embodiments, the task processing device further includes a request unit, and the request unit is specifically configured to: in response to a specified real-time event, generate a task request corresponding to a real-time task; send the task request to a server so that the server returns binary data according to the task request.
[0187] (2) Deserialization unit 520
[0188] For performing deserialization processing on the binary data to obtain a syntax structure representation.
[0189] (3) Structure parsing unit 530
[0190] For parsing the syntax structure representation to load symbols in the syntax structure representation.
[0191] (4) Invocation unit 540
[0192] For invoking a native data interface corresponding to a target application based on the symbols, where the native data interface is an interface corresponding to a native data structure.
[0193] (5) Processing unit 550
[0194] For processing the real-time task through the native data interface.
[0195] In some embodiments, the task processing device further includes a mapping unit, and the mapping unit is specifically configured to: create a native data interface, where the native data interface is related to the system type of the target application; map the native data interface to a preset interface specification to obtain a mapping relationship.
[0196] In some embodiments, the processing unit is specifically configured to: determine a preset interface specification corresponding to the native data interface through the mapping relationship; call a processing module corresponding to the native data interface to process the binary data according to the preset interface specification, where the processing module is a module common to multiple system types.
[0197] In some embodiments, the real-time task includes a data update task, and the processing unit is specifically configured to: obtain operation data corresponding to the target application through the native data interface, where the operation data includes historical operation data and real-time operation data corresponding to the data update task; perform clustering processing on the operation data according to the real-time operation data to obtain target operation data associated with the real-time operation data; perform classification processing on the target operation data to determine an update intention; update the target application according to the update intention.
[0198] In some embodiments, the real-time task includes an event integration task. The processing unit is specifically configured to: obtain an original event sequence through a native data interface; perform event integration on the original event sequence to obtain a processed event sequence; determine the priority of each event in the processed event sequence according to historical operation data; sort each event in the processed event sequence according to the priority to obtain a target event sequence, and send the target event sequence to the server so that the server processes the target event sequence.
[0199] In specific implementation, each of the above units can be implemented as an independent entity, or can be combined arbitrarily to be implemented as the same or several entities. For the specific implementation of each of the above units, reference can be made to the foregoing method embodiments, which will not be elaborated herein.
[0200] As can be seen from the above, the task processing device of this embodiment includes a second acquisition unit, a deserialization unit, a structure parsing unit, a calling unit, and a processing unit. The second acquisition unit is configured to acquire binary data corresponding to a real-time task triggered by a target application running on the terminal. The binary data is obtained by representing the syntax structure of an executable program file for processing the real-time task by the server, and the executable program file is a program file corresponding to the native data structure; the deserialization unit is configured to perform deserialization processing on the binary data to obtain a syntax structure representation; the structure parsing unit is configured to parse the syntax structure representation to load symbols in the syntax structure representation; the calling unit is configured to call a native data interface corresponding to the target application, and the native data interface is an interface corresponding to the native data structure; the processing unit is configured to process the real-time task through the native data interface.
[0201] Thus, the embodiment of the present application can deserialize the binary data after syntax parsing corresponding to the executable program file into a syntax structure representation. In this way, when the terminal processes a real-time task, by calling the native data interface corresponding to the native data structure of the executable program file, it can process the real-time task without further compilation, reducing the computing pressure and time consumption and improving the response speed.
[0202] The embodiment of the present application further provides an electronic device, which can be a device such as a terminal or a server. Among them, the terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop computer, a personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers, etc.
[0203] In some embodiments, the task processing device can also be integrated in multiple electronic devices. For example, the task processing device can be integrated in multiple servers, and multiple servers are used to implement the task processing method of the present application.
[0204] In this embodiment, the electronic device of this embodiment will be described in detail. For example, asFigure 6 As shown, it shows a schematic structural diagram of an electronic device involved in an embodiment of the present application. Specifically:
[0205] The electronic device may include a processor 610 with one or more processing cores, a memory 620 with one or more computer-readable storage media, a power supply 630, an input module 640, a communication module 650, and other components. Those skilled in the art can understand that Figure 6 the structural diagram of the electronic device shown in does not constitute a limitation on the electronic device, and it may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. Among them:
[0206] The processor 610 is the control center of the electronic device. It uses various interfaces and circuits to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 620, and by calling the data stored in the memory 620, it executes various functions of the electronic device and processes data. In some embodiments, the processor 610 may include one or more processing cores; in some embodiments, the processor 610 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor may not be integrated into the processor 610.
[0207] The memory 620 can be used to store software programs and modules. The processor 610 executes various functional applications and data processing by running the software programs and modules stored in the memory 620. The memory 620 may mainly include a program storage area and a data storage area. Among them, the program storage area can store the operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the electronic device. In addition, the memory 620 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices. Correspondingly, the memory 620 may also include a memory controller to provide the processor 610 with access to the memory 620.
[0208] The electronic device also includes a power supply 630 that powers each component. In some embodiments, the power supply 630 may be logically connected to the processor 610 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 630 may also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.
[0209] The electronic device may further include an input module 640, which may be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0210] The electronic device may further include a communication module 650. In some embodiments, the communication module 650 may include a wireless module. The electronic device may perform short-range wireless transmission through the wireless module of the communication module 650, thereby providing users with wireless broadband Internet access. For example, the communication module 650 may be used to help users send and receive emails, browse web pages, and access streaming media, etc.
[0211] Although not shown, the electronic device may further include a display unit, etc., which will not be elaborated here. Specifically, in this embodiment, the processor 610 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 620 according to the following instructions, and the processor 610 will run the application programs stored in the memory 620 to implement various functions as follows:
[0212] According to the real-time task triggered by the target application running on the terminal, obtain the program file to be executed for the real-time task, where the program file to be executed is the program file corresponding to the native data structure; perform syntax parsing on the program file to be executed to obtain the syntax structure representation of the program file to be executed; perform serialization processing on the syntax structure representation to obtain binary data; send the binary data to the terminal so that the terminal processes the binary data through the native data interface to process the real-time task, and the native data interface is the interface corresponding to the native data structure.
[0213] Or, obtain the binary data corresponding to the real-time task triggered by the target application running on the terminal, where the binary data is obtained by the server processing the syntax structure representation of the program file to be executed for the real-time task, and the program file to be executed is the program file corresponding to the native data structure; perform deserialization processing on the binary data to obtain the syntax structure representation; perform parsing on the syntax structure representation to load the symbols in the syntax structure representation; based on the symbols, call the native data interface corresponding to the target application, and the native data interface is the interface corresponding to the native data structure; process the real-time task through the native data interface.
[0214] For the specific implementation of each of the above operations, reference may be made to the previous embodiments, which will not be elaborated here.
[0215] As can be seen from the above, in the embodiments of the present application, the program file to be executed for the real-time task of the target application is parsed into a syntax structure representation, and then serialized to obtain binary data and sent to the terminal. In this way, the terminal receives the binary data after syntax parsing, and by calling the native data interface corresponding to the native data structure of the program file to be executed, it can process the real-time task without further compilation, reducing the computing pressure and time consumption of the terminal and improving the response speed of the terminal.
[0216] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by controlling related hardware through instructions. The instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0217] Therefore, the embodiments of the present application provide a computer-readable storage medium, in which multiple instructions are stored, and the instructions can be loaded by a processor to execute the steps in any of the task processing methods provided by the embodiments of the present application. For example, the instructions can execute the following steps:
[0218] According to the real-time task triggered by the target application running on the terminal, obtain the program file to be executed for the real-time task. The program file to be executed is the program file corresponding to the native data structure; perform syntax parsing on the program file to be executed to obtain the syntax structure representation of the program file to be executed; perform serialization processing on the syntax structure representation to obtain binary data; send the binary data to the terminal so that the terminal can process the binary data through the native data interface to process the real-time task. The native data interface is the interface corresponding to the native data structure.
[0219] Or, obtain the binary data corresponding to the real-time task triggered by the target application running on the terminal. The binary data is obtained by the server processing the syntax structure representation of the program file to be executed for the real-time task. The program file to be executed is the program file corresponding to the native data structure; perform deserialization processing on the binary data to obtain the syntax structure representation; perform parsing on the syntax structure representation to load the symbols in the syntax structure representation; based on the symbols, call the native data interface corresponding to the target application. The native data interface is the interface corresponding to the native data structure; through the native data interface, process the real-time task.
[0220] Among them, the storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc.
[0221] According to an aspect of the present application, there is provided a computer program product or a computer program, including a computer program or instructions, which, when executed by a processor, implement the steps in the methods provided in the various alternative implementations provided in the above embodiments. The computer program / instructions are stored in a computer-readable storage medium. The processor of the electronic device reads the computer program / instructions from the computer-readable storage medium, and the processor executes the computer program / instructions, so that the electronic device executes the methods provided in the various alternative implementations provided in the above embodiments.
[0222] Since the instructions stored in the storage medium can execute the steps in any one of the task processing methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the task processing methods provided in the embodiments of the present application can be realized. For details, see the previous embodiments and will not be repeated here.
[0223] The above has introduced in detail a task processing method, device, electronic device, medium and program product provided by the embodiments of the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.
Claims
1. A task processing method, characterized in that, Applied to a server, the method includes: Obtain an executable program file of the real-time task according to the real-time task triggered by the target application running on the terminal, where the executable program file is a program file corresponding to the native data structure; Perform syntax parsing on the executable program file to obtain a syntax structure representation of the executable program file; Perform serialization processing on the syntax structure representation to obtain binary data; Send the binary data to the terminal so that the terminal processes the binary data through the native data interface to process the real-time task, where the native data interface is an interface corresponding to the native data structure.
2. The task processing method according to claim 1, wherein, After performing syntax parsing on the executable program file to obtain a syntax structure representation of the executable program file and before performing serialization processing on the syntax structure representation to obtain binary data, it further includes: Perform symbol parsing on the syntax structure representation to establish an index table of the syntax structure representation, where the index table stores the definition and reference relationships of symbols in the syntax structure representation, so that when the terminal processes the real-time task, it can query the definition and reference relationships of the symbols through the index table.
3. The task processing method according to claim 1, wherein After performing syntax parsing on the executable program file to obtain a syntax structure representation of the executable program file and before performing serialization processing on the syntax structure representation to obtain binary data, it further includes: Perform structure optimization on the syntax structure representation to obtain an optimized syntax structure representation, so as to perform serialization processing on the optimized syntax structure to obtain the binary data, where the structure optimization includes one or more of formal parameter optimization, inlining optimization, constant folding, and dead code elimination.
4. A task processing method, characterized in that, Applied to a terminal, the method includes: Obtain binary data corresponding to the real-time task triggered by the target application running on the terminal, where the binary data is obtained by the server processing the syntax structure representation of the executable program file of the real-time task, and the executable program file is a program file corresponding to the native data structure; Perform deserialization processing on the binary data to obtain a syntax structure representation; Parse the syntax structure representation to load the symbols in the syntax structure representation; Based on the symbols, call the native data interface corresponding to the target application, where the native data interface is an interface corresponding to the native data structure; Process the real-time task through the native data interface.
5. The task processing method according to claim 4, characterized in that The real-time task includes a data update task, and the processing of the real-time task through the native data interface includes: Obtain the operation data corresponding to the target application through the native data interface, where the operation data includes historical operation data and real-time operation data corresponding to the data update task; Perform clustering processing on the operation data according to the real-time operation data to obtain target operation data associated with the real-time operation data; Perform classification processing on the target operation data to determine the update intention; Update the target application according to the update intention.
6. The task processing method according to claim 4, wherein The real-time tasks include event integration tasks. Processing the real-time tasks through the native data interface includes: Obtaining an original event sequence through the native data interface; Performing event integration on the original event sequence to obtain a processed event sequence; Determining the priority of each event in the processed event sequence according to historical operation data; Sorting each event in the processed event sequence according to the priority to obtain a target event sequence, and sending the target event sequence to the server so that the server processes the target event sequence.
7. The task processing method according to claim 4, wherein Before calling the native data interface corresponding to the target application based on the symbol, it further includes: Creating the native data interface, where the native data interface is related to the system type of the target application; Mapping the native data interface to a preset interface specification to obtain a mapping relationship; Processing the real-time tasks through the native data interface includes: Determining the preset interface specification corresponding to the native data interface through the mapping relationship; According to the preset interface specification, calling a processing module corresponding to the native data interface to process the binary data, where the processing module is a module common to multiple system types.
8. The task processing method according to any one of claims 4 to 7, characterized in that Before obtaining the binary data corresponding to the real-time task triggered by the target application running on the terminal, it further includes: Generating a task request corresponding to the real-time task in response to a specified real-time event of the target application; Sending the task request to the server so that the server returns the binary data according to the task request.
9. A task processing device, characterized in that, When applied to a server, the device includes: A first acquisition unit, configured to acquire an executable program file to be executed for the real-time task triggered by the target application running on the terminal, where the executable program file to be executed is a program file corresponding to a native data structure; A syntax parsing unit, configured to perform syntax parsing on the executable program file to be executed to obtain a syntax structure representation of the executable program file to be executed; A serialization unit, configured to perform serialization processing on the syntax structure representation to obtain binary data; A sending unit, configured to send the binary data to the terminal so that the terminal processes the binary data through the native data interface to process the real-time task, where the native data interface is an interface corresponding to the native data structure.
10. A task processing device, characterized in that, When applied to a terminal, the device includes: A second acquisition unit, configured to acquire binary data corresponding to the real-time task triggered by the target application running on the terminal, where the binary data is obtained by the server processing the syntax structure representation of the executable program file to be executed for the real-time task, and the executable program file to be executed is a program file corresponding to a native data structure; An anti-serialization unit, configured to perform anti-serialization processing on the binary data to obtain a syntax structure representation; A structure parsing unit, configured to parse the syntax structure representation to load symbols in the syntax structure representation; A calling unit, configured to call the native data interface corresponding to the target application, where the native data interface is an interface corresponding to the native data structure. A processing unit for processing the real-time task through the native data interface.
11. An electronic device, characterized in that, It includes a processor and a memory, and the memory stores multiple instructions; the processor loads the instructions from the memory to execute the steps in the task processing method according to any one of claims 1 to 8.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the task processing method according to any one of claims 1 to 8.
13. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, the steps in the task processing method according to any one of claims 1 to 8 are implemented.