Skip to content

[Python][Perf] optimize speed to generate sdk #9448

@msyyc

Description

@msyyc

use branch https://github.com/microsoft/typespec/tree/python-perf to count cost time:

================================================================================
PROFILER SUMMARY
================================================================================
Label                                       Total(ms)    Calls      Avg(ms)    Min(ms)    Max(ms)        %
--------------------------------------------------------------------------------
execSync:run_tsp.py                        2674349.80        1   2674349.80 2674349.80 2674349.80    95.5%
execSync:black                               95600.04        1     95600.04   95600.04   95600.04     3.4%
createPythonSdkContext                       26404.36        1     26404.36   26404.36   26404.36     0.9%
checkForPylintIssues                          1379.87        1      1379.87    1379.87    1379.87     0.0%
saveCodeModelAsYaml                            940.50        1       940.50     940.50     940.50     0.0%
emitCodeModel                                  585.88        1       585.88     585.88     585.88     0.0%
walkThroughNodes                               124.55        1       124.55     124.55     124.55     0.0%
addDefaultOptions                                0.25        1         0.25       0.25       0.25     0.0%
cleanAllCache                                    0.02        1         0.02       0.02       0.02     0.0%
--------------------------------------------------------------------------------
TOTAL                                      2799385.28
================================================================================

If you want to count time cost of python code, run command of alpha/command.txt then you could get:

====================================================================================================
PROFILER SUMMARY
====================================================================================================
Label                                            Total(ms)    Calls      Avg(ms)    Min(ms)    Max(ms)        %
----------------------------------------------------------------------------------------------------
CodeGenerator.process                           2545964.04        1   2545964.04 2545964.04 2545964.04    49.4%
CodeGenerator.serializer.serialize              2519702.40        1   2519702.40 2519702.40 2519702.40    48.9%
PreProcessPlugin.process                          28140.22        1     28140.22   28140.22   28140.22     0.5%
CodeGenerator.get_yaml                            25608.76        1     25608.76   25608.76   25608.76     0.5%
PreProcessPlugin.yaml_safe_dump                   14401.07        1     14401.07   14401.07   14401.07     0.3%
PreProcessPlugin.get_yaml                         12824.93        1     12824.93   12824.93   12824.93     0.2%
PreProcessPlugin.update_yaml                        863.18        1       863.18     863.18     863.18     0.0%
PreProcessPlugin.update_operation_groups[0]         840.51        1       840.51     840.51     840.51     0.0%
CodeGenerator.CodeModel_init                        649.89        1       649.89     649.89     649.89     0.0%
PreProcessPlugin.write_yaml                          27.88        1        27.88      27.88      27.88     0.0%
PreProcessPlugin.update_types                        15.56        1        15.56      15.56      15.56     0.0%
PreProcessPlugin.update_client[0]                     6.61        1         6.61       6.61       6.61     0.0%
CodeGenerator.sort_exceptions                         1.04        1         1.04       1.04       1.04     0.0%
CodeGenerator.remove_cloud_errors                     0.27        1         0.27       0.27       0.27     0.0%
CodeGenerator.get_serializer                          0.23        1         0.23       0.23       0.23     0.0%
PreProcessPlugin.pad_builtin_namespaces               0.01        1         0.01       0.01       0.01     0.0%
----------------------------------------------------------------------------------------------------
TOTAL                                           5149046.60
====================================================================================================

Metadata

Metadata

Assignees

Labels

emitter:client:pythonIssue for the Python client emitter: @typespec/http-client-python

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions