felangel / felangel/mason

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

Open
#1,257 3 comments 2 reactions 0 assignees View on GitHub
performance waiting for response
Dominant language
Dart
Stars
1.1k
Forks
113
PR merge metrics
No merged PRs in 30d

Description

Generating files from a list which is not a simple string rather a `List>` 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:
```json
{
"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"}]}
]
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.