Skip to content

Commit

Permalink
Fix benchmarking. (#760)
Browse files Browse the repository at this point in the history
  • Loading branch information
pq authored Jul 28, 2017
1 parent 9652dd4 commit 6f45c2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/linter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Future runLinter(List<String> args, LinterOptions initialLintOptions) async {
}

if (benchmark) {
writeBenchmarks(outSink, filesToLint, lintOptions);
await writeBenchmarks(outSink, filesToLint, lintOptions);
return;
}

Expand Down
6 changes: 4 additions & 2 deletions lib/src/formatter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';
import 'dart:io';
import 'dart:math';

Expand Down Expand Up @@ -266,10 +267,11 @@ class SimpleFormatter implements ReportFormatter {
}
}

writeBenchmarks(IOSink out, List<File> filesToLint, LinterOptions lintOptions) {
Future writeBenchmarks(
IOSink out, List<File> filesToLint, LinterOptions lintOptions) async {
Map<String, int> timings = <String, int>{};
for (int i = 0; i < benchmarkRuns; ++i) {
new DartLinter(lintOptions).lintFiles(filesToLint);
await new DartLinter(lintOptions).lintFiles(filesToLint);
lintRegistry.timers.forEach((n, t) {
int timing = t.elapsedMilliseconds;
int previous = timings[n];
Expand Down

0 comments on commit 6f45c2f

Please sign in to comment.