-
Notifications
You must be signed in to change notification settings - Fork 23
Add use_string_buffers
to the core
or recommended
sets
#784
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
Comments
I worry a bit about recommending this one. The false positives may be rare, but I like to avoid lints with legitimate false positives that don't have any other mechanism than an I know @kevmoo is a fan of this lint. It does help more often than it hurts. |
It keeps folks from using |
Ha! It was the referenced issue. 🤦 |
Short version: yes, I'm a fan. I think |
It's only a problem if you do it inside a loop, or do it repeatedly with long strings. Otherwise the overhead of allocating a The lint description is (as usual) very terse and doesn't say where it applies. If it applies outside of loops, and not just for more than n repeated additions to the same string in linear code, then it's simply too strict. Using |
After discussion, we think this lint will have too many false positives to add to package:lints. We would want this to only trigger for performance sensitive sections of code, but its not clear how we could successfully lint for that. |
Using string buffers instead of
+=
can save a lot of time and space, as seen in this issue: dart-lang/sdk#50304.StringBuffer
isn't necessarily ubiquitous, so the lint that tells you to use it should be enabled by default, either incore
orrecommended
.The text was updated successfully, but these errors were encountered: