Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Unified Diff: code_transformers/lib/benchmarks.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « code_transformers/lib/assets.dart ('k') | code_transformers/lib/messages/build_logger.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: code_transformers/lib/benchmarks.dart
diff --git a/code_transformers/lib/benchmarks.dart b/code_transformers/lib/benchmarks.dart
deleted file mode 100644
index c048457134ca82faa3ba9de81137117f51ccc308..0000000000000000000000000000000000000000
--- a/code_transformers/lib/benchmarks.dart
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2014, 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.
-library code_transformers.benchmarks;
-
-import 'dart:async';
-import 'package:barback/barback.dart';
-import 'src/async_benchmark_base.dart';
-
-/// A benchmark for testing the performance of transformer phases.
-class TransformerBenchmark extends AsyncBenchmarkBase {
- /// Internal abstraction layer for barback.
- _BenchmarkHelper _helper;
-
- /// The transformer phases to be ran.
- final List<List<Transformer>> transformers;
-
- /// The files to pass to barback.
- final Map<AssetId, String> files;
-
- TransformerBenchmark(this.transformers, this.files);
-
- @override
- Future setup() {
- _helper = new _BenchmarkHelper(transformers, files);
- return new Future.value();
- }
-
- @override
- Future run() => _helper.run();
-
- @override
- teardown() {
- _helper = null;
- return new Future.value();
- }
-}
-
-/// Barback abstraction layer.
-class _BenchmarkHelper implements PackageProvider {
- /// All the files available.
- final Map<AssetId, String> _files;
-
- /// All the packages.
- final Iterable<String> packages;
-
- /// Internal instance of barback.
- Barback _barback;
-
- /// Subscription to barback results.
- StreamSubscription<BuildResult> resultSubscription;
-
- _BenchmarkHelper(
- List<List<Transformer>> transformers, Map<AssetId, String> files)
- : _files = files,
- packages = new Set.from(files.keys.map((assetId) => assetId.package)) {
- _barback = new Barback(this);
- for (var package in packages) {
- _barback.updateTransformers(package, transformers);
- }
- }
-
- /// Look up an [AssetId] in [files] and return an [Asset] for it.
- @override
- Future<Asset> getAsset(AssetId id) =>
- new Future.value(new Asset.fromString(id, _files[id]));
-
- /// Tells barback which files have changed, and thus anything that depends on
- /// it on should be computed. Returns a [Future] that completes once some
- /// results are received.
- Future run([Iterable<AssetId> assetIds]) {
- if (assetIds == null) assetIds = _files.keys;
- _barback.updateSources(assetIds);
- return _barback.results.first;
- }
-}
« no previous file with comments | « code_transformers/lib/assets.dart ('k') | code_transformers/lib/messages/build_logger.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698