Skip to content

Commit 0c6124c

Browse files
jbdeboerDiana Salsbury
authored and
Diana Salsbury
committed
perf(watch group): Do not use List.map for tiny lists
1 parent 591f975 commit 0c6124c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/change_detection/watch_group.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,15 @@ class WatchGroup implements _EvalWatchList, _WatchGroupList {
235235
}
236236

237237
// Convert the args from AST to WatchRecords
238-
Iterable<WatchRecord<_Handler>> records = argsAST.map((ast) =>
239-
_cache.putIfAbsent(ast.expression, () => ast.setupWatch(this)));
240-
int i = 0;
241-
records.forEach((WatchRecord<_Handler> record) {
242-
_ArgHandler handler = new _PositionalArgHandler(this, evalWatchRecord, i++);
238+
for (var i = 0; i < argsAST.length; i++) {
239+
var ast = argsAST[i];
240+
WatchRecord<_Handler> record =
241+
_cache.putIfAbsent(ast.expression, () => ast.setupWatch(this));
242+
_ArgHandler handler = new _PositionalArgHandler(this, evalWatchRecord, i);
243243
_ArgHandlerList._add(invokeHandler, handler);
244244
record.handler.addForwardHandler(handler);
245245
handler.acceptValue(record.currentValue);
246-
});
246+
}
247247

248248
namedArgsAST.forEach((Symbol name, AST ast) {
249249
WatchRecord<_Handler> record = _cache.putIfAbsent(ast.expression,

0 commit comments

Comments
 (0)