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

Unified Diff: third_party/pkg/di/benchmark/injector_benchmark_common.dart

Issue 107003007: Adding Angular's DI package & Dart unittests which test it. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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
Index: third_party/pkg/di/benchmark/injector_benchmark_common.dart
diff --git a/third_party/pkg/di/benchmark/injector_benchmark_common.dart b/third_party/pkg/di/benchmark/injector_benchmark_common.dart
new file mode 100644
index 0000000000000000000000000000000000000000..752833a705242aeb13d552ac68e2be63e9483b88
--- /dev/null
+++ b/third_party/pkg/di/benchmark/injector_benchmark_common.dart
@@ -0,0 +1,47 @@
+library di.injector_benchmark_common;
+
+import 'package:benchmark_harness/benchmark_harness.dart';
+import 'package:di/di.dart';
+
+class InjectorBenchmark extends BenchmarkBase {
+ var injectorFactory;
+ var module;
+
+ InjectorBenchmark(name, this.injectorFactory) : super(name);
+
+ void run() {
+ Injector injector = injectorFactory([module]);
+ injector.get(A);
+ injector.get(B);
+
+ var childInjector = injector.createChild([module]);
+ childInjector.get(A);
+ childInjector.get(B);
+ }
+
+ setup() {
+ module = new Module()
+ ..type(A)
+ ..type(B)
+ ..type(C)
+ ..type(D)
+ ..type(E);
+ }
+}
+
+class A {
+ A(B b, C c);
+}
+
+class B {
+ B(D b, E c);
+}
+
+class C {
+}
+
+class D {
+}
+
+class E {
+}
« no previous file with comments | « third_party/pkg/di/benchmark/dynamic_injector_benchmark.dart ('k') | third_party/pkg/di/benchmark/module_benchmark.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698