Compiling method and device, equipment, medium and product
By optimizing compilation instructions based on programming language features and mapping relationships, the problem of high tuning complexity in machine learning compilers is solved, achieving efficient and seamless compilation optimization, applicable to various programming languages and large-scale projects.
Patent Information
- Application Number
- CN202511718478.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-21
- Publication Date
- 2026-03-06
AI Technical Summary
Existing machine learning-based compiler tuning methods are complex and difficult to implement, requiring the construction of datasets and complex feature engineering and model training, as well as significant human intervention.
By acquiring compilation task data, determining the target compilation parameters based on the programming language, modifying compilation instructions, and optimizing the compilation effect through an iterative process until the expected effect is achieved, the parameter search space is reduced by utilizing programming language features and pre-established mapping relationships, thus avoiding the complex process of machine learning.
It achieves efficient optimization of the compilation process, reduces the complexity and difficulty of compilation tuning, supports compilation of multiple programming languages, is suitable for large-scale mixed code projects, and does not require the construction of datasets and complex feature engineering, so that users are unaware of the process.
Smart Images

Figure CN121614136A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of compilation technology, and in particular to a compilation method, apparatus, device, medium, and product. Background Technology
[0002] Compiler tuning is a research area of great interest in compiler-related fields. The main goal of this type of compiler optimization problem is to improve program performance and provide guidance for compiler optimization-related issues.
[0003] In recent years, compiler tuning methods based on machine learning prediction or machine learning-driven approaches have attracted much attention. These machine learning-based tuning methods utilize historical program data to evaluate program performance, thereby automatically generating compiler optimization parameters. However, they require the construction of relevant datasets and complex feature engineering and model training. Furthermore, because the datasets are labeled, they require significant manual intervention.
[0004] It is evident that the implementation process of machine learning-based optimization methods is quite complex and difficult. Summary of the Invention
[0005] Therefore, it is necessary to provide a compilation method, apparatus, device, medium, and product to address the aforementioned technical problems, thereby reducing the complexity and difficulty of compilation optimization.
[0006] Firstly, this application provides a compilation method, including:
[0007] Obtain the task data corresponding to the compilation task; the task data includes the file to be compiled and the initial compilation instructions;
[0008] Determine the corresponding target compilation adjustment parameters based on the programming language used in the file to be compiled;
[0009] For each compilation process, the parameters are adjusted according to the target compilation, and the compilation instructions under the previous compilation process are modified to obtain the compilation instructions under the current compilation process; among them, the compilation instructions under the first compilation process are the initial compilation instructions.
[0010] Compile the files to be compiled according to the compilation instructions in this compilation process; run the compilation results and obtain the performance data of this compilation process;
[0011] Based on the performance data of this compilation process, determine whether the current compilation effect has achieved the expected result;
[0012] If the expected results are not achieved, continue with the next compilation step until the current compilation result meets the expected results.
[0013] In one embodiment, determining the corresponding target compilation adjustment parameters based on the programming language used in the file to be compiled includes: extracting programming language features from the file to be compiled to obtain programming language features; and obtaining the target compilation adjustment parameters corresponding to the programming language features based on a pre-established mapping relationship; wherein the mapping relationship includes the correspondence between at least one candidate programming language feature and at least one candidate compilation adjustment parameter.
[0014] In one embodiment, determining whether the current compilation effect has met expectations based on the runtime performance data of the current compilation process includes: determining the degree of performance improvement corresponding to the current compilation process based on the runtime performance data of the current compilation process; and determining whether the current compilation effect has met expectations based on the relationship between the degree of performance improvement and a preset threshold.
[0015] In one embodiment, the determination of whether the current compilation effect has achieved the expected effect is based on the relationship between the performance improvement and a preset threshold, including any one of the following: if the performance improvement is lower than the preset threshold, the current compilation effect is determined to have achieved the expected effect; if the performance improvement is not lower than the preset threshold, the current compilation effect is determined to have not achieved the expected effect.
[0016] In one embodiment, modifying the compilation instructions under the previous compilation process based on the target compilation adjustment parameters to obtain the compilation instructions under the current compilation process includes: adjusting the parameter values of the target compilation adjustment parameters based on the runtime performance data of the previous compilation process; and adding the adjusted target compilation adjustment parameters to the compilation instructions under the previous compilation process to obtain the compilation instructions under the current compilation process.
[0017] In one embodiment, the adjusted target compilation parameters are added to the compilation instructions in the previous compilation process to obtain the compilation instructions in the current compilation process. This includes: using compilation instrumentation to add the adjusted target compilation parameters to the compilation instructions in the previous compilation process to obtain the compilation instructions in the current compilation process.
[0018] Secondly, this application also provides a compilation apparatus, comprising:
[0019] The first acquisition module is used to acquire task data corresponding to the compilation task; the task data includes the file to be compiled and the initial compilation instructions.
[0020] The first determining module is used to determine the corresponding target compilation adjustment parameters based on the programming language used in the file to be compiled;
[0021] The first modification module is used to adjust the parameters according to the target compilation for each compilation process, modify the compilation instructions under the previous compilation process, and obtain the compilation instructions under the current compilation process; among them, the compilation instructions under the first compilation process are the initial compilation instructions.
[0022] The first processing module is used to compile the files to be compiled according to the compilation instructions in this compilation process; run the compilation results; and obtain the performance data of this compilation process.
[0023] The second determining module is used to determine whether the current compilation effect has achieved the expected effect based on the performance data of this compilation process.
[0024] The continue execution module is used to continue the next compilation process if the expected result is not achieved, until the current compilation result meets the expected result.
[0025] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method provided in the first aspect.
[0026] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method provided in the first aspect.
[0027] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the method provided in the first aspect.
[0028] The aforementioned compilation method, apparatus, device, medium, and product determine the corresponding target compilation adjustment parameters based on the programming language used in the file to be compiled, achieving parameter selection based on the programming language. The compilation process does not need to attempt numerous parameters, thus improving compilation efficiency and solving the problem of difficult parameter selection. Furthermore, based on the target compilation adjustment parameters, the compilation instructions from the previous compilation process are modified to obtain the compilation instructions for the current compilation process, thereby optimizing the compilation instructions. Moreover, by acquiring the runtime performance data of the current compilation process, the current compilation effect can be accurately determined, thus accurately confirming whether the current compilation effect meets the expected result. If the current compilation effect does not meet the expected result, the next compilation process continues until the current compilation effect meets the expected result. It is evident that this embodiment, based on the iterative process of the compilation process, continuously improves the compilation effect and ensures that the final compilation effect meets the expected result, thereby satisfying the compilation requirements. Since the above process is not based on machine learning time, it does not require building relevant datasets, performing complex feature engineering and model training, or requiring much manual intervention, achieving user-unobtrusive compilation optimization processing, thus reducing the complexity and difficulty of compilation tuning. Moreover, when the file to be compiled includes content to be compiled in at least two compiler languages, the above compilation process can be used to compile the content to be compiled in each compiler language, thereby realizing the compilation of the file to be compiled in multiple compiler languages. It can be seen that this application is also applicable to large-scale mixed code projects and solves the complicated compilation steps of large-scale projects. Attached Figure Description
[0029] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0030] Figure 1 This is a flowchart illustrating the compilation method in one embodiment;
[0031] Figure 2 This is a flowchart illustrating the target compilation parameter adjustment steps in one embodiment;
[0032] Figure 3 This is a flowchart illustrating the steps for modifying compilation instructions in one embodiment;
[0033] Figure 4 This is a flowchart illustrating the steps for determining whether the desired effect has been achieved in one embodiment.
[0034] Figure 5 This is a block diagram of the compilation device in one embodiment;
[0035] Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0036] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0037] In one exemplary embodiment, a compilation method is provided that can be applied to an automated compilation tool. See also Figure 1 The method includes:
[0038] S110, retrieve the task data corresponding to the compilation task.
[0039] The task data includes the files to be compiled and the initial compilation instructions.
[0040] The configuration file for the compilation task includes initial compilation instructions, execution instructions, and the source code path. The initial encoding instructions, which are used for compilation, can be obtained from this configuration file. The file to be compiled can be retrieved based on the source code path in the configuration file. The execution instructions are used to run the compilation results. Therefore, based on the configuration file for the compilation task, the file to be compiled, the initial compilation instructions, and the execution instructions can all be obtained from the aforementioned task data set.
[0041] The configuration file can be in a mainstream format, such as JSON or YAML, for easy parsing and expansion. Other formats are also possible, and no specific restrictions are imposed here.
[0042] In real-world scenarios, when using automatic compilation tools for code compilation, it's essential to ensure that the tool's binary executable is installed on a pre-compiled server or local computer. Since the automatic compilation tool itself is not a compiler, but rather compiles the file by calling a compiler, a compiler must be pre-installed.
[0043] S120 determines the corresponding target compilation adjustment parameters based on the programming language used in the file to be compiled.
[0044] The programming language can be understood as the programming language used in the process of obtaining the file to be compiled. The programming language can be C, C++, or Go, etc., and of course, other programming languages are not limited here.
[0045] In one alternative implementation, see Figure 2 The target compilation tuning steps in S120 include:
[0046] S210: Extract programming language features from the file to be compiled to obtain programming language features.
[0047] Among these, programming language features can be understood as characteristics that reflect the type of programming language. For example, features such as memory management methods or function calling methods, and of course, other features as well, are not limited here.
[0048] S220 obtains the target compilation adjustment parameters corresponding to the programming language features based on the pre-established mapping relationship.
[0049] The mapping relationship includes the correspondence between at least one candidate programming language feature and at least one candidate compiler tuning parameter.
[0050] Candidate compiler tuning parameters can be understood as the parameters used to modify compiler instructions during the compiler tuning process. These include, for example, tuning levels or other parameters, without limitation.
[0051] Understandably, different programming languages have different characteristics, and different programming languages require different compilation tuning parameters during compilation optimization. Therefore, a mapping relationship between candidate programming language characteristics and candidate compilation tuning parameters is established in advance. When it is necessary to determine the target compilation tuning parameters, the candidate compilation tuning parameters corresponding to the programming language characteristics of the current compilation file in the mapping relationship are used as the target compilation tuning parameters.
[0052] In the above implementation, the target compilation tuning parameters corresponding to the programming language features of the file to be compiled are determined based on the mapping relationship. This realizes parameter selection based on the programming language, reduces the parameter search space, and improves the efficiency of compilation tuning.
[0053] S130: For each compilation process, adjust parameters according to the target compilation, modify the compilation instructions under the previous compilation process, and obtain the compilation instructions under the current compilation process.
[0054] Among them, the compilation instructions in the first compilation process are the initial compilation instructions.
[0055] As can be seen, this embodiment achieves compilation optimization by modifying the compilation instructions.
[0056] One approach is to modify the compilation instructions from the previous compilation process based on the target compilation adjustment parameters. This can involve further filtering for more suitable parameters from the target compilation adjustment parameters and then modifying the compilation instructions from the previous compilation process based on these filtered parameters. Alternatively, it can involve directly modifying the compilation instructions from the previous compilation process based on the target compilation adjustment parameters.
[0057] Furthermore, the initial parameter values of the target compilation adjustment parameters can be directly used to modify and optimize the compilation instructions in the previous compilation process. Alternatively, parameter values can be adjusted based on the initial values, and the adjusted parameter values can be used to modify and optimize the compilation instructions in the previous compilation process. There are several methods for adjusting parameter values. Figure 3 The implementation shown provides one adjustment method, but other adjustment methods can also be used, which are not limited here.
[0058] In one alternative implementation, see Figure 3 The steps for modifying compilation instructions in S130 include:
[0059] S310 adjusts the target compilation adjustment parameters based on the performance data from the previous compilation process.
[0060] S320 adds the adjusted target compilation parameters to the compilation instructions in the previous compilation process to obtain the compilation instructions for the current compilation process.
[0061] In real-world scenarios, the compilation instructions in the previous compilation process can be modified based on the initial parameter values of the target compilation adjustment parameters, or the parameter values of the target compilation adjustment parameters can be adjusted, and the compilation instructions in the previous compilation process can be modified using the adjusted target compilation adjustment parameters.
[0062] Furthermore, in order to improve the compilation tuning effect, based on the performance data of the previous compilation process, we can know the direction of the target compilation tuning parameters, such as whether to increase or decrease the parameter value, and we can also determine the adjustment range of the target compilation tuning parameters, such as increasing or decreasing by 10%, 20% or other values. Based on the adjustment direction and adjustment range, we can adjust the parameter value of the target compilation tuning parameters.
[0063] One method for modifying compilation instructions is to add the adjusted target compilation adjustment parameters to the compilation instructions in the previous compilation process to obtain the compilation instructions in the current compilation process. In this way, when the compilation instructions in the current compilation process are executed, they will adjust or correct the compilation process according to the target compilation adjustment parameters, thereby achieving compilation optimization.
[0064] The parameter addition step in S320 may include: using compiler instrumentation, adding the adjusted target compilation adjustment parameters to the compilation instructions under the previous compilation process to obtain the compilation instructions under the current compilation process.
[0065] Understandably, automatic compilation optimization tools usually have compilation instrumentation capabilities. Therefore, by utilizing this compilation instrumentation capability, target compilation adjustment parameters can be added to the compilation instructions, which is simple and convenient.
[0066] In the above implementation, the target compilation tuning parameters are adjusted based on the performance data of the previous compilation process. The adjusted target compilation tuning parameters are then used to modify the compilation instructions under the previous compilation process, thereby improving the compilation tuning effect of the current compilation process.
[0067] S140: Compile the file to be compiled according to the compilation instructions in this compilation process; run the compilation results and obtain the performance data of this compilation process.
[0068] Understandably, by executing compilation instructions, the file to be compiled is compiled, resulting in an executable file; by executing execution instructions, the executable file is actually run. During the compilation and execution process, relevant performance data is collected.
[0069] The runtime performance data may include at least one of the following: compilation time, runtime, executable file size, memory required for compilation, and memory required for runtime.
[0070] Understandably, runtime is a key metric that developers are generally concerned about. Memory usage reflects the memory hardware resource requirements of the compilation process. The size of the executable file is particularly sensitive in embedded systems. Compilation time has an impact on the overall development and release schedule of a project.
[0071] Based on the above performance data, we can determine the current compilation results.
[0072] S150: Based on the performance data of this compilation process, determine whether the current compilation effect has achieved the expected result.
[0073] For example, if a user values compilation time, they may set minimizing compilation time as their optimization goal. Therefore, after obtaining the performance data of this compilation process, if the compilation time is less than the preset compilation time threshold, the expected effect is considered to have been achieved.
[0074] In one alternative implementation, see Figure 4 The steps for determining whether the desired effect has been achieved in S150 may include:
[0075] S410, based on the performance data of this compilation process, determines the degree of performance improvement corresponding to this compilation process.
[0076] S420 determines whether the current compilation effect meets expectations based on the relationship between the performance improvement and the preset threshold.
[0077] For example, if the user values runtime, minimizing runtime is taken as the optimization goal. After obtaining the runtime of the current compilation process, the runtime of the current compilation process is compared with the runtime of the previous compilation process, resulting in a 10% reduction in runtime for the current compilation process. The preset runtime threshold is 5%. It can be seen that comparing 10% and 5% determines whether the current compilation effect has achieved the expected result.
[0078] The determining step in S420 may include any of the following:
[0079] (1) If the performance improvement is less than the preset threshold, determine that the current compilation effect has reached the expected effect.
[0080] (2) If the performance improvement is not lower than the preset threshold, determine that the current compilation effect has not achieved the expected effect.
[0081] Understandably, performance improves with each compilation cycle. Initially, the performance improvement is significant; however, as the number of cycles increases, the improvement gradually decreases because there's an upper limit to the overall performance increase. Performance won't improve indefinitely. Therefore, if the performance improvement in a particular compilation cycle falls below a preset threshold (e.g., 3%), it's assumed that further compilation would yield minimal improvement, and the cycle ends. Conversely, if the performance improvement is at least as high as the preset threshold, it's believed there's still room for improvement, and the next compilation cycle is executed.
[0082] In the above implementation method, based on the idea that the performance continuously improves with the increase of the number of compilation processes, and the practical constraint that the overall performance improvement has an upper limit, it is possible to accurately determine whether the current compilation effect has achieved the expected effect.
[0083] S160: If the expected result is not achieved, continue to execute the next compilation process until the current compilation result achieves the expected result.
[0084] The above compilation method determines the corresponding target compilation adjustment parameters based on the programming language used in the file to be compiled, achieving parameter selection based on the programming language. The compilation process does not need to try a large number of parameters, thus improving compilation efficiency and solving the problem of difficult parameter selection. Furthermore, by modifying the compilation instructions from the previous compilation process based on the target compilation adjustment parameters, the compilation instructions for the current compilation process are obtained, thereby optimizing the compilation instructions. Moreover, by acquiring the runtime performance data of the current compilation process, the current compilation effect can be accurately determined, thus accurately determining whether the current compilation effect meets the expected effect. If the current compilation effect does not meet the expected effect, the next compilation process continues until the current compilation effect meets the expected effect. It is evident that this embodiment continuously improves the compilation effect based on the iterative process of the compilation process, ensuring that the final compilation effect meets the expected effect, thereby satisfying the compilation requirements. Since the above process is not based on machine learning time, it does not require the construction of relevant datasets, complex feature engineering and model training, or much manual intervention, achieving user-unobtrusive compilation optimization processing, thus reducing the complexity and difficulty of compilation tuning. Moreover, this embodiment supports more than a single programming language, making it more versatile and practical. It is suitable for large-scale mixed code projects and solves the complicated compilation steps of large projects.
[0085] In one embodiment, the compilation method further includes: after determining that the current compilation effect has met expectations, rolling back the modifications made to the compilation instructions during the compilation process through compilation instrumentation, restoring the build script corresponding to the initial compilation instructions, thereby avoiding permanent modifications to the build script. This avoids intrusive pollution of the build script, ultimately achieving non-intrusive compilation tuning.
[0086] In one embodiment, the termination method of the iterative process of the compilation flow, in addition to achieving the expected effect as described in the above embodiments, may also include at least one of the following: the number of iterations reaches a preset number and the total compilation time reaches a preset time. Of course, other termination methods may also be included, which are not limited here.
[0087] In one embodiment, an automated build tool capable of implementing the above-described compilation methods can be integrated into the build phase of a continuous integration / continuous delivery pipeline. By invoking the automated build tool to perform the compilation operation, continuous optimization of project performance can be achieved. Since the automated build tool is a standalone binary file that can start the compiler and complete the entire compilation and optimization process based on a configuration file, it is well-suited for integration into the build phase of a continuous integration / continuous delivery pipeline. Of course, the automated build tool can be triggered using user-defined trigger conditions (e.g., user code submissions), scheduled tasks, or other methods.
[0088] Based on the same inventive concept, this application also provides a compilation apparatus for implementing the compilation method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more compilation apparatus embodiments provided below can be found in the limitations of the compilation method described above, and will not be repeated here.
[0089] In one exemplary embodiment, a compilation apparatus is provided, see [link to example]. Figure 5 The device includes: a first acquisition module 510, a first determination module 520, a first modification module 530, a first processing module 540, a second determination module 550, and a continuation execution module 560, wherein:
[0090] The first acquisition module 510 is used to acquire task data corresponding to the compilation task; the task data includes the file to be compiled and the initial compilation instructions.
[0091] The first determining module 520 is used to determine the corresponding target compilation adjustment parameters based on the programming language used in the file to be compiled;
[0092] The first modification module 530 is used to modify the compilation instructions under the previous compilation process according to the target compilation adjustment parameters for each compilation process, so as to obtain the compilation instructions under the current compilation process; wherein, the compilation instructions under the first compilation process are the initial compilation instructions.
[0093] The first processing module 540 is used to compile the file to be compiled according to the compilation instructions under this compilation process; run the compilation results and obtain the running performance data of this compilation process;
[0094] The second determining module 550 is used to determine whether the current compilation effect has achieved the expected effect based on the running performance data of this compilation process;
[0095] Continue execution module 560, which is used to continue the next compilation process if the expected result is not achieved, until the current compilation result achieves the expected result.
[0096] In one embodiment, the first determining module is specifically used to: extract programming language features from the file to be compiled to obtain programming language features; and obtain target compilation adjustment parameters corresponding to the programming language features based on a pre-established mapping relationship; wherein the mapping relationship includes a correspondence between at least one candidate programming language feature and at least one candidate compilation adjustment parameter.
[0097] In one embodiment, the second determining module includes:
[0098] The first determining unit is used to determine the degree of performance improvement in the current compilation process based on the runtime performance data of the current compilation process.
[0099] The second determining unit is used to determine whether the current compilation effect has achieved the expected effect based on the relationship between the performance improvement and the preset threshold.
[0100] In one embodiment, the second determining unit is configured to perform any one of the following: if the performance improvement is less than a preset threshold, determine that the current compilation effect has reached the expected effect; if the performance improvement is not less than the preset threshold, determine that the current compilation effect has not reached the expected effect.
[0101] In one embodiment, the first modification module includes: a first adjustment unit, configured to adjust the parameter values of the target compilation adjustment parameters based on the runtime performance data of the previous compilation process; and a first addition module, configured to add the adjusted target compilation adjustment parameters to the compilation instructions under the previous compilation process to obtain the compilation instructions under the current compilation process.
[0102] In one embodiment, the first adding module is specifically used to: add the adjusted target compilation adjustment parameters to the compilation instructions under the previous compilation process by means of compilation instrumentation, so as to obtain the compilation instructions under the current compilation process.
[0103] Each module in the aforementioned compilation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0104] In one exemplary embodiment, a computer device is provided, the internal structure of which can be as shown in the figure. Figure 6As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a compilation method.
[0105] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0106] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the compilation methods provided in the above embodiments.
[0107] In one embodiment, a computer-readable storage medium is provided on which a computer program is stored, which, when executed by a processor, implements the compilation methods provided in the above embodiments.
[0108] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the compilation methods provided in the above embodiments.
[0109] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0110] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0111] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0112] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method of compiling, characterized by, The method comprises the following steps: obtaining task data corresponding to a compilation task; the task data comprises a to-be-compiled file and initial compilation instructions; determining target compilation adjustment parameters corresponding to a programming language used by the to-be-compiled file; for each compilation process, modifying the compilation instructions of a previous compilation process according to the target compilation adjustment parameters to obtain the compilation instructions of the current compilation process; the compilation instructions of the first compilation process are the initial compilation instructions; compiling the to-be-compiled file according to the compilation instructions of the current compilation process; running the compilation result and obtaining the running performance data of the current compilation process; determining whether the current compilation effect reaches an expected effect according to the running performance data of the current compilation process; if the current compilation effect does not reach the expected effect, continuing to perform the next compilation process until the current compilation effect reaches the expected effect.
2. The method of claim 1, wherein, The method comprises the following steps: extracting programming language features of the to-be-compiled file to obtain programming language features; obtaining target compilation adjustment parameters corresponding to the programming language features based on a pre-established mapping relationship; The mapping relationship comprises a corresponding relationship between at least one candidate programming language feature and at least one candidate compilation adjustment parameter.
3. The method according to claim 1 or 2, characterized in that, The method comprises the following steps: determining a performance improvement degree of the current compilation process according to the running performance data of the current compilation process; determining whether the current compilation effect reaches the expected effect according to the size relationship between the performance improvement degree and a preset threshold.
4. The method of claim 3, wherein, The method comprises the following steps: if the performance improvement degree is lower than the preset threshold, determining that the current compilation effect reaches the expected effect; if the performance improvement degree is not lower than the preset threshold, determining that the current compilation effect does not reach the expected effect.
5. The method according to claim 1 or 2, characterized in that, The method comprises the following steps: adjusting the target compilation adjustment parameters according to the running performance data of the previous compilation process; adding the adjusted target compilation adjustment parameters to the compilation instructions of the previous compilation process to obtain the compilation instructions of the current compilation process.
6. The method of claim 5, wherein, The method comprises the following steps: adding the adjusted target compilation adjustment parameters to the compilation instructions of the previous compilation process to obtain the compilation instructions of the current compilation process by using a compilation insertion method.
7. A compiling apparatus characterized by comprising: The method comprises the following steps: a first obtaining module is configured to obtain task data corresponding to a compilation task; the task data comprises a to-be-compiled file and initial compilation instructions; a first determining module is configured to determine target compilation adjustment parameters corresponding to a programming language used by the to-be-compiled file; The first modification module is configured to modify the compiling instruction under the previous compiling process according to the target compiling adjustment parameter, so as to obtain the compiling instruction under the current compiling process; and the compiling instruction under the first compiling process is the initial compiling instruction. The first processing module is configured to compile the to-be-compiled file according to the compiling instruction under the current compiling process; run the compiling result; and obtain the running performance data of the current compiling process. The second determining module is configured to determine whether the current compiling effect reaches the expected effect according to the running performance data of the current compiling process. The continuing execution module is configured to continue to execute the next compiling process until the current compiling effect reaches the expected effect, in the case that the expected effect is not reached. 8.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-7. The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 6.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 6.