refactor(benchmarks): add `index_aot` to support AoT bootstrap. (#12105)
Note: This only make sure it can compile the AoT version, but does not yet use it in e2e tests.
This commit is contained in:
parent
ef621a2f00
commit
f1cfddf6d6
|
@ -0,0 +1,6 @@
|
|||
# Overview
|
||||
|
||||
This folder will be filled with the benchmark sources
|
||||
so that we can do offline compilation for them.
|
||||
|
||||
|
|
@ -15,5 +15,15 @@
|
|||
"declaration": true,
|
||||
"lib": ["es6", "dom"],
|
||||
"baseUrl": "."
|
||||
}
|
||||
},
|
||||
|
||||
"files": [
|
||||
"src/module",
|
||||
"src/bootstrap",
|
||||
"test/all_spec",
|
||||
"benchmarks/src/tree/ng2/index_aot.ts",
|
||||
"benchmarks/src/tree/ng2_switch/index_aot.ts",
|
||||
"benchmarks/src/largetable/ng2/index_aot.ts",
|
||||
"benchmarks/src/largetable/ng2_switch/index_aot.ts"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -22,3 +22,8 @@ $ ./node_modules/.bin/protractor protractor-perf.conf.js --specs=dist/all/benchm
|
|||
Options for protractor with `protractor-perf.conf.js`:
|
||||
- `--bundles=true`: use prebuilt bundles
|
||||
- `--ng-help`: show all available options
|
||||
|
||||
## Compile *_aot.ts files
|
||||
|
||||
These files are compiled as part of the compiler_cli integration tests.
|
||||
See `@angular/compile_cli/integrationtest/tsconfig.json`
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
import {enableProdMode} from '@angular/core';
|
||||
import {platformBrowser} from '@angular/platform-browser';
|
||||
|
||||
import {init} from './init';
|
||||
import {AppModuleNgFactory} from './table.ngfactory';
|
||||
|
||||
enableProdMode();
|
||||
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory).then(init);
|
|
@ -0,0 +1,8 @@
|
|||
import {enableProdMode} from '@angular/core';
|
||||
import {platformBrowser} from '@angular/platform-browser';
|
||||
|
||||
import {init} from './init';
|
||||
import {AppModuleNgFactory} from './table.ngfactory';
|
||||
|
||||
enableProdMode();
|
||||
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory).then(init);
|
|
@ -0,0 +1,8 @@
|
|||
import {enableProdMode} from '@angular/core';
|
||||
import {platformBrowser} from '@angular/platform-browser';
|
||||
|
||||
import {init} from './init';
|
||||
import {AppModuleNgFactory} from './tree.ngfactory';
|
||||
|
||||
enableProdMode();
|
||||
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory).then(init);
|
|
@ -1,40 +1,10 @@
|
|||
import {ApplicationRef, enableProdMode} from '@angular/core';
|
||||
import {enableProdMode} from '@angular/core';
|
||||
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||
|
||||
import {bindAction, profile} from '../../util';
|
||||
import {buildTree, emptyTree} from '../util';
|
||||
|
||||
import {AppModule, TreeComponent} from './tree';
|
||||
import {init} from './init';
|
||||
import {AppModule} from './tree';
|
||||
|
||||
export function main() {
|
||||
var tree: TreeComponent;
|
||||
var appRef: ApplicationRef;
|
||||
|
||||
function destroyDom() {
|
||||
tree.data = emptyTree;
|
||||
appRef.tick();
|
||||
}
|
||||
|
||||
function createDom() {
|
||||
tree.data = buildTree();
|
||||
appRef.tick();
|
||||
}
|
||||
|
||||
function noop() {}
|
||||
|
||||
function init() {
|
||||
enableProdMode();
|
||||
platformBrowserDynamic().bootstrapModule(AppModule).then((ref) => {
|
||||
const injector = ref.injector;
|
||||
appRef = injector.get(ApplicationRef);
|
||||
|
||||
tree = appRef.components[0].instance;
|
||||
bindAction('#destroyDom', destroyDom);
|
||||
bindAction('#createDom', createDom);
|
||||
bindAction('#updateDomProfile', profile(createDom, noop, 'update'));
|
||||
bindAction('#createDomProfile', profile(createDom, destroyDom, 'create'));
|
||||
});
|
||||
}
|
||||
|
||||
init();
|
||||
enableProdMode();
|
||||
platformBrowserDynamic().bootstrapModule(AppModule).then(init);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
import {enableProdMode} from '@angular/core';
|
||||
import {platformBrowser} from '@angular/platform-browser';
|
||||
|
||||
import {init} from './init';
|
||||
import {AppModuleNgFactory} from './tree.ngfactory';
|
||||
|
||||
enableProdMode();
|
||||
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory).then(init);
|
|
@ -0,0 +1,32 @@
|
|||
import {ApplicationRef, NgModuleRef} from '@angular/core';
|
||||
|
||||
import {bindAction, profile} from '../../util';
|
||||
import {buildTree, emptyTree} from '../util';
|
||||
|
||||
import {AppModule, TreeComponent} from './tree';
|
||||
|
||||
export function init(moduleRef: NgModuleRef<AppModule>) {
|
||||
var tree: TreeComponent;
|
||||
var appRef: ApplicationRef;
|
||||
|
||||
function destroyDom() {
|
||||
tree.data = emptyTree;
|
||||
appRef.tick();
|
||||
}
|
||||
|
||||
function createDom() {
|
||||
tree.data = buildTree();
|
||||
appRef.tick();
|
||||
}
|
||||
|
||||
function noop() {}
|
||||
|
||||
const injector = moduleRef.injector;
|
||||
appRef = injector.get(ApplicationRef);
|
||||
|
||||
tree = appRef.components[0].instance;
|
||||
bindAction('#destroyDom', destroyDom);
|
||||
bindAction('#createDom', createDom);
|
||||
bindAction('#updateDomProfile', profile(createDom, noop, 'update'));
|
||||
bindAction('#createDomProfile', profile(createDom, destroyDom, 'create'));
|
||||
}
|
|
@ -27,6 +27,7 @@
|
|||
"angular2",
|
||||
"benchmarks/e2e_test/old",
|
||||
"benchmarks/src/old",
|
||||
"benchmarks/src/**/index_aot.ts",
|
||||
"benchmarks_external",
|
||||
"payload_tests",
|
||||
"rollup-test",
|
||||
|
|
|
@ -21,6 +21,7 @@ TMPDIR=${TMPDIR:-.}
|
|||
readonly TMP=$TMPDIR/e2e_test.$(date +%s)
|
||||
mkdir -p $TMP
|
||||
cp -R -v modules/@angular/compiler-cli/integrationtest/* $TMP
|
||||
cp -R -v modules/benchmarks $TMP
|
||||
# Try to use the same versions as angular, in particular, this will
|
||||
# cause us to install the same rxjs version.
|
||||
cp -v package.json $TMP
|
||||
|
|
Loading…
Reference in New Issue