|
|
|
|
|
- Lesson 1 - Project audits
- Overview
- What is an audit?
- Opening the project
- Static audit
- Optimization 1: Procedure not executed
- Optimization 2: Orphan element
- Optimization 3: Project cleanup
- Dynamic audit
- Conclusion
Tutorial - Optimizing a WEBDEV project
Lesson 1 - Project audits We will cover the following topics: - What is an audit and what is its purpose?
- Starting and analyzing the static audit.
- Starting and analyzing the dynamic audit.
15 min WEBDEV provides you with several website optimization tools. You can improve performance and avoid bugs before deploying your website. This tutorial explains how to use some of these tools. In this lesson, we will cover the different audits available, and in the next lesson, we will see how to use the performance profiler. We have prepared a project to help you better understand and use these tools! Audits provide a set of features used to: - automatically improve the quality and performance of a project,
- monitor how it is put into production.
Two types of audits are available: - Static audit. The static audit analyzes a project and its elements. This audit is performed from the project editor.
- Dynamic audit. The dynamic audit analyzes the behavior of a project during its execution. This audit can be performed in test mode or in the production environment.
We are going to test these audits on the "WW_Optimization" project. Opening the project This tutorial uses the "WW_Optimization" project. To open this example: - Go to the WEBDEV home page (Ctrl + <).
- On the home page, click "Tutorial", then in "Tutorial - Optimize a WEBDEV project", click "Open exercise project".
Warning
This project will be used in the different lessons of this tutorial.
The static audit is a feature of the environment used to analyze the source code of a project in order to detect various problems and to propose improvements. To start the static audit on the "WW_Optimization" project: - In the ribbon, go to the "Project" tab, "Audit and performance" group, expand "Static audit" and select "Start static audit".
- The wizard starts. We will define the target of the static audit.
- Select "Run the static audit on the entire project".
- Finish the wizard.
- The audit report is displayed:
The static audit includes: - the audit report (which we will look at in detail below).
- the analysis of the application library.
For more details, see Static audit. Let's take a closer look at the points presented in this report. Optimization 1: Procedure not executed In our project, the audit indicates that a procedure is never executed. In large projects, you may want to create one or more procedures to perform a process then, further to a code reorganization, the procedure is no longer used but it remains in the project. These unused procedures unnecessarily overload the resources distributed to end-users. To fix this problem: - Click the [...] button to get more details. The window that lists the dead code opens.
- The "ObsoleteProcedure" procedure is never called. This window is used to:
- specify that the procedure is still used ("Mark as useful"). In this case, the procedure will no longer be taken into account in the audit.
- delete the procedure if it is not used ("Delete").
- see the procedure ("View").
- find the occurrences in the strings ("Search").
- In our case, this procedure is not used, click "Delete".
- A window prompts you to confirm the deletion. Click "Delete" to confirm the deletion.
- Close the dead code window (click "X" in the upper-right corner).
In the static audit window, click the "Refresh" button to update the audit report. Optimization 2: Orphan element The audit indicates that our project contains an orphan element. Just like with procedures, windows or reports can be created to run a quick test, then be saved and forgotten. The presence of orphan elements in the executable file unnecessarily overloads the resources distributed to end users. To fix this problem: - Click the [...] button to get more details. The window used to list the orphan elements is displayed.
- The "PAGE_Unused_Page" page is never called. The window that lists the orphan elements is used to:
- specify that the element is still used ("Mark as useful"). In this case, the page will no longer be taken into account in the audit. This option can be useful when using a test page specific to a development project, for example.
- delete the page if it is not used ("Delete").
- see the page ("View").
- find the occurrences in the strings ("Search").
- In our case, "PAGE_Unused_Page" is not used, click "Delete".
- Close the window of orphan elements (click the "X" in the upper-right corner).
In the static audit window, click the "Refresh" button to update the audit report. Optimization 3: Project cleanup Our project contains multiple unused files. You can clean the project to keep only the necessary elements. The client setup is not cluttered with unused files such as images, external files, etc. To fix this problem: - Click the [...] button to get more details.
- The project cleanup wizard starts. This wizard shows the unused files that can be deleted.
- Go to the next step.
- Select the type of cleanup. You can:
- create a zip file with the unused files.
- move the unused files to a specific directory.
- Keep the default option and go to the next step.
- Finish the wizard.
Our project has been optimized by following all the tips of the static audit. The static audit is used to get an overall status on the source code of your project. It is recommended to run it on a regular basis. Let's see what happens at runtime when the dynamic audit is started. The dynamic audit is used to analyze the application execution. The audit detects problems such as: - Excessive memory consumption,
- Slowness of algorithms used,
- Errors "hidden" at runtime,
- etc.
A dynamic audit can be performed in a test environment or on a live application. The "WW_Optimization" project contains a specific page triggering errors that can be detected by the dynamic audit. The dynamic audit and the project test will be started at the same time.
To start the dynamic audit on the "WW_Optimization" project: - In the ribbon, on the "Project" tab, in the "Test mode" group, expand "Test mode" and select "Debug and audit project". The project test is run.
- Click "TEST PAGE OF DYNAMIC AUDIT".
- Click the different buttons in the page.
- At the end of each process, a toast message is displayed to specify that the process is over.
Note: Wait until the toast is displayed before clicking another button. - For the "Assertion and Exception" option, an assertion is displayed. Click "Continue" to see the message appear as a toast.
- Stop the website test.
- The report window of the dynamic audit appears.
Let's analyze this window: - The top section of this window allows you to choose the data display options. You can:
- choose a chronological display (based on the order in which the events occurred) or an overall display, used to group the different types of issues. When data is displayed in chronological order, a timeline shows the position and importance of the issues.
- choose the type of issue to be displayed (error, assertion, etc.). This allows you to focus on major errors.
- The bottom section of this window displays the different events that occurred and that may cause problems in the application.
In this example, the dynamic audit detects several problems: - A SWITCH statement for which no CASE is run,
- A triggered assertion,
- A triggered exception,
- The assignment of a nonexistent image file to an Image control. For each problem, a "..." button allows you to access the details of the event. If the event is linked to a specific line of code, the button allows you to open the code editor directly at the corresponding location in order to fix the problem.
Warning
This lesson only shows an overview of the dynamic audit, we will not fix all the errors.
Close the dynamic audit window. Static and dynamic audits are two essential tools that help you quickly identify problems or bottlenecks in your application. You can also find these tools in the project dashboard. In the next lesson, we will see how to use the performance profiler. Further information: You can run the project dynamic audit when the website is deployed. You can use dbgEnableAudit to start the dynamic audit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|