Why is browser based Dart-test sooooo slow?
- Dominant language
- Dart
- Stars
- 536
- Forks
- 232
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 10
Description
This simple test:
```dart
@TestOn("chrome")
library test.unit.core.utils;
import 'package:test/test.dart';
import 'dart:html' as dom;
main() {
final dom.DivElement div = new dom.DivElement();
test('> isDomElement', () async {
expect(div,isNotNull);
expect(true, isTrue);
expect(true, isTrue);
});
}
```
Takes ~15sec on a machine with 32GB Ram, SSD and i7
```bash
> SlowDart $ time pub run build_runner test -- test/unit/core/basic_test.dart -n "> isDomElement" -p chrome
[INFO] Generating build script completed, took 377ms
[INFO] Reading cached asset graph completed, took 328ms
[INFO] Checking for updates since last build completed, took 520ms
[INFO] Running build completed, took 8.2s
[INFO] Caching finalized dependency graph completed, took 130ms
[INFO] Creating merged output dir `/var/folders/m4/9rg16xhd2rlbln753n9zk1540000gn/T/build_runner_testsEKn1x/` completed, took 2.3s
[INFO] Writing asset manifest completed, took 3ms
[INFO] Succeeded after 10.7s with 13 outputs (10 actions)
Running tests...
00:01 +1: All tests passed!
real 0m16.595s
user 0m19.017s
sys 0m2.732s
```
On a second run without any changes it takes ~8secs - but its in the nature of tests that they change frequently while developing the test specific functionality
Im on a Mac with 10.11.6 and
Dart VM version: 2.0.0-dev.61.0 (Mon Jun 11 15:46:09 2018 +0200) on "macos_x64"
Contributor guide
Research direction
Reproduce the command against test/unit/core/basic_test.dart with the Chrome platform and compare first and repeat runs. Start with the build_runner timing entries in the report, then inspect the test runner path responsible for browser builds. Done means the source of the delay is identified and the issue has a verified improvement or a documented explanation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- testing, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100