benchmark_harness 1.0.4

  • README.md
  • Installing
  • Versions
  • 62

Dart Benchmark Harness

==========================

Introduction

The Dart project benchmark harness is the recommended starting point when building a benchmark for Dart.

Interpreting Results

By default, the reported runtime is not for a single call to run(), but for the average time it takes to call run() 10 times. The benchmark harness executes a 10-call timing loop repeatedly until 2 seconds have elapsed; the reported result is the average of the runtimes for each loop.

Comparing Results

If you are running the same benchmark, on the same machine, running the same OS, the reported run times can be carefully compared across runs. Carefully because there are a variety of factors which could cause error in the run time, for example, the load from other applications running on your machine could alter the result.

Comparing the run time of different benchmarks is not recommended. In other words, don't compare apples with oranges.

Features

  • BenchmarkBase class that all new benchmarks should extend
  • Two sample benchmarks (DeltaBlue & Richards)
  • Template benchmark that you can copy and paste when building new benchmarks

Getting Started

1. Add the following to your project's pubspec.yaml

dependencies:
    benchmark_harness: any

2. Install pub packages

pub install

3. Add the following import:

import 'package:benchmark_harness/benchmark_harness.dart';

4. Create a benchmark class which inherits from BenchmarkBase

Example

// Import BenchmarkBase class.
import 'package:benchmark_harness/benchmark_harness.dart';

// Create a new benchmark by extending BenchmarkBase
class TemplateBenchmark extends BenchmarkBase {
  const TemplateBenchmark() : super("Template");

  static void main() {
    new TemplateBenchmark().report();
  }

  // The benchmark code.
  void run() {
  }

  // Not measured setup code executed prior to the benchmark runs.
  void setup() { }

  // Not measures teardown code executed after the benchark runs.
  void teardown() { }
}

main() {
  // Run TemplateBenchmark
  TemplateBenchmark.main();
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  benchmark_harness: "^1.0.4"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


      import 'package:benchmark_harness/benchmark_harness.dart';
  
Version Uploaded Documentation Archive
1.0.4 Feb 14, 2014 Go to the documentation of benchmark_harness 1.0.4 Download benchmark_harness 1.0.4 archive
1.0.3 Jan 10, 2014 Go to the documentation of benchmark_harness 1.0.3 Download benchmark_harness 1.0.3 archive
1.0.2 Dec 20, 2012 Go to the documentation of benchmark_harness 1.0.2 Download benchmark_harness 1.0.2 archive
1.0.1 Nov 26, 2012 Go to the documentation of benchmark_harness 1.0.1 Download benchmark_harness 1.0.1 archive
1.0.0 Nov 20, 2012 Go to the documentation of benchmark_harness 1.0.0 Download benchmark_harness 1.0.0 archive

Analysis

We analyzed this package on Jul 13, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3

Scores

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

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:benchmark_harness/benchmark_harness.dart.

Suggestions

  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Use constrained dependencies.

    The pubspec.yaml contains 1 dependency without version constraints. Specify version ranges for the following dependencies: browser.

  • Package is too old.

    The package was released more than two years ago.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 3 hints.

    Run dartfmt to format lib/src/benchmark_base.dart.

    Run dartfmt to format lib/src/score_emitter.dart.

  • Maintain an example.

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use benchmark_harness.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
browser any 0.10.0+3
Dev dependencies
unittest any