dart2js: 10x worse performance in lzma than DDC

  • Dart version: Dart VM version: 2.3.0 (Fri May 3 10:32:31 2019 +0200) on "windows_x64"
  • Chrome version: 74.0.3729.131 (Official Build) (64-bit) (cohort: Stable)
  • Firefox version: 66.0.3 (64-bit)

main.dart:

import 'dart:html';
import 'package:lzma/lzma.dart';
void main() async {
  await Future.delayed(Duration(seconds: 1));
  var t0 = DateTime.now();
  for (int i = 0; i < 10; i++) {
    lzma.encode((("ASDF$i" * 10).codeUnits));
  }
  var t1 = DateTime.now();
  document.body.text = "dt: ${t1.millisecondsSinceEpoch - t0.millisecondsSinceEpoch}";
}

Benchmark results:
webdev serve
Chrome: 3,683ms
Firefox: 10,969ms

webdev serve --release
Chrome: 43,095ms
Firefox: 11,536ms

Author: Fantashit

1 thought on “dart2js: 10x worse performance in lzma than DDC

  1. I would be more interested in knowing what customers want -O2 by default. I can’t think of any.

Comments are closed.