Rate This Document
Findability
Accuracy
Completeness
Readability

Tuning Performance Bottlenecks

  1. Modify the code, join character strings, repeat the steps in the previous section, and view the analysis result.

    Change the running parameter to string_join.

    Figure 1 Join command
  2. Create a hotspot function analysis task again and view the analysis result.

    Click next to the System Profiler and select General analysis. On the task creation page that is displayed, select Hotspot Function, set the required parameters, and click OK to start the hotspot function analysis task. Retain the default values for the parameters unless otherwise specified.

    Figure 2 Creating a hotspot function analysis task

    For a demo that uses the join method, the application parameter is /opt/testdemo/concatenate_string.py string_join.

    Table 1 Task parameters

    Parameter

    Description

    Analysis Type

    Set it to Hotspot functions.

    Analysis Object

    Set it to Application.

    Mode

    Set it to Launch application.

    Application Path

    /usr/bin/python3

    Application Parameter

    /opt/testdemo/concatenate_string.py string_join

    Sampling Duration

    Set it to 10.

    Call Stack

    Enable this option.

  3. View the hotspot function analysis result.

    According to the hotspot function analysis, the execution duration is reduced by half, and __libc_realloc is no longer a top hotspot function.

    Figure 3 Analysis result after tuning

Summary

Table 2 Tuning summary

String Concatenation Mode

Running Time

Use a plus sign (+) to concatenate strings.

11.020s

Use the word join to concatenate strings.

5.025s