mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Optimize static error test file parsing.
For some reason, the regexp to strip off multitest comments was very slow. On a couple of co_19 tests with pathologically long lines, it would hang practically forever. Even on shorter lines, it was noticeably slow. This fixes that. Change-Id: I04f2894f474dcc593e982dd691945421396274a6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193222 Auto-Submit: Bob Nystrom <rnystrom@google.com> Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Paul Berry <paulberry@google.com>
This commit is contained in:
parent
fa243e700a
commit
5cc772b8aa
1 changed files with 3 additions and 6 deletions
|
@ -392,9 +392,6 @@ class _ErrorExpectationParser {
|
|||
/// are part of it.
|
||||
static final _errorMessageRestRegExp = RegExp(r"^\s*//\s*(.*)");
|
||||
|
||||
/// Matches the multitest marker and yields the preceding content.
|
||||
final _stripMultitestRegExp = RegExp(r"(.*)//#");
|
||||
|
||||
final List<String> _lines;
|
||||
final List<StaticError> _errors = [];
|
||||
int _currentLine = 0;
|
||||
|
@ -524,9 +521,9 @@ class _ErrorExpectationParser {
|
|||
var line = _lines[_currentLine + offset];
|
||||
|
||||
// Strip off any multitest marker.
|
||||
var multitestMatch = _stripMultitestRegExp.firstMatch(line);
|
||||
if (multitestMatch != null) {
|
||||
line = multitestMatch.group(1).trimRight();
|
||||
var index = line.indexOf("//#");
|
||||
if (index != -1) {
|
||||
line = line.substring(0, index).trimRight();
|
||||
}
|
||||
|
||||
return line;
|
||||
|
|
Loading…
Reference in a new issue