ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WEBDEV 28 feature!
  • 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.
Lesson duration

Estimated time: 15 mn
Previous LessonTable of contentsNext Lesson
Overview
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:
    ProfilerStartStarts "collecting data" for the performance profiler.
    ProfilerEndStops "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:
    1. 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".
        'Performance' widget (project dashboard)
    2. The project test is run.
    3. Click "TEST PAGE OF PERFORMANCE PROFILER".
    4. Click "PROCESS TO ANALYZE".
    5. Validate the information window and close the browser to stop the project test. The performance profiler report window appears.
Analyzing the result
  • 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).
      Performance profiler - 'Summary' tab
    • The "Mapping" tab shows a graphical view of the elements that took the longest. In our case, it's a call to HTTPRequest:
      Performance profiler - 'Mapping' tab
    • The "Details" tab shows all the processes or events executed, from the slowest to the fastest.
      Performance profiler - 'Details' tab
      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.
    1. Select this line. We are going to check whether this slowdown is caused by a specific problem.
    2. Click "Calls" to view the details of the calls to the UpdateProductStock procedure.
      Calls made by the local procedure
    3. Select the "HTTPRequest" row and click the "Code" button: the corresponding line of WLanguage code appears in the code editor.
    4. Close the performance profiler.
    5. 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:
    1. Replace the line of code containing HTTPRequest by the following line of code:
      // Checks the accessibility of the supplier server
      HTTPRequest("www.google.com")
    2. Save the code (Ctrl + S).
  • We will restart the performance profiler:
    1. On the "Project" tab, "Audit and performance" group, expand "Analyze performance" and select "Analyze performance".
    2. The project test is run.
    3. Click "TEST PAGE OF PERFORMANCE PROFILER".
    4. Click "PROCESS TO ANALYZE".
    5. Validate the information window and stop the project test. The performance profiler report window appears.
    6. In the "Mapping" tab, HTTPRequest does not appear with the same importance.
      Performance profiler - 'Mapping' tab
  • Close the performance profiler report window.
Previous LessonTable of contentsNext Lesson
Minimum version required
  • Version 28
Comments
Click [Add] to post a comment