This package helps benchmark and identify areas for improvement in Dart2JS.
Specifically, we are tracking:
- Code size of the final
.dart.js
binary. - Cold (non-JITd) startup cost of running
.dart.js
(affecting TTI).- Not including impact to download speed on low-end devices/networks.
The following was run as an example only on the following machine:
- MacBook Pro 15-Inch 2016
- 2.9 GHz Intel Core i7
- 16 GB 2133 MHz LPDDR3
With the following tools:
- Dart VM/SDK
2.0.0-dev.6.0
- NodeJS
v8.9.0
None of the benchmarks instrument threading (single-threaded nodeJS).
To run the benchmarks yourself:
$ git clone https://github.com/matanlurey/dart-js-improvements.git
$ pub build benchmark
And then for the code-size, run:
$ pub run jsbench
And for runtime speed, run:
$ dart tool/patch.dart
$ dart tool/sample.dart
The following used a sample-size of 100.
We run benchmarks instantiating 1000 classes that may store RTTI.
- Size: 162kB
- Mean: 203.25ms
- Median: 199ms
- Size: 49.2kB
- Mean: 132.75ms
- Median: 133ms
We run benchmarks instantiating 1000 enums with 5 fields each.
- Size: 205kB
- Mean: 134.39ms
- Median: 132ms
- Size: 10.3kB
- Mean: 61.97ms
- Median: 61ms
- Size: 264kB
- Mean: 132.09ms
- Median: 131ms
We run benchmarks creating 1000 stream-likes and listening to them.
- Size: 160kB
- Mean: 129.49ms
- Median: 129ms
- Size: 167kB
- Mean: 131.4ms
- Median: 131ms
- Size: 204kB
- Mean: 139.23ms
- Median: 138ms
We create 1000 lists or arrays, add items, use some common methods.
NOTE: Code-size is not included here, since the JS code is not minified.
- Mean: 145.86ms
- Median: 121ms
Using eval()
, which has overhead on top of plain JavaScript.
- Mean: 122.94ms
- Median: 121ms
- Mean: 160.8ms
- Median: 152ms
- Mean: 148.58ms
- Median: 147ms
Decodes+encodes an almost 13mb representative JSON data set.
NOTE: Code-size is not included here as it is not significantly different.
- Mean: 957.56ms
- Median: 948ms
- Mean: 301.96ms
- Median: 297ms