Coder Social home page Coder Social logo

benchmark_harness's Introduction

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();
}

benchmark_harness's People

Contributors

adam-singer avatar johnmccutchan avatar sethladd avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.