Skip to content

[perf] optimize performance of dpg model#2750

Merged
tadelesh merged 9 commits intomainfrom
perf_model_base
Aug 13, 2024
Merged

[perf] optimize performance of dpg model#2750
tadelesh merged 9 commits intomainfrom
perf_model_base

Conversation

@tadelesh
Copy link
Copy Markdown
Member

@tadelesh tadelesh commented Aug 6, 2024

remove duplicate field meta calculation

benchmark result:

after

-------------------------------------------------------- benchmark: 1 tests -------------------------------------------------------
Name (time in ms)                         Min       Max      Mean   StdDev    Median      IQR  Outliers     OPS  Rounds  Iterations
-----------------------------------------------------------------------------------------------------------------------------------
test_model_deserialize_benchmark     253.9392  307.1185  274.8877  15.6897  272.1042  18.4898       2;0  3.6378      10          10
-----------------------------------------------------------------------------------------------------------------------------------

before

------------------------------------------------------- benchmark: 1 tests -------------------------------------------------------
Name (time in ms)                         Min       Max      Mean   StdDev    Median     IQR  Outliers     OPS  Rounds  Iterations
----------------------------------------------------------------------------------------------------------------------------------
test_model_deserialize_benchmark     351.3292  389.2542  363.0398  11.8526  358.8576  9.2000       2;1  2.7545      10          10
----------------------------------------------------------------------------------------------------------------------------------

profile result:

before.txt

after.txt

@annatisch
Copy link
Copy Markdown
Member

Thanks so much for this @tadelesh
I mad a PR earlier that was never review that modified the same piece of code - could you maybe investigate whether it's worth incorporating my change into your PR?
#2471

@tadelesh
Copy link
Copy Markdown
Member Author

tadelesh commented Aug 7, 2024

Thanks so much for this @tadelesh I mad a PR earlier that was never review that modified the same piece of code - could you maybe investigate whether it's worth incorporating my change into your PR? #2471

added.

@tadelesh
Copy link
Copy Markdown
Member Author

tadelesh commented Aug 7, 2024

update benchmark:

-------------------------------------------------------- benchmark: 1 tests -------------------------------------------------------
Name (time in ms)                         Min       Max      Mean   StdDev    Median      IQR  Outliers     OPS  Rounds  Iterations
-----------------------------------------------------------------------------------------------------------------------------------
test_model_deserialize_benchmark     258.7378  310.3882  283.7623  14.3293  284.2113  12.5630       3;1  3.5241      10          10
-----------------------------------------------------------------------------------------------------------------------------------

@msyyc
Copy link
Copy Markdown
Member

msyyc commented Aug 7, 2024

update benchmark:

-------------------------------------------------------- benchmark: 1 tests -------------------------------------------------------
Name (time in ms)                         Min       Max      Mean   StdDev    Median      IQR  Outliers     OPS  Rounds  Iterations
-----------------------------------------------------------------------------------------------------------------------------------
test_model_deserialize_benchmark     258.7378  310.3882  283.7623  14.3293  284.2113  12.5630       3;1  3.5241      10          10
-----------------------------------------------------------------------------------------------------------------------------------

Could you add the benchmard test into this PR?

@tadelesh
Copy link
Copy Markdown
Member Author

tadelesh commented Aug 8, 2024

update benchmark:

-------------------------------------------------------- benchmark: 1 tests -------------------------------------------------------
Name (time in ms)                         Min       Max      Mean   StdDev    Median      IQR  Outliers     OPS  Rounds  Iterations
-----------------------------------------------------------------------------------------------------------------------------------
test_model_deserialize_benchmark     258.7378  310.3882  283.7623  14.3293  284.2113  12.5630       3;1  3.5241      10          10
-----------------------------------------------------------------------------------------------------------------------------------

Could you add the benchmard test into this PR?

i'll do that in another pr. i need to do some organization for the test code.

@tadelesh
Copy link
Copy Markdown
Member Author

tadelesh commented Aug 8, 2024

@annatisch could you help to review this PR?

Comment thread packages/typespec-python/generator/pygen/codegen/templates/model_base.py.jinja2 Outdated
Comment thread packages/typespec-python/generator/pygen/codegen/templates/model_base.py.jinja2 Outdated
Comment thread packages/typespec-python/generator/pygen/codegen/templates/model_base.py.jinja2 Outdated
@tadelesh tadelesh requested a review from annatisch August 12, 2024 09:43
@annatisch
Copy link
Copy Markdown
Member

Thank you @tadelesh!

@tadelesh tadelesh merged commit 2575db7 into main Aug 13, 2024
@tadelesh tadelesh deleted the perf_model_base branch August 13, 2024 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants