blob: 881cacd949578841cb8126f732057fd30a854e76 [file] [log] [blame]
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// 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.
/// VM protobuf serialization/deserialization benchmark.
///
/// Finds all files matching dataset*.pb pattern and loads benchmark
/// [Dataset]s from them.
library benchmark_vm;
import 'dart:io';
import 'common.dart';
void main(List<String> arguments) {
final datasetPattern = new RegExp(r'dataset\.[._\w]*\.pb$');
final datasets = new Directory(Platform.script.resolve('..').toFilePath())
.listSync(recursive: true)
.where((file) => datasetPattern.hasMatch(file.path))
.map((file) => new Dataset.fromBinary((file as File).readAsBytesSync()))
.toList(growable: false);
new FromBinaryBenchmark(datasets).report();
new ToBinaryBenchmark(datasets).report();
new ToJsonBenchmark(datasets).report();
new FromJsonBenchmark(datasets).report();
}