- In this lesson you will learn the following concepts
- Overview
- Starting the performance profiler
- Analyzing the result
Lesson 10.2. Optimizing a project: Performance profiler In this lesson you will learn the following concepts - Overview.
- Starting the performance profiler.
- Analyzing the result.
The performance profiler is a tool that checks and optimizes the execution time of the processes of your site. The principle is straightforward: - The site test is executed.
- During this test, the performance profiler keeps track of all the actions performed and saves the execution times of each one of the processes.
At the end of the test, the performance profiler displays: - the 10 most time-consuming operations,
- the duration and the number of calls of all processes executed.
The "WW_Optimization" project has a specific page that shows examples of results obtained with the performance profiler. Starting the performance profiler The performance profiler can be started: - from the WEBDEV editor:
In this case, the project is automatically executed in test mode. You can use your application and start the processes of your choice. To go back to the WEBDEV editor, simply exit your site. The performance profiler displays the result of the analysis. This result is saved in a WPF file. - from one of your WLanguage processes, with the following functions:
| | ProfilerStart | Starts "collecting data" for the performance profiler. | ProfilerEnd | Stops "collecting data" for the performance profiler. |
In this case, only the code between ProfilerStart and ProfilerEnd will be analyzed. The result is saved in a WPF file.
- The first method will be used in our example. To start the performance profiler on the "WW_Optimization" project:
- In the ribbon, on the "Project" page, "Audit and performance" group, expand "Analyze performance" and select "Analyze performance".
| | |  | Note | The performance profiler can also be started from the project dashboard, via the "Performance" widget. Simply: - enable the widget if necessary (click the link "Click here to re-enable").
- click the arrow and select "Analyze performance".
|
- The project test is run.
- Click "TEST PAGE OF PERFORMANCE PROFILER".
- Click "PROCESS TO ANALYZE".
- Validate the information window and close the browser to stop the project test. The performance profiler report window appears.
- Let's analyze the report window of the performance profiler. Results are displayed in several tabs:
- the "Summary" tab shows the ten longest processes.
- the "Mapping" tab shows a graphical view of the main processes.
- the "Details" tab shows all the processes run during the test of the application (from the slowest to the fastest).
- the "Calls" tab shows the details of the operations performed in a process.
- Let's present these different tabs in our example.
- The "Summary" tab shows the ten longest processes. In our example, you can see that the "UpdateProductStock" local procedure takes more than 3 seconds to be executed (this time may change according to the power of your computer).
- The "Mapping" tab shows a graphical view of the elements that took the longest. In our case, it's a call to HTTPRequest:
- The "Details" tab shows all the processes or events executed, from the slowest to the fastest.
The following information is displayed for each process:
- Function: Function, event or procedure executed.
- Total time: Function execution window.
- Internal time: Execution time due to the engine.
- Nb of calls: Number of calls made to the function (procedure or event).
- Time 1 call: Execution time of a call to the function (procedure or event).
- Code %: Percentage of time it took to process the function or procedure (developer code that can be optimized).
- Parent: Element that contains the process or event.
- In our case, the "Details" tab indicates that the call to HTTPRequest is one of the elements taking the longest time.
- Select this line. We are going to check whether this slowdown is caused by a specific problem.
- Click "Calls" to view the details of the calls to the UpdateProductStock procedure.
- Select the "HTTPRequest" row and click the "Code" button: the corresponding line of WLanguage code appears in the code editor.
- Close the performance profiler.
- The following line of WLanguage code is executed:
HTTPRequest("supplier-addr")
The slowdown is caused by the fact that the address specified for HTTPRequest is not accessible.
| | |  | Note | The code editor shows a "Wrong way" icon to indicate that an error has been found on this line of code at runtime. The details of the error are shown when hovering over the icon. |
- Let's check how the application works when this code is optimized:
- Replace the line of code containing HTTPRequest by the following line of code:
// Checks the accessibility of the supplier server HTTPRequest("www.google.com")
- Save the code (Ctrl + S).
- We will restart the performance profiler:
- On the "Project" tab, "Audit and performance" group, expand "Analyze performance" and select "Analyze performance".
- The project test is run.
- Click "TEST PAGE OF PERFORMANCE PROFILER".
- Click "PROCESS TO ANALYZE".
- Validate the information window and stop the project test. The performance profiler report window appears.
- In the "Mapping" tab, HTTPRequest does not appear with the same importance.
- Close the performance profiler report window.
|
|
|
|