-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work ondevexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.linter-false-positiveIssues related to lint rules that report a problem when it isn't a problem.Issues related to lint rules that report a problem when it isn't a problem.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
The first block in the following pattern triggers use_string_buffers
but the second block (which uses StringBuffer) is ~7% slower:
const int count = 100000;
void test(String s) { }
void main() {
Stopwatch t = new Stopwatch();
// USING STRING
t.start();
String s = '';
for (int i = 0; i < count; i += 1) {
s = s + '-$i';
test(s);
}
print(t.elapsedMicroseconds);
// USING STRINGBUFFER
t.reset();
StringBuffer b = new StringBuffer();
for (int i = 0; i < count; i += 1) {
b.write('-$i');
test(b.toString());
}
print(t.elapsedMicroseconds);
}
Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work ondevexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelegacy-area-analyzerUse area-devexp instead.Use area-devexp instead.linter-false-positiveIssues related to lint rules that report a problem when it isn't a problem.Issues related to lint rules that report a problem when it isn't a problem.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)