Skip to content

Commit 42e53b8

Browse files
committed
perf(ChangeDetector): create _EvalWatchRecord#namedArgs lazily
This change reduces the number of Maps in the heap on binding heavy views by 30%.
1 parent 11629de commit 42e53b8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/change_detection/watch_group.dart

+4-1
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,9 @@ class _NamedArgHandler extends _ArgHandler {
679679
super(watchGrp, 'namedArg[$name]', record);
680680

681681
void acceptValue(object) {
682+
if (watchRecord.namedArgs == null) {
683+
watchRecord.namedArgs = new Map<Symbol, dynamic>();
684+
}
682685
watchRecord.dirtyArgs = true;
683686
watchRecord.namedArgs[name] = object;
684687
}
@@ -728,7 +731,7 @@ class _EvalWatchRecord implements WatchRecord<_Handler> {
728731
WatchGroup watchGrp;
729732
final _Handler handler;
730733
final List args;
731-
final Map<Symbol, dynamic> namedArgs = new Map<Symbol, dynamic>();
734+
Map<Symbol, dynamic> namedArgs = null;
732735
final String name;
733736
int mode;
734737
Function fn;

0 commit comments

Comments
 (0)