mason
mason copied to clipboard
perf: Generating files from a list which is not a simple string rather a List<Map<String, dynamic>> takes over 30 minutes
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"}]}
]
}
Hi @absar 👋 Thanks for opening an issue!
It would be super helpful if you could provide a link to a minimal reproduction sample, thanks!
Hi @felangel here you go https://github.com/absar/mason_performance_issue_1257 Check the readme for additional comments and reproduction steps