Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that 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 obtained by a person skilled in the art without making any inventive step based on the embodiments of the present disclosure, shall fall within the scope of protection of the present application.
In the prior art, in the process of testing the performance of the browser, evaluation standards (usually, a time length that a user can tolerate is taken as a standard) are often manually specified for different test platforms, but the specified standards of each person may be different, and the unification of the evaluation standards of each test platform cannot be realized. For this reason, a uniform evaluation standard needs to be established so that efficient and accurate evaluation can be achieved.
Specifically, fig. 1 is a schematic diagram of a browser performance testing system related to the solution of the present specification in an actual application scenario. Running the browser component before optimization based on the first test environment to obtain first reference time; further, based on the first test environment, operating the optimized browser component to obtain first test time; and taking the ratio of the first test time to the first reference time as a test coefficient. When other second test environments are tested and evaluated, the time required by running the browser component before optimization of each second test environment is required to be obtained as second reference time; and further, operating the optimized browser component based on other second test environments to acquire second test time. It is finally necessary to evaluate whether the second test time is acceptable.
It should be noted that the first test environment and the second test environment are different test environments. In general, the first test environment may be understood as a basic test environment, in other words, a test environment used by a developer. There may be many second test environments, which may be understood as test environments in which it is possible to apply the optimized browser component. The test environment includes a terminal device (e.g., a computer, a smart phone, etc.), an operating system (e.g., a Windows operating system, an Android operating system, etc.), a browser (e.g., an IE browser, a UC browser, etc.), and the like.
Based on the above-described scenarios, the following describes the embodiments of the present specification in detail.
Fig. 2 is a schematic flowchart of a browser performance testing method provided in an embodiment of the present specification, where the method specifically includes the following steps:
step S202: acquiring a first reference time and a first test time based on a first test environment based on the first test environment.
In practical applications, the first test environment may be understood as an environment used by a developer to optimize a browser component. Developers usually have test indexes when optimizing and upgrading the browser, and if the browser is qualified based on the first test environment, the browser is further tested based on other test environments (namely, the second test environment). The first reference time and the first test time described herein may be understood as an evaluation parameter or an evaluation index for testing or evaluating other test environments. Due to differences among the test environments, the first reference time and the first test time are obtained based on the first test environment and are used as relative reference standards, so that evaluation standards aiming at different test environments can be unified. The first reference time is a time for specifying the component before the browser optimization is executed based on the first test environment, and the first test time is a time for specifying the component after the browser optimization is executed based on the first test environment.
Step S204: a second reference time for running the pre-optimized browser component based on a second test environment is obtained.
In practical application, optimization is usually performed based on a browser of a previous version, and in order to know whether performance of the optimized browser meets requirements, a browser running condition of the previous version needs to be acquired first. Specifically, the time consumed by the previous version of browser to run the basic operation (e.g., assignment operation) is obtained as the second reference time, and is used as a reference to evaluate whether the optimized browser performance meets the standard.
The second test environment referred to herein includes: a second terminal device, a second operating system, a second browser, etc. For example, the second terminal device may be a mobile phone terminal platform, a computer terminal platform, or a server terminal platform, and the like, and is a terminal platform capable of supporting the operation of a browser. The second reference time is a time length, and because the speed of the coding operation is high, the test operation can be executed for a plurality of times of circulating operation so as to obtain the second reference time with obvious time length.
Step S206: and testing the performance of the browser component after running optimization based on the second test environment according to the first reference time, the first test time and the second reference time.
In practical application, performance testing of the optimized browser component needs to be performed for different testing environments, and as described above, different testing environments may have different second terminal devices, different operating systems, or different browsers; thus, each test is targeted. The evaluation manner for each test environment may be various, for example, the second test environment may be evaluated based on the test coefficient, or based on the test criterion (i.e., based on the time required by the second test environment to run the optimized browser component); in particular, the length of time defined by the test criteria may be compared to the length of time required to run the optimized browser component based on the second test environment.
Based on the above, it can be understood that, based on different terminal platforms, including a first test environment and a second test environment, corresponding browser components (e.g., basic components) before optimization are respectively run, and corresponding first reference time and second reference time are recorded; the first test environment and the second test environment are different platforms respectively. After the reconstruction of the browser script codes is completed, the optimized browser component is operated based on the first test environment, the first test time is recorded, and the ratio of the first test time to the first reference time is used as a test coefficient, so that whether the time required by the optimized browser component operated in different second test environments meets the standard or not can be evaluated based on the test coefficient. The accuracy and the efficiency of testing aiming at different second test environments can be effectively improved.
In one or more embodiments of the present specification, obtaining the first reference time and the first test time based on the first test environment may specifically include: acquiring a first reference time for operating the browser component before optimization based on a first test environment; obtaining a first test time for operating the optimized browser component based on the first test environment; determining the test coefficient according to the ratio of the first test time to the first reference time; wherein the first test environment comprises: the system comprises a first terminal device, a first operating system and a first browser.
When the script code of the browser is reconstructed, the reconstruction is usually completed based on the terminal equipment of a developer. In optimizing a browser component, a developer generally needs to set an optimization evaluation criterion, for example, a time (i.e., a first reference time) required for running a basic browser component is 1 second, a time (i.e., a first test time) required for running an optimized browser component based on the same basic test environment is 10 seconds, and since the optimized browser component performs rich rendering on a display effect, a rendering time expected to be acceptable to a user is 15 seconds, then the current first test time of 10 seconds can meet an optimization evaluation index of the developer. It is easily understood that, based on the same test environment, the time required for running the optimized browser component is 10 times (i.e., the test coefficient is 10) the time required for running the optimized browser component before the optimization, so that the ratio of the first test time to the first reference time can be used as an index for assisting in evaluating other test environments.
The calculation method of the test coefficient may be the first test time/the first reference time, or may be the first reference time/the first test time. If the ratio relationship changes, correspondingly, the correlation relationship used for evaluating the second test environment also changes, in other words, the correlation relationship between the test coefficient and the second reference time and the second test time also changes.
The first terminal device referred to herein includes at least: computer terminals, server terminals, mobile terminals, etc.; the first operating system includes at least: windows system, Android system, iOS system etc. first browser includes at least: IE browser, UC browser, google browser, safari browser, etc.
In one or more embodiments of the present specification, the testing, according to the test coefficient and the second reference time, the performance of the browser component after running optimization based on the second test environment may specifically include: running the optimized browser component based on the second test environment to obtain second test time; and determining a performance test result of the browser component after the second test environment is operated and optimized according to the incidence relation among the test coefficient, the second reference time and the second test time.
It should be noted that the test coefficients, the second reference time, and the second test time may be mutually converted, and the association relationship may be, for example: and the test coefficient is the second reference time which is the test standard, or the second test time/the second reference time is the coefficient to be evaluated, and the relation between the coefficient to be evaluated and the test coefficient. During specific comparison and evaluation, if the incidence relation is used as a test coefficient, and the second reference time is a test standard, comparing the test standard with the second test time, and if the second test time is less than or equal to the test standard, indicating that the performance of the optimized browser component meets the test requirement; and if the incidence relation is that the second test time/the second reference time is equal to the coefficient to be evaluated, comparing the coefficient to be evaluated with the test coefficient, and if the coefficient to be evaluated is less than or equal to the test coefficient, indicating that the performance of the optimized browser component meets the test requirement. It should be emphasized here that the above-mentioned correlation is determined based on the first test time/first reference time ═ test coefficient, which is the formula.
In one or more embodiments of the present specification, obtaining, based on the second test environment, a second reference time for running the browser component before optimization and a second test time for running the browser component after optimization may specifically include: running the browser component before optimization based on the second test environment, and acquiring second reference time required by the browser component before the optimization is finished; based on the second test environment, operating the optimized browser component, and acquiring second test time required by the optimized browser component after operation is completed; the second test environment comprises a second terminal device, a second operating system and a second browser.
As can be seen from the foregoing, if the performance of the optimized browser component needs to be evaluated, a reference standard needs to be specified, and since the optimization degree and complexity of each component are different, and the test environment adopted during optimization is different from the test environment during application, the evaluation of the optimization effect cannot be performed by a single time standard; the comparison needs to be performed based on the operation effect of the browser component before optimization, that is, the second reference time needed for operating the browser component before optimization needs to be acquired.
It should be noted that, the second operating system mentioned here may include, for example: windows operating system, android operating system, etc.; the second browser may include, for example: IE browser, UC browser, safari browser, google browser, etc.
In practical applications, any change of the test environment factors may affect the runtime, and therefore, in order to evaluate the performance of the optimized browser component, a cross-testing manner may be adopted, for example, as shown in fig. 3, which is provided for the embodiment of the present disclosure, it is assumed that the second terminal device includes: a computer terminal, a server terminal; the second operating system includes: windows system, Android system, iOS system, etc.; the second browser includes: IE browser, UC browser, safari browser, google browser, etc. In designing the cross-tests, it is necessary to test for each combination.
It is emphasized that the test environment for running the optimized browser component needs to be identical to the test environment for running the optimized browser component, that is, have the same second terminal device, second operating system and second browser; and eliminating the influence of the factors of the test environment, thereby obtaining the second test time required by the optimized browser component with reference value.
In one or more embodiments of the present specification, evaluating the performance test result of the optimized browser component according to an association relationship between a test coefficient and the second reference time, the second test time may specifically include: obtaining a test standard based on the product of the test coefficient and the second reference time; and evaluating the performance test result of the optimized browser component according to the test standard and the second test time.
As can be seen from the foregoing, the test factor is determined according to the ratio of the first test time to the first reference time. In the embodiment, the test coefficient obtained through the basic test environment is multiplied by the second reference time to obtain the test standard; and further, comparing the test standard with a second test time obtained in the actual test process so as to evaluate the performance test result of the optimized browser component.
For example, as described above, the time required to run the pre-optimized base browser component (i.e., the first reference time) is 1 second, and the time required to run the post-optimized browser component based on the same base test environment (i.e., the first test time) is 10 seconds. Based on the same test environment, the time required to run the optimized browser component is 10 times longer than the time required to run the optimized base browser component (i.e., the test factor is 10). Assuming that the time required for the second testing environment to run the browser component before optimization is 2 seconds, according to the testing coefficient of 10, a testing standard of 10 × 2 for the current second testing environment can be calculated, and the testing standard is 20 seconds. If the second test time is 15 seconds and is less than the test standard for 20 seconds, the optimized browser component for the current second test environment meets the performance requirement; if the second test time is 25 seconds and is greater than the test standard for 20 seconds, the browser script needs to be re-optimized for the situation that the optimized browser component of the current second test environment does not meet the performance requirement.
In one or more embodiments of the present specification, evaluating a performance test result of the optimized browser component according to an association relationship between a test coefficient and the second reference time, the second test time specifically includes: determining a coefficient to be evaluated based on the ratio of the second test time to the second reference time; and evaluating the performance test result of the optimized browser component according to the test coefficient and the coefficient to be evaluated.
In this embodiment, the index for evaluating the performance of the second testing environment is the coefficient to be evaluated, which is different from the testing standard in the foregoing embodiments. The coefficient to be evaluated is the second test time/the second reference time, and is compared with the test coefficient obtained by the first test environment, and if the coefficient to be evaluated is greater than the test coefficient, the performance evaluation of the second test environment is unqualified. It should be noted that, the calculation method for obtaining the coefficient to be evaluated may adopt the second test time/the second reference time, or may also adopt the second reference time/the second test time, and of course, what kind of calculation method is adopted, and correspondingly, the comparison relationship between the coefficient to be evaluated and the test coefficient also needs to be adjusted correspondingly.
For example, as described above, the time required to run the base browser component before optimization (i.e., the first reference time) is 1 second, and the time required to run the browser component after optimization based on the same first test environment (i.e., the first test time) is 10 seconds. Based on the same test environment, the time required to run the post-optimization browser component is 10 times the time required to run the pre-optimization base browser component (i.e., the test factor is 10). Assuming that the time required for the second test environment to run the optimized browser component is 2 seconds, and the time required for the second test environment to run the optimized browser component is 16 seconds, the to-be-evaluated coefficient is calculated to be 16/2, and the to-be-evaluated coefficient is 8 and is smaller than the test coefficient 10, so that the evaluation result of the second test environment meets the requirement.
In one or more embodiments of the present description, the second test environment and the first test environment are different environments.
In practical applications, in general, identical test environments need to be implemented identically to run identical browser components. The time required to run the same browser component may vary from test environment to test environment, including but not limited to: different browsers, different operating systems, different terminal devices, and the like. The embodiment of the specification mainly aims at making a unified standard and a method for evaluating test results in different test environments; therefore, the method for evaluating the second test environment based on the first test environment as the standard for evaluating the test result can simply, accurately and quickly evaluate the second test environment.
For example, in the embodiment of the present application, a fixed standard time for evaluation is not provided, and for the following, the steps of running the line graph display by the browser are optimized, and specific steps are shown in fig. 4.
First, the time for operating 10000 fundamental operations (e.g., assignment operations) on the browser side is assumed to be 50 milliseconds. Obtaining the current time, operating the assignment operation 10000 times, obtaining the end time when the operation reaches 10000 times, and obtaining the time required by the operation before optimization, namely A is 50 milliseconds by subtracting the current time from the end time.
Further, after the current chart is optimized, the corresponding running time length is obtained, and it is assumed that B is 1 second. And calculating the proportional relation between the operation time after optimization and the operation time before optimization, wherein B/A is 200 times.
Further, based on the second test environment, 10000 times of basic operations (e.g., assignment operations) are also executed, assuming 500 milliseconds. Then, it can be calculated that the standard time required for running the optimized browser component based on the second test environment should be 500 × 200, and the standard time for running the optimized browser component by the current second test environment is 10 seconds.
Based on the same idea, an embodiment of the present specification provides a browser performance testing apparatus, and as shown in fig. 5, the browser performance testing apparatus provided in the embodiment of the present specification mainly includes:
a first obtaining module 501, configured to obtain a first reference time and a first test time based on a first test environment;
a second obtaining module 502, configured to obtain a second reference time for operating the optimized browser component based on a second test environment;
the testing module 503 tests the performance of the optimized browser component based on the second testing environment according to the first reference time, the first testing time and the second reference time.
Further, the first obtaining module 501 obtains a first reference time for operating the browser component before optimization based on a first test environment; wherein the first test environment comprises: the system comprises a first terminal device, a first operating system and a first browser;
obtaining a first test time for operating the optimized browser component based on the first test environment;
determining the test coefficient according to the ratio of the first test time to the first reference time
Further, the second obtaining module 502 runs the optimized browser component based on the second testing environment to obtain a second testing time;
and determining a performance test result of the browser component after the second test environment is operated and optimized according to the incidence relation among the test coefficient, the second reference time and the second test time.
Further, the testing module 503 obtains a testing standard based on a product of the testing coefficient and the second reference time;
and evaluating the performance test result of the optimized browser component according to the test standard and the second test time.
Further, the testing module 503 determines a coefficient to be evaluated based on a ratio of the second testing time to the second reference time;
and evaluating the performance test result of the optimized browser component according to the test coefficient and the coefficient to be evaluated.
Further, the second test environment includes a second terminal device, a second operating system, and a second browser.
Further, the second test environment and the first test environment are different test environments.
Based on the same idea, an embodiment of this specification further provides an electronic device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
acquiring a first reference time and a first test time based on a first test environment;
acquiring a second reference time for operating the browser component before optimization based on a second test environment;
and testing the performance of the browser component after running optimization based on the second test environment according to the first reference time, the first test time and the second reference time.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiments of the apparatus, the electronic device, and the nonvolatile computer storage medium, since they are substantially similar to the embodiments of the method, the description is simple, and the relevant points can be referred to the partial description of the embodiments of the method.
The apparatus, the electronic device, the nonvolatile computer storage medium and the method provided in the embodiments of the present description correspond to each other, and therefore, the apparatus, the electronic device, and the nonvolatile computer storage medium also have similar advantageous technical effects to the corresponding method.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Hardware Description Language), traffic, pl (core universal Programming Language), HDCal (jhdware Description Language), lang, Lola, HDL, laspam, hardward Description Language (vhr Description Language), vhal (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the various elements may be implemented in the same one or more software and/or hardware implementations in implementing one or more embodiments of the present description.
As will be appreciated by one skilled in the art, the present specification embodiments may be provided as a method, system, or computer program product. Accordingly, embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present description 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, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
The description has been presented with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the description. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams 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.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
This description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present specification, and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.