build(dart): Remove unused Dart benchmarks
This commit is contained in:
parent
b6210be648
commit
a4869c874b
|
@ -1,27 +0,0 @@
|
|||
library angular2.test.benchmark.transform;
|
||||
|
||||
import 'package:angular2/src/transform/common/formatter.dart' as formatter;
|
||||
import 'package:dart_style/dart_style.dart';
|
||||
import 'package:guinness/guinness.dart';
|
||||
import 'package:unittest/vm_config.dart';
|
||||
|
||||
import 'bind_generator/simple.dart' as bindGenerator;
|
||||
import 'directive_linker/simple.dart' as directiveLinker;
|
||||
import 'directive_processor/simple.dart' as directiveProcessor;
|
||||
import 'integration/hello_world.dart' as helloWorld;
|
||||
import 'reflection_remover/simple.dart' as reflectionRemover;
|
||||
import 'template_compiler/inline.dart' as inlineTemplateCompiler;
|
||||
import 'template_compiler/url.dart' as urlTemplateCompiler;
|
||||
|
||||
main() {
|
||||
useVMConfiguration();
|
||||
formatter.init(new DartFormatter());
|
||||
describe('Bind Generator Benchmark', bindGenerator.allTests);
|
||||
describe('Directive Linker Benchmark', directiveLinker.allTests);
|
||||
describe('Directive Processor Benchmark', directiveProcessor.allTests);
|
||||
describe('Hello World Transformer Benchmark', helloWorld.allTests);
|
||||
describe('Reflection Remover Benchmark', reflectionRemover.allTests);
|
||||
describe(
|
||||
'Inline Template Compiler Benchmark', inlineTemplateCompiler.allTests);
|
||||
describe('Url Template Compiler Benchmark', urlTemplateCompiler.allTests);
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
library angular2.benchmark.transform.bind_generator.simple;
|
||||
|
||||
import 'dart:async';
|
||||
import 'package:angular2/src/transform/common/options.dart';
|
||||
import 'package:angular2/src/transform/bind_generator/transformer.dart';
|
||||
import 'package:barback/barback.dart';
|
||||
import 'package:code_transformers/benchmarks.dart';
|
||||
import 'package:unittest/unittest.dart';
|
||||
|
||||
Future main() => runBenchmark();
|
||||
|
||||
allTests() {
|
||||
test('Bind Generator Benchmark Runs', runBenchmark);
|
||||
}
|
||||
|
||||
Future<double> runBenchmark() async {
|
||||
var options = new TransformerOptions(['this_is_ignored.dart']);
|
||||
var files = {new AssetId('a', 'a.ng_deps.dart'): aContents};
|
||||
return new TransformerBenchmark([
|
||||
[new BindGenerator(options)]
|
||||
], files).measure();
|
||||
}
|
||||
|
||||
const aContents = '''
|
||||
library bar.ng_deps.dart;
|
||||
|
||||
import 'bar.dart';
|
||||
import 'package:angular2/src/core/metadata.dart';
|
||||
|
||||
bool _visited = false;
|
||||
void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(ToolTip, new ReflectionInfo(
|
||||
const [
|
||||
const Decorator(
|
||||
selector: '[tool-tip]', bind: const {'text': 'tool-tip'})
|
||||
],
|
||||
const [],
|
||||
() => new ToolTip()
|
||||
));
|
||||
}''';
|
|
@ -1,79 +0,0 @@
|
|||
library angular2.benchmark.transform.directive_linker.simple;
|
||||
|
||||
import 'dart:async';
|
||||
import 'package:angular2/src/transform/common/options.dart';
|
||||
import 'package:angular2/src/transform/directive_linker/transformer.dart';
|
||||
import 'package:barback/barback.dart';
|
||||
import 'package:code_transformers/benchmarks.dart';
|
||||
import 'package:unittest/unittest.dart';
|
||||
|
||||
Future main() => runBenchmark();
|
||||
|
||||
allTests() {
|
||||
test('Directive Linker Benchmark Runs', runBenchmark);
|
||||
}
|
||||
|
||||
Future<double> runBenchmark() async {
|
||||
var files = {
|
||||
new AssetId('a', 'a.ng_deps.dart'): aContents,
|
||||
new AssetId('a', 'b.ng_deps.dart'): bContents,
|
||||
new AssetId('a', 'c.ng_deps.dart'): cContents,
|
||||
};
|
||||
return new TransformerBenchmark([
|
||||
[new DirectiveLinker()]
|
||||
], files).measure();
|
||||
}
|
||||
|
||||
const aContents = '''
|
||||
library a.ng_deps.dart;
|
||||
|
||||
import 'package:angular2/src/core/application.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
import 'b.dart';
|
||||
|
||||
bool _visited = false;
|
||||
void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
}''';
|
||||
|
||||
const bContents = '''
|
||||
library b.ng_deps.dart;
|
||||
|
||||
import 'b.dart';
|
||||
import 'package:angular2/src/core/metadata.dart';
|
||||
|
||||
bool _visited = false;
|
||||
void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(DependencyComponent, new ReflectionInfo(
|
||||
const [const Component(selector: '[salad]')],
|
||||
const [],
|
||||
() => new DependencyComponent()
|
||||
));
|
||||
}
|
||||
''';
|
||||
|
||||
const cContents = '''
|
||||
library c.ng_deps.dart;
|
||||
|
||||
import 'c.dart';
|
||||
import 'package:angular2/src/core/metadata.dart';
|
||||
import 'b.dart' as dep;
|
||||
|
||||
bool _visited = false;
|
||||
void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(MyComponent, new ReflectionInfo(
|
||||
const [
|
||||
const Component(
|
||||
selector: '[soup]', services: const [dep.DependencyComponent])
|
||||
],
|
||||
const [],
|
||||
() => new MyComponent()
|
||||
));
|
||||
}''';
|
|
@ -1,33 +0,0 @@
|
|||
library angular2.benchmark.transform.directive_processor.simple;
|
||||
|
||||
import 'dart:async';
|
||||
import 'package:angular2/src/transform/common/options.dart';
|
||||
import 'package:angular2/src/transform/directive_processor/transformer.dart';
|
||||
import 'package:barback/barback.dart';
|
||||
import 'package:code_transformers/benchmarks.dart';
|
||||
import 'package:unittest/unittest.dart';
|
||||
|
||||
Future main() => runBenchmark();
|
||||
|
||||
allTests() {
|
||||
test('Directive Processor Benchmark Runs', runBenchmark);
|
||||
}
|
||||
|
||||
Future runBenchmark() async {
|
||||
var options = new TransformerOptions(['this_is_ignored.dart']);
|
||||
var files = {new AssetId('a', 'a.dart'): aContents,};
|
||||
return new TransformerBenchmark([
|
||||
[new DirectiveProcessor(options)]
|
||||
], files).measure();
|
||||
}
|
||||
|
||||
const aContents = '''
|
||||
library dinner.soup;
|
||||
|
||||
import 'package:angular2/src/core/metadata.dart';
|
||||
|
||||
@Component(selector: '[soup]')
|
||||
class SoupComponent {
|
||||
SoupComponent(@Tasty String description, @Inject(Salt) salt);
|
||||
}
|
||||
''';
|
|
@ -1,81 +0,0 @@
|
|||
library angular2.benchmark.transform.integration.hello_world;
|
||||
|
||||
import 'dart:async';
|
||||
import 'package:angular2/src/transform/common/options.dart';
|
||||
import 'package:angular2/src/transform/transformer.dart';
|
||||
import 'package:barback/barback.dart';
|
||||
import 'package:code_transformers/benchmarks.dart';
|
||||
import 'package:unittest/unittest.dart';
|
||||
|
||||
Future main() => runBenchmark();
|
||||
|
||||
allTests() {
|
||||
test('Hello World Benchmark Runs', runBenchmark);
|
||||
}
|
||||
|
||||
Future runBenchmark() async {
|
||||
var options = new TransformerOptions(['index.dart']);
|
||||
var files = {
|
||||
new AssetId('a', 'web/index.dart'): indexContents,
|
||||
new AssetId('a', 'web/index_common.dart'): indexCommonContents,
|
||||
};
|
||||
return new TransformerBenchmark(
|
||||
new AngularTransformerGroup(options).phases, files).measure();
|
||||
}
|
||||
|
||||
const indexContents = '''
|
||||
library examples.src.hello_world.index;
|
||||
|
||||
import "index_common.dart" as app;
|
||||
import "package:angular2/src/core/reflection/reflection.dart" show reflector;
|
||||
import "package:angular2/src/core/reflection/reflection_capabilities.dart"
|
||||
show ReflectionCapabilities;
|
||||
|
||||
main() {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
app.main();
|
||||
}
|
||||
''';
|
||||
|
||||
const indexCommonContents = '''
|
||||
library examples.src.hello_world.index_common;
|
||||
|
||||
import "package:angular2/bootstrap.dart"
|
||||
show bootstrap, Component, Directive, View, ElementRef;
|
||||
import "package:angular2/core.dart" show Injectable;
|
||||
|
||||
@Component(selector: "hello-app", services: const [GreetingService])
|
||||
@View(
|
||||
template: '<div class="greeting">{{greeting}} <span red>world</span>!</div>'
|
||||
'<button class="changeButton" (click)="changeGreeting()">'
|
||||
'change greeting</button><ng-content></ng-content>',
|
||||
directives: const [RedDec])
|
||||
class HelloCmp {
|
||||
String greeting;
|
||||
HelloCmp(GreetingService service) {
|
||||
this.greeting = service.greeting;
|
||||
}
|
||||
changeGreeting() {
|
||||
this.greeting = "howdy";
|
||||
}
|
||||
}
|
||||
|
||||
@Directive(selector: "[red]")
|
||||
class RedDec {
|
||||
RedDec(ElementRef el) {
|
||||
el.nativeElement.style.color = "red";
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
class GreetingService {
|
||||
String greeting;
|
||||
GreetingService() {
|
||||
this.greeting = "hello";
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
bootstrap(HelloCmp);
|
||||
}
|
||||
''';
|
|
@ -1,34 +0,0 @@
|
|||
library angular2.benchmark.transform.reflection_remover.simple;
|
||||
|
||||
import 'dart:async';
|
||||
import 'package:angular2/src/transform/common/options.dart';
|
||||
import 'package:angular2/src/transform/reflection_remover/transformer.dart';
|
||||
import 'package:barback/barback.dart';
|
||||
import 'package:code_transformers/benchmarks.dart';
|
||||
import 'package:unittest/unittest.dart';
|
||||
|
||||
Future main() => runBenchmark();
|
||||
|
||||
allTests() {
|
||||
test('Reflection Remover Benchmark Runs', runBenchmark);
|
||||
}
|
||||
|
||||
Future runBenchmark() async {
|
||||
var options = new TransformerOptions(['web/index.dart']);
|
||||
var files = {new AssetId('a', 'web/index.dart'): indexContents,};
|
||||
return new TransformerBenchmark([
|
||||
[new ReflectionRemover(options)]
|
||||
], files).measure();
|
||||
}
|
||||
|
||||
const indexContents = '''
|
||||
library web_foo;
|
||||
|
||||
import 'package:angular2/bootstrap.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection.dart';
|
||||
import 'package:angular2/src/core/reflection/reflection_capabilities.dart';
|
||||
|
||||
void main() {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
bootstrap(MyComponent);
|
||||
}''';
|
|
@ -1,27 +0,0 @@
|
|||
library angular2.test.benchmark.transform.run_all;
|
||||
|
||||
import 'package:angular2/src/transform/common/formatter.dart' as formatter;
|
||||
import 'package:dart_style/dart_style.dart';
|
||||
|
||||
import 'bind_generator/simple.dart' as bindGenerator;
|
||||
import 'directive_linker/simple.dart' as directiveLinker;
|
||||
import 'directive_processor/simple.dart' as directiveProcessor;
|
||||
import 'integration/hello_world.dart' as helloWorld;
|
||||
import 'reflection_remover/simple.dart' as reflectionRemover;
|
||||
import 'template_compiler/inline.dart' as inlineTemplateCompiler;
|
||||
import 'template_compiler/url.dart' as urlTemplateCompiler;
|
||||
|
||||
main() async {
|
||||
formatter.init(new DartFormatter());
|
||||
printResult('BindGenerator', await bindGenerator.runBenchmark());
|
||||
printResult('DirectiveLinker', await directiveLinker.runBenchmark());
|
||||
printResult('HelloWorld', await helloWorld.runBenchmark());
|
||||
printResult('ReflectionRemover', await reflectionRemover.runBenchmark());
|
||||
printResult(
|
||||
'InlineTemplateCompiler', await inlineTemplateCompiler.runBenchmark());
|
||||
printResult('UrlTemplateCompiler', await urlTemplateCompiler.runBenchmark());
|
||||
}
|
||||
|
||||
void printResult(String name, double result) {
|
||||
print('ng2.transform.$name(RunTime): $result us.');
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
library angular2.benchmark.transform.template_compiler.inline;
|
||||
|
||||
import 'dart:async';
|
||||
import 'package:angular2/src/transform/common/options.dart';
|
||||
import 'package:angular2/src/transform/template_compiler/transformer.dart';
|
||||
import 'package:barback/barback.dart';
|
||||
import 'package:code_transformers/benchmarks.dart';
|
||||
import 'package:unittest/unittest.dart';
|
||||
|
||||
Future main() => runBenchmark();
|
||||
|
||||
allTests() {
|
||||
test('Inline Template Compiler Benchmark Runs', runBenchmark);
|
||||
}
|
||||
|
||||
Future runBenchmark() async {
|
||||
var options = new TransformerOptions(['index.dart']);
|
||||
var files = {new AssetId('a', 'web/a.ng_deps.dart'): aContents,};
|
||||
return new TransformerBenchmark([
|
||||
[new TemplateCompiler(options)]
|
||||
], files).measure();
|
||||
}
|
||||
|
||||
const aContents = '''
|
||||
library examples.src.hello_world.index_common_dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Decorator, Template, NgElement;
|
||||
|
||||
bool _visited = false;
|
||||
void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(
|
||||
const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const Template(
|
||||
inline: '<button (click)="action()">go</button>{{greeting}}')
|
||||
],
|
||||
const [const []],
|
||||
() => new HelloCmp()
|
||||
));
|
||||
}
|
||||
''';
|
|
@ -1,53 +0,0 @@
|
|||
library angular2.benchmark.transform.template_compiler.url;
|
||||
|
||||
import 'dart:async';
|
||||
import 'package:angular2/src/transform/common/options.dart';
|
||||
import 'package:angular2/src/transform/template_compiler/transformer.dart';
|
||||
import 'package:barback/barback.dart';
|
||||
import 'package:code_transformers/benchmarks.dart';
|
||||
import 'package:unittest/unittest.dart';
|
||||
|
||||
Future main() => runBenchmark();
|
||||
|
||||
allTests() {
|
||||
test('Url Template Compiler Benchmark Runs', runBenchmark);
|
||||
}
|
||||
|
||||
Future runBenchmark() async {
|
||||
var options = new TransformerOptions(['index.dart']);
|
||||
var files = {
|
||||
new AssetId('a', 'web/a.ng_deps.dart'): aContents,
|
||||
new AssetId('a', 'web/template.html'): templateContents,
|
||||
};
|
||||
return new TransformerBenchmark([
|
||||
[new TemplateCompiler(options)]
|
||||
], files).measure();
|
||||
}
|
||||
|
||||
const aContents = '''
|
||||
library examples.src.hello_world.index_common_dart;
|
||||
|
||||
import 'hello.dart';
|
||||
import 'package:angular2/angular2.dart'
|
||||
show bootstrap, Component, Decorator, Template, NgElement;
|
||||
|
||||
bool _visited = false;
|
||||
void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(
|
||||
const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const Template(url: 'template.html')
|
||||
],
|
||||
const [const []],
|
||||
() => new HelloCmp()
|
||||
));
|
||||
}
|
||||
''';
|
||||
|
||||
const templateContents = '''
|
||||
<button (click)="action()">go</button>
|
||||
{{greeting}}
|
||||
''';
|
Loading…
Reference in New Issue