This issue was brought to my attention through dart-lang/webdev#800
Reproduction steps:
- Build and serve the following application with DDC, e.g.
webdev serve
.
import 'dart:async';
Future<int> recurse(int count) async {
if (count == 0) {
return count;
}
return recurse(count - 1);
}
void main() async {
await recurse(100);
}
-
Using Chrome DevTools set a breakpoint on the line that contains
return count;
. -
Once the breakpoint is hit, try to
step over
. Notice that stepping takes several seconds when it should be nearly instant.
Root cause:
The issue is caused by the captured Closure
context for a runBody
call inside the Dart SDK. These contexts contain tons and tons of constant symbols, for example:
When debugging, this information is serialized and sent to the Chrome debugger (or package:dwds
). This causes significant slow downs. We should be able to collect these top level symbols into a single map which resolve this issue.
I’m tentatively closing this issue since @Markzipan landed 37d8c78 and 2e97d91 to undo the overhead of hoisting so many symbols on each module.