CN111324353B - Optimization method and device for continuous integration task - Google Patents

Optimization method and device for continuous integration task Download PDF

Info

Publication number
CN111324353B
CN111324353B CN201811533618.9A CN201811533618A CN111324353B CN 111324353 B CN111324353 B CN 111324353B CN 201811533618 A CN201811533618 A CN 201811533618A CN 111324353 B CN111324353 B CN 111324353B
Authority
CN
China
Prior art keywords
code
task
code module
module
continuous integration
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811533618.9A
Other languages
Chinese (zh)
Other versions
CN111324353A (en
Inventor
乔中兴
张翼飞
李伟光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Hangzhou Information Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Hangzhou Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Hangzhou Information Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201811533618.9A priority Critical patent/CN111324353B/en
Publication of CN111324353A publication Critical patent/CN111324353A/en
Application granted granted Critical
Publication of CN111324353B publication Critical patent/CN111324353B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation
    • G06F8/4441Reducing the execution time required by the program code

Abstract

The application discloses a method and a device for optimizing a continuous integration task, wherein the method comprises the following steps: in the software development process, a source code in a software version library is obtained, actual consumed time of at least one code module continuous integration task included in the source code is determined, theoretical consumed time of the at least one code module continuous integration task is determined based on the code amount of the at least one code module and the actual consumed time, whether the difference between the actual consumed time and the theoretical consumed time of the code module continuous integration task in the at least one code module is larger than a preset threshold value or not is judged, and if the difference is larger than the preset threshold value, the code module continuous integration task is optimized based on a task optimization strategy, so that the consumed time of the code module continuous integration task is reduced. The technical problem that software is continuously delivered with low efficiency in the prior art is solved.

Description

Optimization method and device for continuous integration task
Technical Field
The application relates to the technical field of software development, in particular to a method and a device for optimizing a continuous integration task.
Background
In the process of software development, in order to discover errors of software integration as early as possible, it is generally necessary to integrate the work of a plurality of development members, each member integrates at least once a day, that is, multiple integrations may occur each day, each integration is verified by automated construction, such as compilation, release and automatic testing, to discover integration errors, and therefore, continuous integration is an important software development practice for software development.
At present, the efficiency of the continuous integration tasks in the software development process is generally detected by detecting the total time consumption of a plurality of continuous integration tasks, and the efficiency of each continuous integration task is not detected separately, so that the inefficient continuous integration tasks in the software development process cannot be identified, and the inefficient continuous integration tasks cannot be optimized, thereby resulting in lower efficiency of the continuous software delivery.
Disclosure of Invention
The application provides an optimization method and device for a continuous integrated task, which are used for solving the technical problem that the efficiency of continuous delivery of software is low in the prior art.
In a first aspect, the present application provides a method for optimizing a persistent integration task, the method comprising: in the software development process, a source code in a software version library is obtained, actual time consumption of at least one code module continuous integration task included in the source code is determined, theoretical time consumption of the at least one code module continuous integration task is determined based on the code amount of the at least one code module and the actual time consumption, whether the difference between the actual time consumption and the theoretical time consumption of the code module continuous integration task in the at least one code module is larger than a preset threshold value or not is judged, and if the difference is larger than the preset threshold value, the code module continuous integration task is optimized based on a task optimization strategy, so that the time consumption of the code module continuous integration task is reduced.
In the scheme provided by the embodiment of the application, in the process of software development, the actual time consumption and the theoretical time consumption of each code module continuous integration task in a source code of software are determined, whether the continuous integration task of the code module is optimized or not is determined by determining the deviation between the actual time consumption and the theoretical time consumption, and the continuous integration task of the code module with larger deviation between the actual time consumption and the theoretical time consumption is optimized, so that the time consumption of the code module continuous integration task is reduced, and the efficiency of software continuous delivery is further improved.
Optionally, determining a theoretical elapsed time for the at least one code module to continue the integration task based on the amount of code of the at least one code module and the actual elapsed time comprises:
classifying the at least one code module based on a type of the code module, wherein the at least one code module comprises JAVA classes, Android classes, and IOS classes;
dividing code modules of the same type into a plurality of groups based on the code amount of the code modules, wherein each group includes a plurality of code modules;
determining a theoretical time consumption of the respective code modules in each group for the continued integration task based on the actual time consumption and the code amount of the respective code modules in each group for the continued integration task.
In the scheme provided by the embodiment of the application, at least one code module is classified according to the type of the code module, a plurality of code modules of the same type are divided into a plurality of groups based on the code amount of the code module, and the theoretical time consumption of the continuous integration task of each code module in each group is determined, so that the theoretical time consumption of the continuous integration task of at least one code module is calculated in groups, and the accuracy of calculating the theoretical time consumption of the continuous integration task of the code module is improved.
Optionally, determining a theoretical time consumption of the continuous integration task of the respective code modules in each group based on the actual time consumption and the code amount of the continuous integration task of the respective code modules in each group includes:
obtaining a set of discrete data based on the actual consumed time and the code amount of each code module in each set of continuous integration tasks;
performing data fitting on the discrete data to obtain a best fit curve corresponding to the discrete data;
and obtaining the theoretical time consumption of each code module continuous integration task in each group based on the best fit curve.
In the scheme provided by the embodiment of the application, a group of discrete data is obtained based on the code amount of the same group of code modules and the actual time consumption of the continuous integration task, the optimal fitting curve corresponding to the discrete data is determined through a data fitting method, and the theoretical time consumption of the continuous integration task of the code modules is obtained based on the optimal fitting curve, so that the obtained theoretical time consumption of the continuous integration task of the code modules is more accurate.
Alternatively, the code modules of the same type are divided into a plurality of groups based on the code amount of the code modules, including:
and dividing the code modules of the same type into multiple groups based on a preset range of a plurality of code amounts, wherein the code amounts of the code modules of the same group are within the same preset range of code amounts.
Optionally, optimizing the code module persistent integration task based on a task optimization policy includes optimizing the code module persistent integration task based on one or more of the following policies:
judging whether the code module continuously integrates the tasks and has at least two times of same operation;
if so, retaining any one of the at least two identical operations; or
Judging whether each continuous integrated task of the code module is constructed in the same working space;
if not, taking the working space of any continuous integration task as a shared working space, wherein each continuous integration task is constructed in the shared space; or
Judging whether the code of the code module continuous integration task and the feedback report of the continuous integration task are stored in the same directory;
and if so, changing the codes of the continuous integration tasks or the directory saved by the feedback report.
In the scheme provided by the embodiment of the application, the code module continuous integration task is optimized by at least one strategy of reserving any one of at least two times of same operations in the code module continuous integration task, constructing each continuous integration task in the same shared working space, or storing the code of the code module continuous integration task and the feedback report of the continuous integration task in different catalogs, so that the optimization effect of the code module continuous integration task is improved.
Optionally, optimizing the code module persistent integration task based on a task optimization policy further includes:
if the code module is a JAVA class, adding a first compiling parameter in a compiling task of a continuous integrating task of the code module, and starting a multi-thread multi-core to execute the compiling task based on the first compiling parameter, wherein the first compiling parameter comprises an indication parameter for starting multi-thread or an indication parameter for starting the multi-core; or
If the code module is Android, adding a second compiling parameter in a compiling task of a continuous integrating task of the code module, and starting a daemon thread and expanding a running memory based on the second compiling parameter, wherein the second compiling parameter comprises an indicating parameter for starting the daemon thread or an indicating parameter for expanding the running memory; or
And if the code module is an IOS type, adding a domestic mirror image in a compiling environment of the continuous integration task of the code module.
In the scheme provided by the embodiment of the application, the continuous integration task of the code modules is constructed and optimized by adopting different strategies for the code modules of different types, so that the flexibility of the continuous integration task optimization of the code modules is improved.
In a second aspect, the present application provides an apparatus for optimizing a persistent integration task, the apparatus comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a source code in a software version library in the software development process and determining the actual consumed time of at least one code module contained in the source code for continuously integrating tasks;
a determining module, configured to determine a theoretical elapsed time for the at least one code module to continue the integration task based on the code amount of the at least one code module and the actual elapsed time;
the judging module is used for judging whether the difference between the actual time consumption and the theoretical time consumption of the code module continuous integration task in the at least one code module is larger than a preset threshold value;
and the processing module is used for optimizing the continuous integration task of the code module based on a task optimization strategy if the continuous integration task of the code module exists, so that the time consumption of the continuous integration task of the code module is reduced.
Optionally, the processing module is specifically configured to classify the at least one code module based on a type of the code module, where the at least one code module includes JAVA classes, Android classes, and IOS classes;
the processing module is further specifically configured to divide the code modules of the same type into a plurality of groups based on the code amount of the code modules, where each group includes a plurality of code modules;
the determining module is specifically configured to determine theoretical time consumption of the continuous integration task of each code module in each group based on the actual time consumption and the code amount of the continuous integration task of each code module in each group.
Optionally, the determining module is specifically configured to:
obtaining a set of discrete data based on the actual consumed time and the code amount of each code module in each set of continuous integration tasks;
performing data fitting on the discrete data to obtain a best fit curve corresponding to the discrete data;
and obtaining the theoretical time consumption of each code module continuous integration task in each group based on the best fit curve.
Optionally, the processing module is specifically configured to:
and dividing the code modules of the same type into multiple groups based on a preset range of a plurality of code amounts, wherein the code amounts of the code modules of the same group are within the same preset range of code amounts.
Optionally, the processing module is specifically configured to:
judging whether the code module continuously integrates the tasks and has at least two times of same operation;
if so, retaining any one of the at least two identical operations; or
Judging whether each continuous integrated task of the code module is constructed in the same working space;
if not, taking the working space of any continuous integration task as a shared working space, wherein each continuous integration task is constructed in the shared space; or
Judging whether the code of the code module continuous integration task and the feedback report of the continuous integration task are stored in the same directory;
and if so, changing the codes of the continuous integration tasks or the directory saved by the feedback report.
Optionally, the processing module is further configured to:
if the code module is a JAVA class, adding a first compiling parameter in a compiling task of a continuous integrating task of the code module, and starting a multi-thread multi-core to execute the compiling task based on the first compiling parameter, wherein the first compiling parameter comprises an indication parameter for starting multi-thread or an indication parameter for starting the multi-core; or
If the code module is Android, adding a second compiling parameter in a compiling task of a continuous integrating task of the code module, and starting a daemon thread and expanding a running memory based on the second compiling parameter, wherein the second compiling parameter comprises an indicating parameter for starting the daemon thread or an indicating parameter for expanding the running memory; or
And if the code module is an IOS type, adding a domestic mirror image in a compiling environment of the continuous integration task of the code module.
In a third aspect, the present application provides an electronic device comprising:
a memory for storing instructions for execution by the processor;
a processor for executing instructions stored in the memory to perform the method of the first aspect.
In a fourth aspect, the present application provides a computer readable storage medium having stored thereon computer instructions which, when run on a computer, cause the computer to perform the method of the first aspect.
Drawings
FIG. 1 is a flowchart of a method for optimizing persistent integration tasks according to an embodiment of the present disclosure;
FIG. 2 is a schematic structural diagram of an apparatus for optimizing persistent integration tasks according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In the solutions provided in the embodiments of the present application, the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In order to better understand the technical solutions, the technical solutions of the present application are described in detail below with reference to the drawings and specific embodiments, and it should be understood that the specific features in the embodiments and examples of the present application are detailed descriptions of the technical solutions of the present application, and are not limitations of the technical solutions of the present application, and the technical features in the embodiments and examples of the present application may be combined with each other without conflict.
Example one
The method for optimizing the persistent integration task provided by the embodiment of the present application is further described in detail below with reference to the drawings in the specification, and a specific implementation manner of the method may include the following steps (a method flow is shown in fig. 1):
step 101, in a software development process, an electronic device acquires a source code in a software version library, and determines actual consumed time of a continuous integration task of at least one code module included in the source code.
In the software development process, a source code of software is stored in a database of an electronic device to obtain a software version library, the electronic device obtains the source code of the software from the software version library, and the source code comprises at least one code module, wherein the code module can be a function code module or other code modules, and is not limited herein.
And 102, the electronic equipment determines the theoretical time consumption of the at least one code module for continuing the integration task based on the code amount of the at least one code module and the actual time consumption.
Different code modules can use different compiling tools and compiling environments, and the code modules are divided into JAVA classes, Android classes and IOS classes based on the difference of the compiling tools and the compiling environments of the code modules. Therefore, the electronic device determines a theoretical elapsed time for the at least one code module to continue the integration task based on the code amount of the at least one code module and the actual elapsed time, including:
classifying the at least one code module based on the type of the code module, wherein the at least one code module comprises JAVA, Android and IOS, the code modules of the same type are divided into a plurality of groups based on the code amount of the code module, each group comprises a plurality of code modules, and the theoretical consumed time of the continuous integration task of each code module in each group is determined based on the actual consumed time and the code amount of the continuous integration task of each code module in each group.
Specifically, when a code module constructs a persistent integration task, because different types of code modules construct different compiling tools, constructing tools, and compiling environments of the persistent integration task, the time consumption of the persistent integration task of the different types of code modules is different, the electronic device classifies the code modules into JAVA class, Android class, and IOS class based on the types of the code modules, where the same type includes a plurality of code modules, for example, JAVA class code modules, a JAVA Development Kit (JDK) as a compiler using JAVA language, a mailroom (Maven) as a constructing tool, and runs on a Community Enterprise Operating System (Cent OS); the Android code module uses JDK, Software Development Kit (SDK), a Danu plan Compiler suite (GNU Compiler Collection, GCC) and the like as compilers, uses Gradle as a construction tool and runs on the Ubuntu system of Help friend Development; the IOS class code module uses a Low Level Virtual Machine (LLVM) as a compiler, Xcode as a building tool, and runs on an apple operating system (Mac OS).
Further, for code modules of the same type, due to different types and logics of services, the complexity of the code modules is also different, and the complexity of a general code module is measured by the amount of code, where the amount of code refers to the number of lines of a code of the code module, and the more the amount of code of the code module, the more time it takes for the code module to continuously integrate a task, and therefore, in order to determine the time it takes for code modules of similar complexity to continuously integrate a task, the electronic device groups a plurality of code modules of the same type, wherein there are a plurality of ways to group a plurality of code modules of the same type, and the specific way is as follows:
mode 1, the electronic device sorts a plurality of code modules of the same type based on the amount of code, and divides the plurality of code modules of the same type into a plurality of groups based on the number of preset code modules of each group, wherein each group includes a plurality of code modules.
Mode 2 is to store a plurality of preset ranges of code amounts in the electronic device database, for example, the preset ranges of the plurality of code amounts include: the number of lines of the code is [1, 500], [501, 1000], [1000, 5000], [5000, 10000], and the like, and the electronic device divides the code modules of the same type into multiple groups based on a preset range of a plurality of code amounts, wherein the code amounts of the code modules of the same group are within the same preset range of code amounts.
Further, the electronic device determines, based on the actual elapsed time and the code amount of the continuous integration task of the respective code modules in each group, a theoretical elapsed time for the continuous integration task of the respective code modules in each group, including: obtaining a group of discrete data based on the actual consumed time and the code amount of each code module continuous integration task in each group, performing data fitting on the discrete data to obtain an optimal fitting curve corresponding to the discrete data, and obtaining the theoretical consumed time of each code module continuous integration task in each group based on the optimal fitting curve.
Specifically, for a plurality of code modules in the same group, the electronic device obtains a group of discrete data (x) based on the code amount of each code module and the actual time-consuming data of the continuous integration task i ,y i ) And then, performing data fitting on the discrete data to obtain a best fit curve.
The method for performing data fitting on the multiple discrete data of the electronic equipment has various methods, for example, a least square method and a method for approximating the discrete data by using an analytic expression, and the method can perform data fitting on the discrete data by using the least square method, and the specific process is as follows:
first, assume a fitting function of
Figure BDA0001906321860000091
The square sum of the actual time consumption of the continuous integration task of the code module and the error of the fitting function is obtained based on the fitting function, and the mean square error equation is obtained
Figure BDA0001906321860000092
Figure BDA0001906321860000093
Where N represents the number of code modules in each group, and N is a positive integer greater than 1.
Then, based on the mean square error equation Q, an n-order fitting function that minimizes the mean square error is solved:
Figure BDA0001906321860000094
wherein n is a positive integer not less than 1.
Then substituting the fitting function into a mean square error equation to obtain:
Figure BDA0001906321860000095
and then, solving an extreme value of the mean square error equation to obtain a normal equation set of a fitting curve:
Figure BDA0001906321860000096
obtaining a coefficient a of a best-fit curve based on the equation set 0 ,a 1 ,……,a n And further obtaining a best fit curve, and determining the theoretical time consumption of each code module for continuous integration tasks based on the best fit curve.
Step 103, judging whether the difference between the actual time consumption and the theoretical time consumption of the code module continuous integration task in the at least one code module is larger than a preset threshold value.
Specifically, a threshold of the time consumption ratio may be preset in the electronic device, for example, the threshold is 20% or 30%, where the time consumption ratio is ((theoretical time consumption-actual time consumption)/actual time consumption) × 100%, and whether the time consumption ratio of each module is greater than the threshold of the time consumption ratio may be determined by calculating the time consumption ratio of at least one code module.
Or a threshold value can be preset in the electronic device, the difference value between the theoretical time consumption and the actual time consumption of the continuous integration task of each code module is determined, and whether the difference value between the theoretical time consumption and the actual time consumption is larger than the preset threshold value or not is judged.
And 104, if the task optimization strategy exists, optimizing the continuous integration task of the code module based on the task optimization strategy, so that the time consumption of the continuous integration task of the code module is reduced.
The electronic equipment optimizes the code module continuous integration task based on the task optimization strategy, and comprises the following steps of optimizing the code module continuous integration task based on one or more of the following strategies:
1. judging whether the code module continuously integrates the tasks and has at least two times of same operation;
if so, retaining any one of the at least two identical operations;
specifically, the electronic device constructs different integration tasks based on operations, the continuous integration tasks are connected in series to achieve continuous delivery of software, the same operations may exist in the continuous integration task construction process of each code module, but the operations executed first do not need to be executed repeatedly in the subsequent process, so that the time consumption of the continuous integration task of the code module is reduced in order to avoid the repeated execution of the same operations of the code module in the continuous integration task process, the electronic device detects whether the same operations exist at least twice in the code module continuous integration task which consumes more time, and if the same operations exist, any one of the at least two same operations is reserved.
2. Judging whether each continuous integrated task of the code module is constructed in the same working space;
if not, taking the working space of any continuous integration task as a shared working space, wherein each continuous integration task is constructed in the shared space;
specifically, in the process of executing the continuous integration tasks by the electronic device, task engineering codes need to be downloaded every time the integration tasks are executed, in order to avoid downloading the engineering codes for multiple times in the process of executing the continuous integration tasks, the electronic device detects whether code module continuous integration tasks which consume much time are constructed in the same working space, and if not, the working space of any continuous integration task is taken as a shared working space, wherein each continuous integration task is constructed in the shared space.
3. Judging whether the code of the code module continuous integration task and the feedback report of the continuous integration task are stored in the same directory;
and if so, changing the codes of the continuous integration tasks or the directory saved by the feedback report.
Specifically, in the process of integrating tasks by the electronic device, after a feedback report is generated by a continuous integration task of the code module, the electronic device scans all files under the directory according to a directory name stored in the feedback report, and if a code of the continuous integration task of the code module and the feedback report of the continuous integration task are stored in the same directory, the electronic device scans not only the feedback report file but also the code of the continuous integration task when scanning the directory, so that the time for the electronic device to collect the report is increased.
According to the scheme provided by the embodiment of the application, in the process of software development, the actual time consumption and the theoretical time consumption of each code module continuous integration task in the source code of the software are determined, whether the continuous integration task of the code module is optimized or not is determined by determining the deviation between the actual time consumption and the theoretical time consumption, and the continuous integration task of the code module with larger deviation between the actual time consumption and the theoretical time consumption is optimized, so that the time consumption of the code module continuous integration task is reduced, and the efficiency of software continuous delivery is further improved.
For example, in a JAVA code module with a code amount of 2000 lines, the compiling task actually takes 60 seconds, and the calculation is performed according to a fitting function curve, in the code magnitude of 2000 lines, the time consumption theoretical value of the compiling task is 30 seconds, the time consumption proportion is 100%, and exceeds a preset threshold value of 20%, the electronic device detects whether there are at least two identical operations in the compiling task, and if so, any one of the at least two identical operations is retained.
Further, to increase flexibility of continuous integration task optimization of code modules. The electronic equipment optimizes the continuous integration task of the code module based on the task optimization strategy, and the method further comprises the following steps:
if the code module is a JAVA class, adding a first compiling parameter in a compiling task of a continuous integrating task of the code module, and starting a multi-thread multi-core to execute the compiling task based on the first compiling parameter, wherein the first compiling parameter comprises an indication parameter for starting multi-thread or an indication parameter for starting the multi-core; or
If the code module is Android, adding a second compiling parameter in a compiling task of a continuous integrating task of the code module, and starting a daemon thread and expanding a running memory based on the second compiling parameter, wherein the second compiling parameter comprises an indicating parameter for starting the daemon thread or an indicating parameter for expanding the running memory; or
And if the code module is an IOS type, adding a domestic mirror image in a compiling environment of the continuous integration task of the code module.
In the scheme provided by the embodiment of the application, different strategies are adopted for different types of code modules to optimize the continuous integration task, so that the flexibility of the optimization of the continuous integration task of the code modules is improved.
Example two
The present application provides a device for continuously integrating task optimization, as shown in fig. 2, the device includes:
an obtaining module 201, configured to obtain a source code in a software version library in a software development process, and determine actual time consumption of a continuous integration task of at least one code module included in the source code;
a determining module 202, configured to determine a theoretical elapsed time for the at least one code module to continue the integration task based on the code amount of the at least one code module and the actual elapsed time;
a judging module 203, configured to judge whether a difference between the actual consumed time and the theoretical consumed time of the code module continuous integration task in the at least one code module is greater than a preset threshold;
and the processing module 204 is configured to optimize the code module continuous integration task based on a task optimization strategy if the code module continuous integration task exists, so that time consumption of the code module continuous integration task is reduced.
Optionally, the processing module 204 is specifically configured to classify the at least one code module based on a type of the code module, where the at least one code module includes JAVA class, Android class, and IOS class;
the processing module 204 is further specifically configured to divide the code modules of the same type into a plurality of groups based on the code amount of the code modules, where each group includes a plurality of code modules;
the determining module 202 is specifically configured to determine the theoretical time consumption of the continuous integration task of each code module in each group based on the actual time consumption and the code amount of the continuous integration task of each code module in each group.
Optionally, the determining module 202 is specifically configured to:
obtaining a set of discrete data based on the actual consumed time and the code amount of each code module in each set of continuous integration tasks;
performing data fitting on the discrete data to obtain a best fit curve corresponding to the discrete data;
and obtaining the theoretical time consumption of each code module continuous integration task in each group based on the best fit curve.
Optionally, the processing module 204 is specifically configured to:
and dividing the code modules of the same type into multiple groups based on a preset range of a plurality of code amounts, wherein the code amounts of the code modules of the same group are within the same preset range of code amounts.
Optionally, the processing module 204 is specifically configured to:
judging whether the code module continuously integrates the tasks and whether the same operation exists at least twice;
if so, reserving any one operation in the at least two same operations; or
Judging whether each continuous integrated task of the code module is constructed in the same working space;
if not, taking the working space of any continuous integration task as a shared working space, wherein each continuous integration task is constructed in the shared working space; or
Judging whether the code of the code module continuous integration task and the feedback report of the continuous integration task are stored in the same directory;
and if so, changing the codes of the continuous integration tasks or the directory saved by the feedback report.
Optionally, the processing module 204 is further configured to:
if the code module is a JAVA class, adding a first compiling parameter in a compiling task of a continuous integrating task of the code module, and starting a multi-thread multi-core to execute the compiling task based on the first compiling parameter, wherein the first compiling parameter comprises an indication parameter for starting multi-thread or an indication parameter for starting the multi-core; or
If the code module is Android, adding a second compiling parameter in a compiling task of a continuous integrating task of the code module, and starting a daemon thread and expanding a running memory based on the second compiling parameter, wherein the second compiling parameter comprises an indicating parameter for starting the daemon thread or an indicating parameter for expanding the running memory; or
And if the code module is an IOS type, adding a domestic mirror image in a compiling environment of the continuous integration task of the code module.
EXAMPLE III
The present application provides an electronic device, as shown in fig. 3, including:
a memory 301 for storing instructions executed by the processor;
the processor 302 is configured to execute instructions stored in the memory to perform the method of the first embodiment.
Example four
The present application provides a computer-readable storage medium having stored thereon computer instructions which, when executed on a computer, cause the computer to perform the method of embodiment one.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (8)

1. A method for optimizing a persistent integration task, comprising:
in the software development process, acquiring a source code in a software version library, and determining the actual time consumption of at least one code module contained in the source code for continuously integrating tasks;
determining a theoretical elapsed time for the at least one code module to continue the integration task based on the amount of code of the at least one code module and the actual elapsed time;
judging whether the difference between the actual time consumption and the theoretical time consumption of the code module continuous integration task in the at least one code module is larger than a preset threshold value or not;
if the code module continuous integration task exists, optimizing the code module continuous integration task based on a task optimization strategy, so that the time consumption of the code module continuous integration task is reduced;
the determining the theoretical elapsed time of the at least one code module for the continued integration task based on the amount of code of the at least one code module and the actual elapsed time comprises:
classifying the at least one code module based on a type of the code module, wherein the at least one code module comprises JAVA classes, Android classes, and IOS classes;
dividing code modules of the same type into a plurality of groups based on the code amount of the code modules, wherein each group includes a plurality of code modules;
determining a theoretical elapsed time for the continued integration task of the respective code modules in each group based on the actual elapsed time and the amount of code for the continued integration task of the respective code modules in each group.
2. The method of claim 1, wherein determining a theoretical elapsed time for continued integration of the tasks for the respective code modules in each group based on the actual elapsed time and the amount of code for the continued integration of the tasks for the respective code modules in each group comprises:
obtaining a set of discrete data based on the actual consumed time and the code amount of each code module in each set of continuous integration tasks;
performing data fitting on the discrete data to obtain a best fit curve corresponding to the discrete data;
and obtaining the theoretical time consumption of each code module continuous integration task in each group based on the best fit curve.
3. The method of claim 1, wherein grouping code modules of a same type into a plurality of groups based on a code amount of the code modules comprises:
and dividing the code modules of the same type into multiple groups based on a preset range of a plurality of code amounts, wherein the code amounts of the code modules of the same group are within the same preset range of code amounts.
4. The method of claim 3, wherein optimizing the code module persistent integration task based on a task optimization policy comprises optimizing the code module persistent integration task based on one or more of the following policies:
judging whether the code module continuously integrates the tasks and whether the same operation exists at least twice;
if so, retaining any one of the at least two identical operations; or
Judging whether each continuous integrated task of the code module is constructed in the same working space;
if not, taking the working space of any continuous integration task as a shared working space, wherein each continuous integration task is constructed in the shared working space; or
Judging whether the code of the code module continuous integration task and the feedback report of the continuous integration task are stored in the same directory;
and if so, changing the codes of the continuous integration tasks or the directory saved by the feedback report.
5. The method of any of claims 1-4, wherein optimizing the code module persistent integration task based on a task optimization policy, further comprises:
if the code module is a JAVA class, adding a first compiling parameter in a compiling task of a continuous integrating task of the code module, and starting a multi-thread multi-core to execute the compiling task based on the first compiling parameter, wherein the first compiling parameter comprises an indication parameter for starting multi-thread or an indication parameter for starting the multi-core; or
If the code module is Android, adding a second compiling parameter in a compiling task of a continuous integrating task of the code module, and starting a daemon thread and expanding a running memory based on the second compiling parameter, wherein the second compiling parameter comprises an indicating parameter for starting the daemon thread or an indicating parameter for expanding the running memory; or
And if the code module is an IOS type, adding a domestic mirror image in a compiling environment of the continuous integration task of the code module.
6. An apparatus for optimizing a persistent integration task, comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a source code in a software version library in the software development process and determining the actual consumed time of at least one code module contained in the source code for continuously integrating tasks;
a determining module, configured to determine a theoretical elapsed time for the at least one code module to continue the integration task based on the code amount and the actual elapsed time of the at least one code module;
the judging module is used for judging whether the difference between the actual time consumption and the theoretical time consumption of the code module continuous integration task in the at least one code module is larger than a preset threshold value;
the processing module is used for optimizing the code module continuous integration task based on a task optimization strategy if the code module continuous integration task exists, so that the time consumption of the code module continuous integration task is reduced;
the processing module is specifically configured to classify the at least one code module based on a type of the code module, where the at least one code module includes JAVA classes, Android classes, and IOS classes;
the processing module is further specifically configured to divide the code modules of the same type into a plurality of groups based on the code amount of the code modules, where each group includes a plurality of code modules;
the determining module is specifically configured to determine theoretical time consumption of the continuous integration task of each code module in each group based on the actual time consumption and the code amount of the continuous integration task of each code module in each group.
7. An electronic device, comprising:
a memory for storing instructions for execution by the processor;
a processor for executing instructions stored in the memory to perform the method of any one of claims 1-5.
8. A computer-readable storage medium having stored thereon computer instructions which, when executed on a computer, cause the computer to perform the method of any one of claims 1-5.
CN201811533618.9A 2018-12-14 2018-12-14 Optimization method and device for continuous integration task Active CN111324353B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811533618.9A CN111324353B (en) 2018-12-14 2018-12-14 Optimization method and device for continuous integration task

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811533618.9A CN111324353B (en) 2018-12-14 2018-12-14 Optimization method and device for continuous integration task

Publications (2)

Publication Number Publication Date
CN111324353A CN111324353A (en) 2020-06-23
CN111324353B true CN111324353B (en) 2022-09-13

Family

ID=71170202

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811533618.9A Active CN111324353B (en) 2018-12-14 2018-12-14 Optimization method and device for continuous integration task

Country Status (1)

Country Link
CN (1) CN111324353B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113448561B (en) * 2021-09-02 2021-12-14 广州嘉为科技有限公司 CI-based differential analysis method for automation demand progress and management server

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2002071214A1 (en) * 2001-03-05 2002-09-12 Cadence Design Systems, Inc. Method and apparatus for a statistically based estimate of embedded software execution time
WO2012081024A1 (en) * 2010-12-16 2012-06-21 Eyal Ben-Avraham System and method for optimizing parallel compilation of a source code
WO2015200235A1 (en) * 2014-06-25 2015-12-30 Microsoft Technology Licensing, Llc Techniques for edit-and-continue and enhanced optimized debugging on optimized code
CN105868957A (en) * 2015-12-18 2016-08-17 乐视致新电子科技(天津)有限公司 Continuous integration method and device
CN108334313A (en) * 2017-12-27 2018-07-27 苏州中晟宏芯信息科技有限公司 Continuous integrating method, apparatus and code management system for large-scale SOC research and development

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8146065B2 (en) * 2007-08-13 2012-03-27 International Business Machines Corporation Running time of short running applications by effectively interleaving compilation with computation in a just-in-time environment
US20140096104A1 (en) * 2012-09-28 2014-04-03 Hewlett-Packard Development Company, L.P. Comparing Target Effort to Actual Effort for Software Development Requirements
US9027007B2 (en) * 2013-03-06 2015-05-05 Qualcomm Incorporated Reducing excessive compilation times
US9286089B2 (en) * 2014-01-24 2016-03-15 International Business Machines Corporation Just-in time expensive compilation hints
US10067750B2 (en) * 2015-02-23 2018-09-04 Qualcomm Incorporated Whole-program optimization using data from previous compilation runs
CN105867990A (en) * 2015-11-20 2016-08-17 乐视云计算有限公司 Software development integration method and device thereof
US10248545B2 (en) * 2016-02-17 2019-04-02 Parasoft Corporation Method for tracking high-level source attribution of generated assembly language code

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2002071214A1 (en) * 2001-03-05 2002-09-12 Cadence Design Systems, Inc. Method and apparatus for a statistically based estimate of embedded software execution time
WO2012081024A1 (en) * 2010-12-16 2012-06-21 Eyal Ben-Avraham System and method for optimizing parallel compilation of a source code
WO2015200235A1 (en) * 2014-06-25 2015-12-30 Microsoft Technology Licensing, Llc Techniques for edit-and-continue and enhanced optimized debugging on optimized code
CN105868957A (en) * 2015-12-18 2016-08-17 乐视致新电子科技(天津)有限公司 Continuous integration method and device
CN108334313A (en) * 2017-12-27 2018-07-27 苏州中晟宏芯信息科技有限公司 Continuous integrating method, apparatus and code management system for large-scale SOC research and development

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
maven-编译速度优化;YatHo;《https://www.cnblogs.com/yatho/p/7233194.html》;20170725;全文第1页 *
MCI:移动持续集成在大众点评的实践;智聪等;《https://tech.meituan.com/2018/07/12/mci.html》;20180712;全文第1-4,8-16页 *
Unity 构建过程的时间优化;VyronLee;《https://vyronlee.com/2018/03/10/20180310-optimization-of-building-unity-project/》;20180310;全文第1-4页 *
如何将 iOS 工程打包速度提升十倍以上;bestswifter;《https://github.com/bestswifter/blog/blob/master/articles/ios-compile-speed.md 1/》;20180216;全文第1-7页 *
面向代码的软件能耗优化研究进展;宋杰等;《计算机学报》;20161130(第11期);第112-132页 *

Also Published As

Publication number Publication date
CN111324353A (en) 2020-06-23

Similar Documents

Publication Publication Date Title
EP2447838B1 (en) Technique for efficient parallelization of software analysis in a distributed computing environment through intelligent dynamic load balancing
US9256419B2 (en) Dynamic software updates
US8656134B2 (en) Optimized memory configuration deployed on executing code
US20130074093A1 (en) Optimized Memory Configuration Deployed Prior to Execution
US20060236310A1 (en) Methods and apparatus to iteratively compile software to meet user-defined criteria
EP2447841B1 (en) Scheduling policy for efficient parallelization of software analysis in a distributed computing environment
CN104778124A (en) Automatic testing method for software application
CN107729240B (en) Embedded software stack overflow detection method and device
US9329974B2 (en) Technologies for determining binary loop trip count using dynamic binary instrumentation
EP2447840B1 (en) Dynamic and intelligent partial computation management for efficient parallelization of software analysis in a distributed computing environment
WO2017027652A1 (en) Data processing graph compilation
CN111324353B (en) Optimization method and device for continuous integration task
CN113238766A (en) Software deployment method, device and related equipment
CN104978272A (en) Program scheduling method for data race detection
US20170257287A1 (en) Real-time quality of service monitoring apparatus and method
Muthusamy et al. Effectiveness of test case prioritization techniques based on regression testing
CN101551748B (en) Optimized compiling method
CN111966597A (en) Test data generation method and device
CN102968305A (en) Logical processing method, logical processing device and evaluation system
Sondag et al. Phase-guided thread-to-core assignment for improved utilization of performance-asymmetric multi-core processors
Luo et al. Optimal thread-to-core mapping for pipeline programs
KR102022972B1 (en) Runtime management apparatus for heterogeneous multi-processing system and method thereof
CN107015909B (en) Test method and device based on code change analysis
Mosaner et al. Improving Vectorization Heuristics in a Dynamic Compiler with Machine Learning Models
CN111352852A (en) Regression test case selection method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant