Skip to content

Commit 0240a90

Browse files
committed
Revert "Removed superfluous copy in license checker (flutter#167146)"
This reverts commit b4dc233. The license script provides a RegExp wrapper that tracks the cost of the script's regexes. Dart's RegExp.allMatches returns an Iterable whose iterators lazily execute the regex. Calling toList will execute the regex on the entire input within allMatches, allowing measurement of the regex's cost. Returning the Iterable will instead shift the execution cost to the caller. Also, in local measurements I'm seeing significantly better performance from finding all of the matches immediately with toList versus having the caller use the lazy iterator.
1 parent a8a61a1 commit 0240a90

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Signature: bff1faf38fdddc991c42ef472cefd3e7
1+
Signature: 72079bc1edfa9c01900da12816e18f0e
22

engine/src/flutter/tools/licenses/lib/regexp_debug.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class RegExp implements core.RegExp {
103103
@override
104104
Iterable<RegExpMatch> allMatches(String input, [int start = 0]) {
105105
_stopwatch.start();
106-
final Iterable<RegExpMatch> result = _pattern.allMatches(input, start);
106+
final List<RegExpMatch> result = _pattern.allMatches(input, start).toList();
107107
_stopwatch.stop();
108108
_testCount += 1;
109109
if (result.isNotEmpty) {

0 commit comments

Comments
 (0)