commit | 2b41c6675ca628a2d0852db327fccad9e27cb9ad | [log] [tgz] |
---|---|---|
author | John McCutchan <john@johnmccutchan.com> | Wed Dec 19 08:36:43 2012 -0800 |
committer | John McCutchan <john@johnmccutchan.com> | Wed Dec 19 08:36:43 2012 -0800 |
tree | dd8afda9cde329c76046f02e3e34274230537fc2 | |
parent | 527730dbadbbee99561bbcab885e197575ee09fb [diff] |
Have BenchmarkBase report runs, total and average run times.
==========================
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(); }