From 61f33489055717fecb0c0f58a0cee663bd535846 Mon Sep 17 00:00:00 2001 From: James deBoer Date: Thu, 29 May 2014 15:21:44 -0700 Subject: [PATCH] perf(watch group): Do not use List.map for tiny lists --- lib/change_detection/watch_group.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/change_detection/watch_group.dart b/lib/change_detection/watch_group.dart index 14d327d5f..884491d06 100644 --- a/lib/change_detection/watch_group.dart +++ b/lib/change_detection/watch_group.dart @@ -235,15 +235,15 @@ class WatchGroup implements _EvalWatchList, _WatchGroupList { } // Convert the args from AST to WatchRecords - Iterable> records = argsAST.map((ast) => - _cache.putIfAbsent(ast.expression, () => ast.setupWatch(this))); - int i = 0; - records.forEach((WatchRecord<_Handler> record) { - _ArgHandler handler = new _PositionalArgHandler(this, evalWatchRecord, i++); + for (var i = 0; i < argsAST.length; i++) { + var ast = argsAST[i]; + WatchRecord<_Handler> record = + _cache.putIfAbsent(ast.expression, () => ast.setupWatch(this)); + _ArgHandler handler = new _PositionalArgHandler(this, evalWatchRecord, i); _ArgHandlerList._add(invokeHandler, handler); record.handler.addForwardHandler(handler); handler.acceptValue(record.currentValue); - }); + } namedArgsAST.forEach((Symbol name, AST ast) { WatchRecord<_Handler> record = _cache.putIfAbsent(ast.expression,