-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.dart2js-optimizationtype-enhancementA request for a change that isn't a bugA request for a change that isn't a bugweb-dart2js
Description
In-line closures with no free variables are common, e.g.
aMap.putIfAbsent(aKey, () => []));
var names = people.map((person) => person.name).toList();
It is a shame to allocate a closure each time. We should generate code where this is more like a top level or static function, or a lazy initialized top level variable or something custom that avoids any of the reflective overhead of the above two ideas, e.g.
var theClosure;
...
... (theClosure || (theClosure = new FnClosure()))
There is also the possibility of sharing code for different free 'closures' that do the same thing.
Metadata
Metadata
Assignees
Labels
area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.dart2js-optimizationtype-enhancementA request for a change that isn't a bugA request for a change that isn't a bugweb-dart2js