Use stringbuilder instead of adding to string
Change Viewmodelbinder to use a StringBuilder to improve performance
if (MessageBinder.SpecialValues.ContainsKey(specialValue))
paramName = specialValue;
message += paramName + ",";
Tracking issue for:
- [ ] https://github.com/Caliburn-Micro/Caliburn.Micro/security/code-scanning/87
Hi, @vb2ae. I've committed a change concerning this issue here. If you find this version satisfactory, I can create a PR.
Additionally, based on BenchmarkDotnet, I conducted a simple assessment on whether to use StringBuilder. I found that for methods with fewer than 3 parameters, the original method seems to have better performance in my environment. You can view the evaluation results on this page. Feel free to take a look if you're interested.
The code looks good. 'The report you did is awesome. I will have to think about it. I also was thinking since this code runs on a phone we need to worry about memory usage because strings are immutable.
Thank you for your positive feedback. If there are further suggestions down the line, I'd be honored to continue making efforts to address them.