ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WINDEV 2024 feature!
Help / WINDEV Tutorial / Tutorial - Optimizing a project
  • Lesson 2 - Performance profiler
  • Performance profiler overview
  • Starting the performance profiler
  • Analyzing the result
  • Result of the example
  • Optimizing the application
  • Conclusion

Tutorial - Optimizing a project

Lesson 2 - Performance profiler
We will cover the following topics:
  • Performance profiler overview.
  • Starting the performance profiler.
  • Analyzing the result.
Durée de la leçon 15 mn
Performance profiler overview
The performance profiler checks and optimizes the execution time of the application processes.
The principle is straightforward:
  • You test your application.
  • 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 "WD Optimization" project has a specific window that shows examples of results obtained with the performance profiler.
Starting the performance profiler
The performance profiler can be started directly from the WINDEV editor.
To run the performance profiler on the "WD Optimization" project:
  1. On the "Project" tab, "Audit and performance" group, expand "Analyze performance" and select "Analyze performance".
  2. Click the "Test window of performance profiler" button.
  3. Click the "Process to analyze" button.
  4. Validate the information window and stop the project test. The performance profiler report window appears.
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.
Analyzing the result

Result of the example

Let's take a closer look at the result of our example.
  • The "Summary" tab shows the ten longest processes. In our example, you can see that the local procedure named "UpdateProductStock" takes more than 3 seconds to run.
    Performance profiler - Summary
  • The "Mapping" tab shows a graphical view of the elements that took the longest. In our case, it's a call to Ping:
    Performance profiler - Mapping
  • The "Details" tab shows all the processes or events executed, from the slowest to the fastest.
    Performance profiler - Details
In our case, the "Details" tab indicates that the call to the "Ping" function 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.
  3. Select the "Ping" line and click "Code": the corresponding line of code appears in the editor.
  4. Close the performance profiler.
  5. The following line of code is run:
    // Checks the accessibility of the supplier server
    Ping("supplier-addr")
    The slowdown is caused by the fact that the address specified for Ping is not accessible.
    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.

Optimizing the application

We will optimize this code:
  1. Replace the line of code containing Ping by the following line of code:
    // Checks the accessibility of the supplier server
    Ping("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 the "Test window of performance profiler" button.
  4. Click the "Process to analyze" button.
  5. Validate the information window and stop the project test. The performance profiler report window appears.
  6. In the "Mapping" tab, Ping does not appear with the same importance.
    Performance profiler - Mapping
We have optimized the application using the performance profiler.
Close the performance profiler report window.
Conclusion
In this lesson, we saw how to use the performance profiler.
The performance profiler can also be run from a WLanguage process, using the following functions:
  • ProfilerStart, which starts "collecting data" for the performance profiler.
  • ProfilerEnd, which stops "collecting data" for the performance profiler.
In this case, only the code between ProfilerStart and ProfilerEnd will be analyzed. The result is saved as a WPF file that can be read by WINDEV.
For more details, see Performance profiler.
Previous LessonTable of contents
Minimum version required
  • Version 2024
Comments
Click [Add] to post a comment

Last update: 12/04/2023

Send a report | Local help