commit | 31b939e3e5ce20605fac212c406063e4f8e8ddf5 | [log] [tgz] |
---|---|---|
author | John McCutchan <john@johnmccutchan.com> | Wed Oct 31 13:30:19 2012 -0700 |
committer | John McCutchan <john@johnmccutchan.com> | Tue Nov 20 08:53:02 2012 -0800 |
tree | cd355d3761a2baa9635f2783d7a955bb73c1182a |
Initial commit
==========================
The Dart project benchmark harness is the recommended starting point when building a benchmark for Dart.
BenchmarkBase
class that all new benchmarks should extend
1. Add the following to your project's pubspec.yaml
dependencies: benchmark_harness: git: https://github.com/dart-lang/benchmark_harness.git
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
// 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(); }