Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating an implementation method of a performance evaluation method of a web application based on big data analysis according to an embodiment of the present invention. In this embodiment, the execution subject of the performance evaluation method of the web application based on big data analysis is a terminal. The terminal comprises, but is not limited to, a mobile terminal such as a smart phone, a tablet computer, a wearable device and the like, and can also be a desktop computer and the like. The performance evaluation method of the web application based on big data analysis as shown in the figure may include:
s101: acquiring performance index information of H5 application needing to evaluate performance; wherein the H5 application is an application written by adopting the HTML5 for the fifth major modification; the performance index information comprises performance index parameters, and the performance index parameters comprise at least one of webpage loading time, memory loss value and first screen rendering time.
When detecting that a user triggers a control instruction for evaluating the performance of the H5 application, the terminal acquires a pre-stored unique identifier of the H5 application needing to evaluate the performance from a database, and acquires performance index information of the H5 application needing to evaluate the performance according to the acquired identifier of the H5 application. The control instruction may be triggered when detecting that the user selects a function option for evaluating the performance of the H5 application through the interactive interface, or may be triggered when detecting that the user opens a virtual switch for evaluating the performance of the H5 application through the interactive interface, but is not limited thereto, and may be triggered in other manners, which are not limited thereto. The unique identification of the H5 application may be the name of the H5 application.
Specifically, the terminal may run a preset test script, and obtain performance index information of the H5 application that needs to evaluate performance according to the obtained identifier of the H5 application. The test script is used to test the performance of the H5 application.
The performance index information comprises performance index parameters, and the performance index parameters comprise at least one of webpage loading time, memory loss value and first screen rendering time.
The memory loss value refers to the memory value occupied by the HTML5 page loading the H5 application.
The first screen rendering duration refers to the time consumed in rendering the first HTML5 page (first interface) of the H5 application when the first HTML5 page is loaded.
The web page loading duration refers to the time required for loading the HTML5 page, i.e., the response time of the application server to the client request.
Further, in order to reduce or eliminate the influence of the complexity of the HTML5 page on the performance evaluation result of the H5 application, the performance index information acquired by the terminal further includes: index coefficients reflecting the complexity of the HTML5 page. The smaller the index coefficient is, the higher the complexity of the HTML5 page is marked, and the larger the value of the performance index parameter is.
The index coefficient may be preset when designing the HTML5 page, or may be determined by the terminal according to the content of the loaded HTML5 page, which is not limited herein. Since the complexity of the HTML5 page is determined by the picture resolution of the HTML5 page and the gorgeous degree of the animation loaded in the HTML5 page, the index coefficient of the HTML5 page currently loaded can be determined based on the preset correspondence between the index coefficient and the picture resolution and the gorgeous degree of the animation, the picture resolution of the HTML5 page and the gorgeous degree of the animation loaded in the HTML5 page.
The higher the picture resolution of the HTML5 page, the higher the complexity of the HTML5 page, the more gorgeous the animation loaded in the HTML5 page, and the higher the complexity of the HTML5 page.
S102: and acquiring a performance evaluation strategy matched with the performance index information.
The performance evaluation policy identifies the performance evaluation rules applied by H5. The performance evaluation rule may evaluate the H5 application according to the value of each performance index parameter, or evaluate the H5 application according to the score value of each performance index parameter. The score value for each performance indicator parameter is determined based on the value of each performance indicator parameter.
When the H5 application is evaluated according to the value of each performance index parameter, a preset correspondence between the value of each performance index parameter and the performance level is stored in the terminal in advance. The corresponding performance levels of the values belonging to the same interval are the same.
For example, when the H5 application is evaluated according to the score value of each performance index parameter, a preset correspondence relationship between the score value of each performance index parameter and the performance level may be stored in the terminal in advance. Wherein, the performance grade is used for indicating the performance of the H5 application, and the higher the performance grade is, the better the performance of the H5 application is. One performance level may correspond to a score of one performance index parameter; the scores of the at least two performance index parameters may also be corresponding, where the performance level is determined jointly by the scores of the at least two performance index parameters.
The terminal may also store a preset correspondence between the score interval and the performance level of each performance index parameter in advance. Wherein, a performance level may correspond to a score interval of a performance index parameter. When the performance level is determined by the scores of the at least two performance index parameters together, the same performance level corresponds to the score interval of the at least two performance index parameters.
When the performance index parameter only contains any one of the webpage loading time length, the memory loss value and the first screen rendering time length, the obtained matched performance evaluation strategy is a preset corresponding relation between the value of the performance index parameter and the performance grade, or the obtained matched performance evaluation strategy is a preset corresponding relation between the score of the performance index parameter and the performance grade.
When the performance index parameters only comprise at least any two of webpage loading time length, memory loss value and first screen rendering time length, the obtained matched performance evaluation strategy is a preset corresponding relation between the scores of the at least two performance index parameters and the performance grade.
S103: and evaluating the H5 application according to the performance index information and the matched performance evaluation strategy to obtain an evaluation result.
The terminal can acquire the value of each performance index parameter from the acquired performance index information, and when the matched performance evaluation strategy is the preset corresponding relation between the value of each performance index parameter and the performance grade, the performance grade of the H5 application is determined according to the acquired value of each performance index parameter and the preset corresponding relation between the value of each performance index parameter and the performance grade. Specifically, the terminal may determine a preset interval to which the obtained value of the performance index parameter belongs according to the obtained value of the performance index parameter, and determine a performance grade corresponding to the preset interval to which the obtained value of the performance index parameter belongs according to the performance grade corresponding to each preset interval, thereby obtaining the performance grade of the H5 application.
When the matched performance evaluation policy is a preset corresponding relation between the score of each performance index parameter and the performance grade, the terminal can determine the performance grade of the H5 application according to the obtained score value of the performance index parameter and the preset corresponding relation between the score of each performance index parameter and the performance grade; or determining a target score interval to which the score value of the acquired performance index parameter belongs, and determining the performance grade corresponding to the target score interval according to a preset corresponding relation between the score interval and the performance grade, thereby obtaining the performance grade of the H5 application.
Further, when the obtained matched performance evaluation policy is a preset correspondence between the score of each performance index parameter and the performance level, S103 may include:
s1031: and determining the score value of the performance index parameter.
The method for determining the score value of each performance index parameter by the terminal according to the value of each performance index parameter may be: the terminal compares the acquired value of the performance index parameter with the reference value of the performance index parameter, and determines the score value of the performance index parameter according to the difference value between the acquired value of the performance index parameter and the reference value of the performance index parameter. When the difference value between the two is a negative number, the larger the absolute value of the difference value is, the higher the score value of the performance index parameter is; when the difference value between the two is positive, the larger the difference value is, the lower the score value of the performance index parameter is; and the score value of the performance index parameter when the difference value is negative is larger than the score value of the performance index parameter when the difference value is positive. When the difference between the two is equal to or approximately equal to the reference value, the score value of the performance index parameter is 60 points. Approximately equal means that the absolute value of the difference between the two is within an acceptable error range.
For example, when the performance index parameter includes a memory loss value, a first screen rendering time period, and a web page loading time period, the method for determining the score value of each performance index parameter is as follows:
the terminal acquires a memory loss value, a first screen rendering time length and a webpage loading time length from the performance index information, determines a score value of the memory loss value according to the acquired memory loss value and a memory loss reference value, determines a score value of the first screen rendering time length according to the acquired first screen rendering time length and the first screen rendering reference time length, and determines a score value of the webpage loading time length according to the acquired webpage loading time length and the webpage loading reference time length. The lower the memory loss value, the higher the score value of the memory loss value; the smaller the first screen rendering time length is, the higher the score value of the first screen rendering time length is; the smaller the web page loading time length is, the higher the score value of the web page loading time length is.
The memory loss value may be a mean value calculated according to the memory loss value of each HTML5 page of the H5 application, and the web page loading duration may be a mean value calculated according to the web page loading duration of each HTML5 page of the H5 application.
The memory loss reference value, the first screen rendering reference time length and the webpage loading reference time length can be set according to related indexes of the H5 application with excellent performance, and the method is not limited.
It can be understood that the terminal may determine the score value of the memory loss value according to the interval to which the acquired memory loss value belongs, determine the score value of the first screen rendering time according to the interval to which the acquired first screen rendering time belongs, and determine the score value of the webpage loading time according to the interval to which the acquired webpage loading time belongs. At this time, the terminal stores a plurality of memory loss intervals and score values allocated to each memory loss interval in advance, stores a plurality of first screen rendering time intervals and score values allocated to each first screen rendering time interval in advance, and stores a plurality of webpage loading time intervals and score values allocated to each webpage loading time interval in advance.
Further, in order to reduce or eliminate the influence of the complexity of the HTML5 page on the performance evaluation result of the H5 application, the accuracy of the performance evaluation result of the H5 application is improved. When the performance index information further includes an index coefficient for reflecting the complexity of the HTML5 page, S1031 may be specifically: and determining the score value of the performance index parameter according to the value of the performance index parameter and the index coefficient.
And the terminal calculates the product of the value of the performance index parameter in the performance index information and the index coefficient to obtain the score value of the performance index parameter.
S1032: and evaluating the H5 application according to a preset corresponding relation between the score value and the performance grade and the score value of the performance index parameter to obtain the evaluation result.
Specifically, the terminal may determine a performance level according to a score interval to which the score of each performance index parameter belongs, and determine a performance evaluation result of the H5 application by integrating the performance level of each performance index parameter.
The terminal can also calculate the average value according to the score value of each performance index parameter, and determine the score interval to which the average value belongs to determine the performance grade, so as to obtain the performance evaluation result of the H5 application.
The terminal can also calculate the final score value of each performance index parameter according to the score value of each performance index parameter and the score weight of each performance index parameter, and sum the final score values of all the performance index parameters to obtain the total score value of all the performance index parameters, and determine the performance grade of the H5 application according to the score interval to which the total score value belongs to obtain the performance evaluation result of the H5 application. The final score value of each performance index parameter is the product of the score value of each performance index parameter and the score weight of each performance index parameter. The sum of all the score weights is equal to 1, and the score weights of all the performance index parameters can be partially the same or different.
When the score weight of each performance index parameter is different, if the HTML5 page is loaded offline, the score weight of the memory loss value is greater than the first screen rendering time length and the webpage loading time length; if the HTML5 page is loaded online, the first screen rendering time length is greater than the webpage loading time length and the score weight of the memory loss value is greater than the score weight of the memory loss value.
According to the embodiment of the invention, the H5 application is evaluated based on the performance index information and the preset performance evaluation strategy by acquiring the performance index information of the H5 application. The method comprises the steps of obtaining parameters capable of reflecting the performance of the H5 application based on a big data analysis technology, evaluating based on the parameters capable of reflecting the performance of the H5 application and a performance evaluation strategy to obtain an evaluation result, and compared with manual evaluation, reducing the error of the evaluation result and improving the accuracy of the performance evaluation result of the H5 application.
The H5 application is evaluated based on the index coefficient and the value of the performance index parameter for reflecting the complexity of the HTML5 page, so that the influence of the complexity of the HTML5 page on the performance evaluation result of the H5 application can be reduced or eliminated, and the accuracy of the performance evaluation result of the H5 application is improved.
Referring to fig. 2, fig. 2 is a flowchart illustrating an implementation method of a performance evaluation method of a web application based on big data analysis according to another embodiment of the present invention. In this embodiment, the execution subject of the performance evaluation method of the web application based on big data analysis is a terminal. The terminal comprises, but is not limited to, a mobile terminal such as a smart phone, a tablet computer, a wearable device and the like, and can also be a desktop computer and the like. The difference between this embodiment and the previous embodiment is that S204 and/or S205 may be further included after S203, and S201 to S203 are the same as S101 to S103 in the previous embodiment, and detailed descriptions of S101 to S103 in the previous embodiment are omitted herein.
In order to accurately locate the performance defect, so as to effectively optimize the performance of the H5 application, S204 may be further included after S203: and outputting optimization suggestions according to the performance index parameters.
The terminal may output an optimization suggestion according to the value of each performance index parameter or the score value of each performance index parameter. Specifically, the terminal may compare the value of each performance index parameter with the respective reference threshold, and output an optimization suggestion of the performance index parameter when the value of any performance index parameter is greater than or equal to its corresponding reference threshold. Or, the terminal may compare the score value of each performance index parameter with the respective score threshold, and output the optimization suggestion of the performance index parameter when the score value of any performance index parameter is less than or equal to the score threshold corresponding to the performance index parameter. The optimization suggestions include one or any combination of at least two of the following: optimizing the source code of the HTM5 page, adjusting the resource loading sequence of the HTML5 page and optimizing the loading speed of the HTML5 page.
For example, when the memory loss value is greater than or equal to the memory loss threshold, or the score value of the memory loss value is less than or equal to the score threshold of the memory loss, it is determined that the source code of the H5 application may have a vulnerability, and optimization of the source code of the HTM5 page currently monitored in the H5 application is recommended.
When the first screen rendering time length is greater than or equal to the first screen rendering threshold value, or the score value of the first screen rendering time length is less than or equal to the first screen rendering score threshold value, it is judged that the resource loading sequence of the first HTML5 page of the H5 application may not be reasonable, and it is recommended to adjust the resource loading sequence of the first HTML5 page of the H5 application. For example, cascading style sheets (Cascading Style Sheets, CSS) are loaded preferentially, followed by the loading of the interpreted scripting language (JavaScript, JS) tail.
The CSS not only can statically modify the web page, but also can dynamically format each element of the web page in cooperation with various scripting languages.
When the webpage loading time length is larger than or equal to the webpage loading time length threshold value, or the score value of the webpage loading time length is smaller than or equal to the webpage loading time length score threshold value, judging that the loading speed of the HTML5 page of the H5 application is slower, and suggesting to optimize the loading speed of the HTML5 page of the H5 application.
When the webpage loading time length is greater than or equal to the webpage loading time length threshold value, and the webpage pause is detected, or when the webpage loading time length score value is less than or equal to the webpage loading time length score threshold value, and the webpage pause is detected, the resource loading sequence of the currently loaded HTML5 webpage is judged to be possibly unreasonable, and the resource loading sequence of the HTML5 webpage in the H5 application is recommended to be adjusted.
When the terminal loads the HTML5 page, the terminal can also acquire the webpage loading speed in real time, and when detecting that the webpage loading speed is uneven (for example, the front 90% loading is faster, and the rest 10% loading is slower), it is determined that the resource loading sequence of the HTML5 page currently loaded may not be reasonable, and it is recommended to adjust the resource loading sequence of the HTML5 page in the H5 application. The web page loading speed refers to the percentage of the web page resources loaded in a unit time to the total resources of the web page, for example, the web page loading speed is 5% of the web page loading speed per second. The uneven web page loading speed may mean that the obtained values of the loading speeds of two adjacent web pages are different, or the difference value between the two is greater than or equal to a preset difference threshold value.
In order to intuitively present the performance evaluation result of the H5 application to the user, so that the developer or maintainer can quickly learn about the relevant information, S205 may further include, after S203: outputting an evaluation report of the H5 application; wherein the assessment report includes the performance index information and a score value for the performance index parameter.
The performance index information in the evaluation report can comprise the first screen rendering time of the H5 application and the memory loss value of each HTML5 page contained in the H5 application; the method comprises the steps of (1) obtaining a memory loss average value of an HTML5 page applied by H5, a memory loss total value of the HTML5 page applied by H5, and webpage loading time length of each HTML5 page applied by H5; average web page loading time of the HTML5 page of the H5 application, total web page loading time of the HTML5 page of the H5 application.
The performance index information in the evaluation report may also include an index coefficient of complexity of each HTML5 page.
The scoring values of the performance index parameters may include: the method comprises the steps of scoring a memory loss value of each HTML5 page of the H5 application, scoring a first screen rendering time length and scoring a webpage loading time length of each HTML5 page of the H5 application. The score values of the performance index parameters may also include an average score value of memory loss values of all HTML5 pages of the H5 application, and an average score value of web page loading durations of all HTML5 pages of the H5 application.
It is understood that S204 and S205 may be performed simultaneously, regardless of the order of the sequences.
According to the embodiment of the invention, the H5 application is evaluated based on the performance index information and the preset performance evaluation strategy by acquiring the performance index information of the H5 application. The method comprises the steps of obtaining parameters capable of reflecting the performance of the H5 application based on a big data analysis technology, evaluating based on the parameters capable of reflecting the performance of the H5 application and a performance evaluation strategy to obtain an evaluation result, and compared with manual evaluation, reducing the error of the evaluation result and improving the accuracy of the performance evaluation result of the H5 application.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
Referring to fig. 3, fig. 3 is a block diagram of a terminal according to an embodiment of the present invention. The terminal includes units for executing the steps in the embodiments corresponding to fig. 1-2. Refer specifically to the related descriptions in the respective embodiments of fig. 1-2. For convenience of explanation, only the portions related to the present embodiment are shown. Referring to fig. 3, the terminal 3 includes:
a performance index information obtaining unit 310, configured to obtain performance index information of an H5 application that needs to evaluate performance; wherein the H5 application is an application written by adopting the HTML5 for the fifth major modification; the performance index information comprises performance index parameters, wherein the performance index parameters comprise at least one of webpage loading time, memory loss value and first screen rendering time;
a performance evaluation policy obtaining unit 320, configured to obtain a performance evaluation policy matched with the performance index information;
and the evaluation unit 330 is configured to evaluate the H5 application according to the performance index information and the matched performance evaluation policy, so as to obtain an evaluation result.
Further, the evaluation unit 330 specifically includes:
a score determining unit, configured to determine a score value of the performance index parameter;
and the performance evaluation unit is used for evaluating the H5 application according to the preset corresponding relation between the score value and the performance grade and the score value of the performance index parameter to obtain the evaluation result.
Further, the performance index information further comprises index coefficients for reflecting the complexity degree of the HTML5 page; wherein the index coefficient is less than 1 and greater than zero;
the score determining unit is specifically configured to: and determining the score value of the performance index parameter according to the value of the performance index parameter and the index coefficient.
Further, the terminal further includes:
the optimization construction output unit is used for outputting optimization suggestions according to the performance index parameters; wherein the optimization suggestion comprises one or any combination of at least two of the following: optimizing the source code of the HTM5 page, adjusting the resource loading sequence of the HTML5 page and optimizing the loading speed of the HTML5 page.
Further, the terminal further includes:
the evaluation result output unit is used for outputting an evaluation report of the H5 application; wherein the assessment report includes the performance index information and a score value for the performance index parameter.
Fig. 4 is a schematic diagram of a terminal according to another embodiment of the present invention. As shown in fig. 4, the terminal 4 of this embodiment includes: a processor 40, a memory 41 and a computer program 42 stored in the memory 41 and executable on the processor 40. The processor 40 implements the steps in the embodiment of the performance evaluation method of the web application based on big data analysis of each terminal described above when executing the computer program 42, for example, S101 to S103 shown in fig. 1. Alternatively, the processor 40, when executing the computer program 42, performs the functions of the units in the above-described device embodiments, for example, the functions of the units 310 to 330 shown in fig. 3.
Illustratively, the computer program 42 may be partitioned into one or more units that are stored in the memory 41 and executed by the processor 40 to complete the present invention. The one or more elements may be a series of computer program instruction segments capable of performing a specific function describing the execution of the computer program 42 in the terminal 4. For example, the computer program 42 may be divided into a performance index information acquisition unit, a performance evaluation policy acquisition unit, and an evaluation unit, each unit functioning specifically as described above.
The terminal may include, but is not limited to, a processor 40, a memory 41. It will be appreciated by those skilled in the art that fig. 4 is merely an example of the terminal 4 and is not intended to limit the terminal 4, and may include more or fewer components than shown, or may combine certain components, or different components, e.g., the terminal may further include an input-output terminal, a network access terminal, a bus, etc.
The processor 40 may be a central processing unit (Central Processing Unit, CPU), other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 41 may be an internal storage unit of the terminal 4, such as a hard disk or a memory of the terminal 4. The memory 41 may be an external storage terminal of the terminal 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the terminal 4. Further, the memory 41 may also include both an internal memory unit of the terminal 4 and an external memory terminal. The memory 41 is used for storing the computer program as well as other programs and data required by the terminal. The memory 41 may also be used for temporarily storing data that has been output or is to be output.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.