A method for analyzing application code execution efficiency
By segmenting and classifying code text, combining time complexity and compensation mode, the problem of insufficient accuracy of code execution efficiency analysis in the existing technology is solved, and more accurate and intelligent code execution efficiency analysis is achieved.
Patent Information
- Application Number
- CN202311664863.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-06
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2043-12-06
AI Technical Summary
In the prior art, the accuracy of code execution efficiency analysis is low, resulting in insufficient analysis accuracy and intelligence.
The code text is segmented through the code segmentation unit, the analysis mode is determined based on the code type and time complexity, and the code with low execution efficiency is classified and compensated, and the code analysis module is used for optimization analysis.
It improves the accuracy and intelligence of code execution efficiency analysis, avoids misjudgment, and achieves more comprehensive code execution efficiency judgment and compensation.
Smart Images

Figure CN118916252B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer software, and in particular to a method for analyzing the execution efficiency of application code. Background Art
[0002] With the development of computer software technology, more and more intelligent electronic devices need to implement functions through code. As the number of functions that electronic devices need to implement increases, the code that needs to be written becomes more and more complex. Therefore, the execution efficiency of the written code has become a hot issue in computer software technology.
[0003] Chinese Patent Publication No. CN104572451A discloses a code efficiency checking method and system, including: a code file acquisition step, including: acquiring an unchecked code file as a current code file, the code file including at least one code line, taking the first code line of the code file as the current code, and performing a code checking step;
[0004] The code checking step includes: checking the current code: if the current code is the start identifier of a loop segment, adding the loop identifier to a preset queue and executing the code end judgment step; if the current code meets the preset efficiency rules and the loop identifier is still stored in the queue, recording an alarm and executing the code end judgment step; if the current code is the end identifier of the loop segment, removing the loop identifier from the queue and executing the code end judgment step;
[0005] The code end judgment step includes: if the code file has a next code, taking the next code as the current code and executing the code checking step; otherwise, executing the project end judgment step;
[0006] The project end judgment step includes: setting the current code file as the checked code file, and if there is an unchecked code file, executing the code file acquisition step, otherwise ending.
[0007] A code efficiency checking system, comprising:
[0008] The code file acquisition module is used to: acquire an unchecked code file as a current code file, wherein the code file includes at least one code line, and use the first code line of the code file as the current code to execute the code checking module;
[0009] The code checking module is used to check the current code: if the current code is the start mark of a loop segment, the loop mark is added to a preset queue and the code end judgment module is executed; if the current code meets the preset efficiency rules and the loop mark is still stored in the queue, an alarm is recorded and the code end judgment module is executed; if the current code is the end mark of a loop segment, the loop mark is removed from the queue and the code end judgment module is executed;
[0010] The code end judgment module is used to: if the code file has a next code, use the next code as the current code and execute the code checking module; otherwise, execute the project end judgment module;
[0011] The project end judgment module is used to: set the current code file as the checked code file, if there is an unchecked code file, execute the code file acquisition module, otherwise end.
[0012] It can be seen that the existing technology has the problem of low accuracy in controlling the code execution efficiency analysis, resulting in insufficient accuracy and low intelligence in the code execution efficiency analysis. Summary of the Invention
[0013] To this end, the present invention provides a method for analyzing application code execution efficiency to overcome the problem of low accuracy of control of code execution efficiency analysis in the prior art, resulting in insufficient accuracy and low intelligence of code execution efficiency analysis.
[0014] To achieve the above-mentioned purpose, a method for analyzing application code execution efficiency includes:
[0015] Step S1: The code segmentation unit of the code acquisition module segments the code text to be analyzed according to the segmentation method to obtain segmented codes, and passes the codes to the code analysis module;
[0016] Step S2: The code analysis module determines an analysis mode for code execution efficiency according to the type of code and the time complexity of the code;
[0017] Step S3: The code classification unit of the code analysis module classifies each segment of code with low execution efficiency according to preset rules, and the space classification unit of the code analysis module classifies the memory space according to preset rules;
[0018] Step S4: The code analysis module determines a compensation mode for the code execution module based on the type of code with low execution efficiency;
[0019] Step S5: The code analysis module determines whether the code execution module optimizes the analysis process based on a comparison result of the improved execution efficiency value and a preset improved execution efficiency value.
[0020] Furthermore, the segmentation method of the code segmentation unit is to segment the code text to be analyzed line by line, and when encountering a code keyword, the code segmentation unit segments the code into segments; the preset rules include the rules for code classification by the code classification unit and the rules for memory space classification by the space classification unit.
[0021] Furthermore, the code analysis module determines an analysis mode based on the code type received after segmentation by the code segmentation unit, and analyzes the code line in a first analysis mode when the code type is a code line, and analyzes the code segment in a second analysis mode when the code type is a code segment.
[0022] Furthermore, the first analysis mode includes that when the code type after segmentation is a code line, the code analysis module determines the execution efficiency of the code based on the comparison result of the execution time of the code line and the preset execution time, and determines that the execution efficiency of the code is low when the execution time of the code line is greater than or equal to the preset execution time, and determines that the execution efficiency of the code is high when the execution time of the code line is less than the preset execution time.
[0023] Furthermore, the first analysis mode also includes the code analysis module determining the execution efficiency of the code segment based on the comparison result of the average execution time of the code lines in the code segment and the preset execution time when the code type after segmentation is a code segment, and determining that the execution efficiency of the code segment is low when the average execution time of the code lines is greater than or equal to the preset execution time, and determining that the execution efficiency of the code segment is high when the average execution time of the code lines is less than the preset execution time.
[0024] Furthermore, the second analysis mode includes the code analysis module determining the execution efficiency of the code based on the comparison result of the time complexity of the code segment and the minimum time complexity, and determining that the execution efficiency of the code segment is low under the condition that the time complexity of the code segment is greater than the minimum time complexity, and determining to analyze the code segment in the first analysis mode under the condition that the time complexity of the code segment is equal to the minimum time complexity.
[0025] Furthermore, when the code analysis module obtains a code segment with low execution efficiency, the code analysis module determines a compensation mode according to the type of the code segment, and determines to compensate the code with the first compensation mode of the code execution module under the condition that the code segment type is a frequently running code; determines to compensate the code with the second compensation mode under the condition that the code segment type is a code with slow execution speed among infrequently running codes; and determines to compensate the code with the third compensation mode under the condition that the code segment type is a code with large code capacity among infrequently running codes.
[0026] Furthermore, the first compensation mode includes the code execution module allocating the code to a tightly coupled memory space; the second compensation mode includes the code execution module allocating the code to a static random access memory space; and the third compensation mode includes the code execution module allocating the code to a static random access memory space.
[0027] Furthermore, the code analysis module performs a secondary analysis of the code execution efficiency of the optimized code text. The code analysis module determines whether the code execution module optimizes the analysis process based on the comparison result of the improved execution efficiency value and the preset improved execution efficiency value, and determines that the code execution module optimizes the analysis process under the condition that the compensation effect is less than the preset compensation effect.
[0028] Furthermore, the preset rules include rules for code classification by a code classification unit, and the code classification unit classifies the code according to the number of executions of each code segment, the execution time and attributes of a single line of code; the preset rules also include rules for memory space classification by a space classification unit, and the space classification unit classifies the storage space according to the running speed.
[0029] Compared with the prior art, the beneficial effect of the present invention lies in that the example of the present invention performs code segmentation on the initial code text through the code segmentation unit set in the data acquisition module, and the segmentation method is line-by-line segmentation, and when the code segmentation unit detects the code keyword, it switches the working mode to segmentation by paragraph; through the above method, the code analysis module can quickly determine the type of the segmented code and then determine the analysis method of the code according to the code type, thereby improving the analysis efficiency of the code execution efficiency and the accuracy of the analysis of the code execution efficiency.
[0030] Furthermore, the example of the present invention determines the execution efficiency of a code segment by calculating the complexity of each code segment. Generally speaking, the higher the time complexity, the lower the code execution efficiency. In addition, the code analysis module adopts a first analysis mode for code segments of the same complexity to determine the execution time of the code and then determine the code execution efficiency. Through the above method, the code analysis module can perform corresponding analysis according to code segments of different complexities, thereby improving the accuracy and controllability of the code execution efficiency analysis, and thereby improving the intelligence of the code execution efficiency analysis.
[0031] Furthermore, the present invention further analyzes the code segment with high time complexity through the code analysis module, so as to judge the code execution efficiency of the code segment with high time complexity and another replaceable code segment, and selects the corresponding method for judgment based on whether the time complexity is the same. Through the above method, the code analysis module can judge the code execution efficiency of the code segment more comprehensively and accurately, avoid misjudging the execution efficiency of the code, and thus improve the accuracy of the code execution efficiency analysis.
[0032] Furthermore, in an example of the present invention, a code classification unit is used to classify codes with low execution efficiency according to preset rules, and a space classification unit is used to classify the storage space of the memory according to preset rules. The code analysis module determines the compensation mode according to the type of the code segment. Through the above method, the code analysis module can more accurately judge the compensation mode according to the type of each code segment, thereby improving the accuracy and intelligence of the code execution efficiency analysis.
[0033] Furthermore, the example of the present invention compensates for the code with low execution efficiency by adding a compensation mode to improve the execution efficiency of the code. The code analysis module allocates the classified code with low execution efficiency to the corresponding storage space according to its type to improve the execution efficiency of the code. Through the above method, the code analysis module can determine the compensation mode for the code with low execution efficiency more comprehensively and accurately, thereby improving the accuracy of the code execution efficiency analysis.
[0034] Furthermore, the present invention determines whether to adjust the preset execution time with an adjustment coefficient by comparing the execution efficiency value improved by the code text with the preset execution efficiency value based on the total execution time obtained by the first code execution efficiency analysis and the total execution time obtained by the second code execution efficiency analysis through the code analysis module. Through the above method, the code analysis module can obtain the execution efficiency value improved by the code text more intuitively and clearly, thereby analyzing the code execution efficiency more accurately. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A diagram illustrating the operational steps of a method for analyzing application code execution efficiency according to an embodiment of the present invention;
[0036] Figure 2 This is a structural diagram of a method for analyzing application code execution efficiency according to an embodiment of the present invention;
[0037] Figure 3 This is a structural diagram of a code analysis module of a method for analyzing application code execution efficiency according to an embodiment of the present invention. DETAILED DESCRIPTION
[0038] In order to make the objects and advantages of the present invention more clearly understood, the present invention is further described below in conjunction with embodiments; it should be understood that the specific embodiments described herein are merely used to explain the present invention and are not intended to limit the present invention.
[0039] The preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.
[0040] It should be noted that, in the description of the present invention, terms such as "up", "down", "left", "right", "inside", and "outside" indicating directions or positional relationships are based on the directions or positional relationships shown in the accompanying drawings. This is only for the convenience of description and does not indicate or imply that the device or element must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it cannot be understood as a limitation on the present invention.
[0041] Furthermore, it should be noted that, in the description of the present invention, unless otherwise expressly specified or limited, the terms "mounted," "connected," and "connected" should be understood in a broad sense. For example, they may refer to fixed connections, detachable connections, or integral connections; mechanical connections or electrical connections; direct connections or indirect connections through an intermediate medium; and internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on specific circumstances.
[0042] An embodiment of the present invention provides a method for analyzing application code execution efficiency, including:
[0043] Step S1: The code segmentation unit of the code acquisition module segments the code text to be analyzed according to the segmentation method to obtain segmented codes, and passes the codes to the code analysis module;
[0044] Step S2: The code analysis module determines an analysis mode for code execution efficiency according to the type of code and the time complexity of the code;
[0045] Step S3: The code classification unit of the code analysis module classifies each segment of code with low execution efficiency according to preset rules, and the space classification unit of the code analysis module classifies the memory space according to preset rules;
[0046] Step S4: The code analysis module determines a compensation mode for the code execution module based on the type of code with low execution efficiency;
[0047] Step S5: The code analysis module determines whether the code execution module optimizes the analysis process based on a comparison result of the improved execution efficiency value and a preset improved execution efficiency value.
[0048] In an embodiment of the present invention, the segmentation method of the code segmentation unit is to segment the code text to be analyzed line by line. When encountering a code keyword, the code segmentation unit segments the code into segments, wherein the code keyword includes but is not limited to "while, for or switch"; the end mark of the segment segmentation is determined according to the code language type, for example, when the code to be analyzed is in C or C++ language, the end mark is "}"; the preset rules include the rules for classifying the code by the code classification unit, and the code classification unit classifies the code according to the number of executions of each code segment, the execution time and attributes of a single line of code; the preset rules also include the rules for classifying the memory space by the space classification unit, and the space classification unit classifies the storage space according to the running speed.
[0049] Specifically, the code classification unit classifies each code segment into frequently-run code and infrequently-run code according to the number of times each code segment is executed; the code classification unit classifies the infrequently-run code into code with slow execution speed and code with large code capacity according to the execution time of a single line of code in each code segment and the number of lines of code in each code segment; the space classification unit classifies the chip memory space into tightly coupled memory space, static random access memory space and dynamic random access memory space according to the running speed, and the running speed decreases from front to back.
[0050] Specifically, when the code analysis module receives that the code type after the code segmentation unit is a code line, it selects the first analysis mode to analyze the code line; when the code analysis module receives that the code type after the code segmentation unit is a code segment, it selects the second analysis mode to analyze the code segment.
[0051] Specifically, the example of the present invention performs code segmentation on the initial code text through a code segmentation unit set in the data acquisition module, and the segmentation method is line-by-line segmentation, and when the code segmentation unit detects a code keyword, it switches the working mode to segmentation by paragraph; through the above method, the code analysis module can quickly determine the type of the segmented code and then determine the analysis method of the code according to the code type, thereby improving the analysis efficiency of the code execution efficiency and the accuracy of the analysis of the code execution efficiency.
[0052] Specifically, when the code analysis module analyzes the code line in the first analysis mode, the code analysis module performs a secondary determination based on the segmented code type. When the code analysis module analyzes the code line in the first analysis mode, the code analysis module determines the execution efficiency of the code based on a comparison result of the execution time T1 of the code line and the preset execution time T0;
[0053] When T1 ≥ T0, the unit analysis mode determines that the execution efficiency of the code is low;
[0054] When T1<T0, the unit analysis mode determines that the execution efficiency of the code is high;
[0055] The value of T0 is the ratio of the total execution time of the code text to be analyzed to the total number of code executions of the code text to be analyzed.
[0056] When the code analysis module analyzes the code segment in the first analysis mode, the code analysis module determines the execution efficiency of the code segment based on a comparison result of the average execution time T2 of the code lines in the code segment and the preset execution time T0;
[0057] When T2 ≥ T0, the code analysis module determines that the execution efficiency of the code segment is low;
[0058] When T2<T0, the code analysis module determines that the execution efficiency of the code segment is high;
[0059] The average execution time of the code segment is calculated by the following formula:
[0060]
[0061] Where Ti represents the execution time of the i-th line of code, Mi represents the number of times the i-th line of code is executed, and N represents the total number of lines of code.
[0062] Specifically, the example of the present invention determines the average execution time of the code segment by calculating the sum of the execution time of each line of code, and the code analysis module determines the execution efficiency of the code segment by comparing the average execution time of the code segment with the preset execution time. Through the above method, the code analysis module can accurately obtain the average execution time of each code segment, and then determine the execution efficiency of the code segment, thereby improving the accuracy of the code execution efficiency analysis.
[0063] Specifically, when the code analysis module analyzes the code segment in the second analysis mode, the code analysis module determines the execution efficiency of the code according to a comparison result of the time complexity T(n) of the code segment and the minimum time complexity O(1);
[0064] When T(n)>O(1), the code analysis module determines that the execution efficiency of the code segment is low;
[0065] When T(n)=O(1), the code analysis module analyzes the code segment in a first analysis mode.
[0066] Among them, when the time complexity of the code segment is greater than the minimum time complexity, the code analysis module determines that the execution efficiency of the code segment is low relative to the average execution efficiency of the code text to be analyzed. In addition, when the time complexity of the two code segments is greater than the minimum time complexity for the code analysis module, the code analysis module determines the execution efficiency of the code segment based on the time complexity, data scale and execution time.
[0067] Specifically, the example of the present invention determines the execution efficiency of a code segment by calculating the complexity of each code segment. Generally speaking, the higher the time complexity, the lower the code execution efficiency. In addition, the code analysis module adopts a first analysis mode for code segments of the same complexity to determine the execution time of the code and then determine the code execution efficiency. Through the above method, the code analysis module can perform corresponding analysis according to code segments of different complexities, thereby improving the accuracy and controllability of the code execution efficiency analysis, and thereby improving the intelligence of the code execution efficiency analysis.
[0068] Specifically, when the time complexity of the two code segments is the same, the code analysis module determines the code execution efficiency of the two code segments based on the execution time of the code segments, and the code execution efficiency of the code segment with a shorter execution time is higher; when the time complexity of the two code segments is different, the data analysis model determines the code execution efficiency based on the size of the time complexity of the two code segments, but the code execution efficiency of the code segment with a lower time complexity is not necessarily higher; the time complexity is affected by the algorithm and code size, and the specific analysis of the complexity of a code segment needs to take the code size into consideration.
[0069] Specifically, the present invention further analyzes the code segment with high time complexity through the code analysis module, so as to judge the code execution efficiency of the code segment with high time complexity and another replaceable code segment, and selects the corresponding method for judgment based on whether the time complexity is the same. Through the above method, the code analysis module can judge the code execution efficiency of the code segment more comprehensively and accurately, avoid misjudging the execution efficiency of the code, and thus improve the accuracy of the code execution efficiency analysis.
[0070] Specifically, when the code analysis module analyzes a code segment with low execution efficiency, the code analysis module determines a compensation mode according to the type of the code segment;
[0071] When the code segment type is a frequently-running code, the code analysis module determines that the code execution module compensates the code in a first compensation mode;
[0072] When the code segment type is a slow-execution code among infrequently executed codes, the code analysis module determines that the code execution module compensates the code in a second compensation mode;
[0073] When the code segment type is a code with a large code capacity among infrequently executed codes, the code analysis module determines that the code execution module compensates the code in a third compensation mode.
[0074] Specifically, the example of the present invention classifies codes with low execution efficiency according to preset rules through the code classification unit, and at the same time, the space classification unit also classifies the storage space of the memory according to preset rules. The code analysis module determines the compensation mode according to the type of the code segment. Through the above method, the code analysis module can more accurately judge the compensation mode according to the type of each code segment, thereby improving the accuracy and intelligence of the code execution efficiency analysis.
[0075] Specifically, when the code execution module compensates the frequently running code in the first compensation mode, the code execution module allocates the code to the tightly coupled memory space; when the code execution module compensates the slow execution code in the infrequently running code in the second compensation mode, the code execution module allocates the code to the static random access memory space; when the code execution module compensates the slow execution code in the infrequently running code in the third compensation mode, the code execution module allocates the code to the static random access memory space.
[0076] Specifically, the example of the present invention compensates for the code with low execution efficiency by adding a compensation mode to improve the execution efficiency of the code. The code analysis module determines the code execution module according to the type of the classified code with low execution efficiency and allocates it to the corresponding storage space to improve the execution efficiency of the code. Through the above method, the code analysis module can determine the compensation mode for the code with low execution efficiency more comprehensively and accurately, thereby improving the accuracy of the code execution efficiency analysis.
[0077] Specifically, when the code analysis module performs a secondary analysis of the code execution efficiency on the optimized code text, the code analysis module determines the improved execution efficiency value of the code text based on the total execution time Ta obtained from the first code execution efficiency analysis and the total execution time Tb obtained from the second code execution efficiency analysis, and the code analysis module determines whether to enable optimization based on a comparison result of the improved execution efficiency value with a preset improved execution efficiency value P0;
[0078] When P≥P0, the code analysis module determines not to enable optimization;
[0079] When P<P0, the code analysis module determines to start optimization;
[0080] The preset improved execution efficiency value P0 is set to 50% of the proportion of low-efficiency codes in the code text to be analyzed. Those skilled in the art may adjust the value according to actual needs. The improved execution efficiency value P is calculated by the following formula:
[0081]
[0082] Specifically, when the code analysis module determines to optimize the preset execution time T0, the code execution module adjusts the preset execution time T0 by adding an adjustment coefficient, and the adjustment coefficient K is calculated by the following formula:
[0083]
[0084] The adjusted preset execution time is set to T0'=K×T0.
[0085] Specifically, the present invention determines the execution efficiency value improved by the code text based on the total execution time obtained by the first code execution efficiency analysis and the total execution time obtained by the second code execution efficiency analysis through the code analysis module, and compares the result with the preset execution efficiency value to determine whether to adjust the preset execution time with the adjustment coefficient. Through the above method, the code analysis module can obtain the execution efficiency value improved by the code text more intuitively and clearly, thereby analyzing the code execution efficiency more accurately.
[0086] Thus far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art may make equivalent changes or substitutions to the relevant technical features, and the technical solutions after such changes or substitutions will fall within the scope of protection of the present invention.
[0087] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that the present invention is susceptible to various modifications and variations. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.
Claims
1. A method for analyzing application code execution efficiency, characterized in that: include: Step S1: The code segmentation unit of the code acquisition module segments the code text to be analyzed according to the segmentation method to obtain segmented codes, determines the code type as a code line or a code segment based on the segmented codes, and transmits the codes to the code analysis module; Step S2: The code analysis module determines an analysis mode for code execution efficiency according to the code type and the time complexity of the code; Step S3: The code classification unit of the code analysis module classifies each segment of code with low execution efficiency according to preset rules, and the space classification unit of the code analysis module classifies the memory space according to preset rules; Step S4: The code analysis module determines a compensation mode for the code execution module based on the type of code with low execution efficiency; Step S5: The code analysis module determines whether the code execution module optimizes the analysis process based on a comparison result of the improved execution efficiency value and a preset improved execution efficiency value.
2. The method for analyzing application code execution efficiency according to claim 1, characterized in that: The segmentation method of the code segmentation unit is to segment the code text to be analyzed line by line. When encountering a code keyword, the code segmentation unit segments the code into segments; the preset rules include the rules for code classification by the code classification unit and the rules for memory space classification by the space classification unit.
3. The method for analyzing application code execution efficiency according to claim 2, characterized in that: The code analysis module determines an analysis mode according to the code type received after the code segmentation unit segments the code, and analyzes the code line in a first analysis mode when the code type is a code line, and analyzes the code segment in a second analysis mode when the code type is a code segment.
4. The method for analyzing application code execution efficiency according to claim 3, characterized in that: The first analysis mode includes the following steps: when the segmented code type is a code line, the code analysis module determines the execution efficiency of the code based on a comparison result of the execution time of the code line with a preset execution time, and determines that the execution efficiency of the code is low when the execution time of the code line is greater than or equal to the preset execution time. Under the condition that the execution time of the code line is less than the preset execution time, it is determined that the execution efficiency of the code is high.
5. The method for analyzing application code execution efficiency according to claim 4, characterized in that: The first analysis mode also includes the code analysis module determining the execution efficiency of the code segment based on the comparison result of the average execution time of the code lines in the code segment and the preset execution time when the code type after segmentation is a code segment, and determining that the execution efficiency of the code segment is low when the average execution time of the code lines is greater than or equal to the preset execution time, and determining that the execution efficiency of the code segment is high when the average execution time of the code lines is less than the preset execution time.
6. The method for analyzing application code execution efficiency according to claim 5, characterized in that: The second analysis mode includes the code analysis module determining the execution efficiency of the code based on the comparison result of the time complexity of the code segment and the minimum time complexity, and determining that the execution efficiency of the code segment is low under the condition that the time complexity of the code segment is greater than the minimum time complexity, and determining to analyze the code segment in the first analysis mode under the condition that the time complexity of the code segment is equal to the minimum time complexity.
7. The method for analyzing application code execution efficiency according to claim 6, characterized in that: When the code analysis module obtains a code segment with low execution efficiency, the code analysis module determines a compensation mode according to the type of the code segment, and determines to compensate the code in the first compensation mode of the code execution module if the code segment type is a frequently-run code; determines to compensate the code in the second compensation mode if the code segment type is a slow-execution code among infrequently-run codes; and determines to compensate the code in the third compensation mode if the code segment type is a large-capacity code among infrequently-run codes.
8. The method for analyzing application code execution efficiency according to claim 7, characterized in that: The first compensation mode includes the code execution module allocating the code to the tightly coupled memory space; the second compensation mode includes the code execution module allocating the code to the static random access memory space; the third compensation mode includes the code execution module allocating the code to the static random access memory space.
9. The method for analyzing application code execution efficiency according to claim 8, characterized in that: The code analysis module performs a secondary analysis on the code execution efficiency of the optimized code text. The code analysis module determines whether the code execution module optimizes the analysis process based on a comparison result of the improved execution efficiency value and a preset improved execution efficiency value, and determines that the code execution module optimizes the analysis process under the condition that the compensation effect is less than the preset compensation effect.
10. The method for analyzing application code execution efficiency according to claim 9, characterized in that: The preset rules include rules for code classification by a code classification unit, and the code classification unit classifies the code according to the number of executions of each code segment, the execution time and attributes of a single line of code; the preset rules also include rules for memory space classification by a space classification unit, and the space classification unit classifies the storage space according to the running speed.
Citation Information
Patent Citations
Code efficiency inspection method and code efficiency inspection system
CN104572451A
Method for measuring code segment execution time and terminal equipment
CN110580220A
Analysis report generation method and device, electronic equipment and storage medium
CN113886237A