Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: Generating files from a list which is not a simple string rather a List<Map<String, dynamic>> takes over 30 minutes #1257

Open
absar opened this issue Feb 21, 2024 · 2 comments
Labels
performance Performance improvement waiting for response Waiting for additional information

Comments

@absar
Copy link

absar commented Feb 21, 2024

Generating files from a list which is not a simple string rather a List<Map<String, dynamic>> takes exponentially greater time. For example {{#updateMethods}}{{{usecaseName.snakeCase()}}}.dart{{/updateMethods}} takes over 30 minutes to generate 4 files on Windows 10 i7 processor with 16gb RAM, the process consumes only around 25% CPU and negligible disk and memory activity, however if you change the name extraction from triple { to double e.g. {{#updateMethods}}{{usecaseName.snakeCase()}}.dart{{/updateMethods}} then it generates in 5 seconds, however it only generates a single file by appending all names, with all the content meant for the 4 files.
Using latest mason CLI, Flutter 3.16.9

Sample input data:

{
  "project_name": "Project1",
  "feature_name": "Wallet",
  "updateMethods": [
    { "usecaseName": "UpdateBalance", "paramsToUpdate": [{"paramName": "balance", "paramType": "double"}]},
    { "usecaseName": "RewardA", "paramsToUpdate": [{"paramName": "balance", "paramType": "double"}, {"paramName": "rewardedCoins", "paramType": "double"}, {"paramName": "rewardedAt", "paramType": "DateTime"}]},
    { "usecaseName": "RewardB", "paramsToUpdate": [{"paramName": "balance", "paramType": "double"}, {"paramName": "rewardedCoins", "paramType": "double"}, {"paramName": "rewardedAt", "paramType": "DateTime"}]},
    { "usecaseName": "UpdateName", "paramsToUpdate": [{"paramName": "name", "paramType": "String"}]}
  ]
}
@absar absar added the performance Performance improvement label Feb 21, 2024
@felangel
Copy link
Owner

felangel commented Mar 7, 2024

Hi @absar 👋
Thanks for opening an issue!

It would be super helpful if you could provide a link to a minimal reproduction sample, thanks!

@felangel felangel added the waiting for response Waiting for additional information label Mar 7, 2024
absar added a commit to absar/mason_performance_issue_1257 that referenced this issue Mar 7, 2024
@absar
Copy link
Author

absar commented Mar 7, 2024

Hi @felangel here you go https://github.com/absar/mason_performance_issue_1257
Check the readme for additional comments and reproduction steps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance improvement waiting for response Waiting for additional information
Projects
None yet
Development

No branches or pull requests

2 participants