jsbench 0.2.1

jsbench #

A minimal Dart -> JavaScript size and performance tool.

This library assumes you are either using pub build or a similar tool to generate .dart.js files from .dart files, but otherwise makes no other assumptions. It is recommended to use --dump-info to output additional information about the compilation.

Example #

The following is an example of running jsbench on this repository:

$ pub build
$ pub run jsbench
main.dart.js35.9 kB
compiler overhead16.6 kB46.1%
minified?Yes
noSuchMethod?No
------------------------------------------------------------
dart:_js_helper10.9 kB30.3%
dart:html3.39 kB09.4%
dart:core2.47 kB06.9%
dart:_interceptors2.06 kB05.7%

Usage #

This tool should either be used via pub global activate or as part of your dev_dependencies.

Then, build your application, and run jsbench. For example:

$ pub build
$ pub run jsbench

To get more interesting information (not just disk size), add --dump-info:

transformers:
  - $dart2js:
      commandLineOptions:
          - --dump-info

See this packages' pubspec.yaml for an example.

If you want more information check out dump-info-visualizer.

Flags #

--no-dump: Ignores all .info.json files on disk.

--no-collapse-package: Do not collapse all package:<name> libraries.

--dump-trivial-size: Threshold number of bytes to print out a library name.

--input: Glob pattern(s) to find emitted JavaScript files.

--exclude Glob pattern(s) to exclude when finding inputs.

--archive: Archive formats to recursively read from when finding inputs. Only tar is currently supported.

0.2.1 #

  • Supports reading from the .tar file format when --archive=tar is passed.

This is an experimental feature that has only been tested on UNIX systems; it allows listing and reading files from within supported archive formats as-if the archive was just a folder on disk. Imagine the following:

output/
  bar.dart.js
  build.tar

Previously, jsbench would only "see" output/bar.dart.js.

Now, jsbench --archive=tar would also read the contents of build.tar and process as-if build.tar was actually the name of a folder. So, if there was a .dart.js file in, it would also be found and processed by jsbench.

0.2.0 #

  • Collapses libraries from a package. Use --no-collapse-package to opt-out.

0.1.0 #

  • Initial commit. See README.md for example usage.

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate jsbench

2. Use it

The package has the following executables:


$ jsbench
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <2.0.0