Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 61f3348

Browse files
committed
perf(watch group): Do not use List.map for tiny lists
1 parent 6062610 commit 61f3348

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/change_detection/watch_group.dart

+6-6
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)