diff --git a/modules/benchmarks/src/largetable/BUILD.bazel b/modules/benchmarks/src/largetable/BUILD.bazel index 0a662ad406..02986f6b9f 100644 --- a/modules/benchmarks/src/largetable/BUILD.bazel +++ b/modules/benchmarks/src/largetable/BUILD.bazel @@ -4,14 +4,8 @@ load("//tools:defaults.bzl", "ts_library") ts_library( name = "util_lib", - srcs = [ - "util.ts", - ], - deps = [ - "//modules/benchmarks/src:util_lib", - "//packages:types", - "//packages/core", - ], + srcs = ["util.ts"], + deps = ["//modules/benchmarks/src:util_lib"], ) ts_library( diff --git a/modules/benchmarks/src/largetable/baseline/BUILD.bazel b/modules/benchmarks/src/largetable/baseline/BUILD.bazel new file mode 100644 index 0000000000..960c5a8eb7 --- /dev/null +++ b/modules/benchmarks/src/largetable/baseline/BUILD.bazel @@ -0,0 +1,22 @@ +load("//tools:defaults.bzl", "ts_library") +load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver") + +package(default_visibility = ["//modules/benchmarks:__subpackages__"]) + +ts_library( + name = "baseline", + srcs = glob(["*.ts"]), + tsconfig = "//modules/benchmarks:tsconfig-build.json", + deps = [ + "//modules/benchmarks/src:util_lib", + "//modules/benchmarks/src/largetable:util_lib", + ], +) + +ts_devserver( + name = "devserver", + entry_module = "angular/modules/benchmarks/src/largetable/baseline/index", + index_html = "index.html", + port = 4200, + deps = [":baseline"], +) diff --git a/modules/benchmarks/src/largetable/baseline/index.html b/modules/benchmarks/src/largetable/baseline/index.html index 6c922ffe49..0095fb92ec 100644 --- a/modules/benchmarks/src/largetable/baseline/index.html +++ b/modules/benchmarks/src/largetable/baseline/index.html @@ -1,5 +1,9 @@ + + + +

Params

@@ -24,11 +28,5 @@
Loading...
- - - \ No newline at end of file + diff --git a/modules/benchmarks/src/largetable/incremental_dom/BUILD.bazel b/modules/benchmarks/src/largetable/incremental_dom/BUILD.bazel new file mode 100644 index 0000000000..5fbafea849 --- /dev/null +++ b/modules/benchmarks/src/largetable/incremental_dom/BUILD.bazel @@ -0,0 +1,25 @@ +load("//tools:defaults.bzl", "ts_library") +load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver") + +package(default_visibility = ["//modules/benchmarks:__subpackages__"]) + +ts_library( + name = "incremental_dom", + srcs = glob(["*.ts"]), + tsconfig = "//modules/benchmarks:tsconfig-build.json", + deps = [ + "//modules/benchmarks/src:util_lib", + "//modules/benchmarks/src/largetable:util_lib", + ], +) + +ts_devserver( + name = "devserver", + entry_module = "angular/modules/benchmarks/src/largetable/incremental_dom/index", + index_html = "index.html", + port = 4200, + static_files = [ + "@ngdeps//node_modules/incremental-dom:dist/incremental-dom.js", + ], + deps = [":incremental_dom"], +) diff --git a/modules/benchmarks/src/largetable/incremental_dom/index.html b/modules/benchmarks/src/largetable/incremental_dom/index.html index 9688ff7156..b2a38bcca1 100644 --- a/modules/benchmarks/src/largetable/incremental_dom/index.html +++ b/modules/benchmarks/src/largetable/incremental_dom/index.html @@ -1,5 +1,9 @@ + + + +

Params

@@ -24,7 +28,5 @@
- - - \ No newline at end of file + diff --git a/modules/benchmarks/src/largetable/incremental_dom/index.ts b/modules/benchmarks/src/largetable/incremental_dom/index.ts index 62f48e1a83..1b32df57c1 100644 --- a/modules/benchmarks/src/largetable/incremental_dom/index.ts +++ b/modules/benchmarks/src/largetable/incremental_dom/index.ts @@ -10,24 +10,26 @@ import {bindAction, profile} from '../../util'; import {buildTable, emptyTable} from '../util'; import {TableComponent} from './table'; -export function main() { - let table: TableComponent; +let table: TableComponent; - function destroyDom() { table.data = emptyTable; } - - function createDom() { table.data = buildTable(); } - - function noop() {} - - function init() { - table = new TableComponent(document.querySelector('largetable')); - - bindAction('#destroyDom', destroyDom); - bindAction('#createDom', createDom); - - bindAction('#updateDomProfile', profile(createDom, noop, 'update')); - bindAction('#createDomProfile', profile(createDom, destroyDom, 'create')); - } - - init(); +function destroyDom() { + table.data = emptyTable; } + +function createDom() { + table.data = buildTable(); +} + +function noop() {} + +function init() { + table = new TableComponent(document.querySelector('largetable')); + + bindAction('#destroyDom', destroyDom); + bindAction('#createDom', createDom); + + bindAction('#updateDomProfile', profile(createDom, noop, 'update')); + bindAction('#createDomProfile', profile(createDom, destroyDom, 'create')); +} + +init(); diff --git a/modules/benchmarks/src/largetable/incremental_dom/table.ts b/modules/benchmarks/src/largetable/incremental_dom/table.ts index 6abf149534..7d50f8ff27 100644 --- a/modules/benchmarks/src/largetable/incremental_dom/table.ts +++ b/modules/benchmarks/src/largetable/incremental_dom/table.ts @@ -7,8 +7,12 @@ */ import {TableCell} from '../util'; + +// We load "IncrementalDOM" as a AMD global because the "incremental-dom" NPM package does not +// come with a named UMD module, and it's easier to just import the AMD file and use it globally. +declare const IncrementalDOM: any; const {patch, elementOpen, elementClose, elementOpenStart, elementOpenEnd, attr, text} = - require('incremental-dom'); + IncrementalDOM; export class TableComponent { constructor(private _rootEl: any) {} diff --git a/modules/benchmarks/src/largetable/iv/BUILD.bazel b/modules/benchmarks/src/largetable/iv/BUILD.bazel new file mode 100644 index 0000000000..0391a8d064 --- /dev/null +++ b/modules/benchmarks/src/largetable/iv/BUILD.bazel @@ -0,0 +1,11 @@ +load("//tools:defaults.bzl", "ts_library") +load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver") + +package(default_visibility = ["//modules/benchmarks:__subpackages__"]) + +ts_devserver( + name = "devserver", + index_html = "index.html", + port = 4200, + static_files = ["largetable.js"], +) diff --git a/modules/benchmarks/src/largetable/iv/index.html b/modules/benchmarks/src/largetable/iv/index.html index e4423c8493..77b2962159 100644 --- a/modules/benchmarks/src/largetable/iv/index.html +++ b/modules/benchmarks/src/largetable/iv/index.html @@ -1,5 +1,9 @@ + + + +

Params

@@ -24,8 +28,5 @@
- - - diff --git a/modules/benchmarks/src/largetable/ng2/BUILD.bazel b/modules/benchmarks/src/largetable/ng2/BUILD.bazel new file mode 100644 index 0000000000..fced7aaa01 --- /dev/null +++ b/modules/benchmarks/src/largetable/ng2/BUILD.bazel @@ -0,0 +1,35 @@ +load("//tools:defaults.bzl", "ng_module") +load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver") + +package(default_visibility = ["//modules/benchmarks:__subpackages__"]) + +# Note that this benchmark has been designed for Angular with ViewEngine, but once +# ViewEngine is removed, we should should consider removing this one since there +# already is a "render3" benchmark. +ng_module( + name = "ng2", + srcs = glob(["*.ts"]), + tsconfig = "//modules/benchmarks:tsconfig-build.json", + # TODO: FW-1004 Type checking is currently not complete. + type_check = False, + deps = [ + "//modules/benchmarks/src:util_lib", + "//modules/benchmarks/src/largetable:util_lib", + "//packages/core", + "//packages/platform-browser", + "//packages/platform-browser-dynamic", + ], +) + +ts_devserver( + name = "devserver", + entry_module = "angular/modules/benchmarks/src/largetable/ng2/index", + index_html = "index.html", + port = 4200, + scripts = ["@ngdeps//node_modules/tslib:tslib.js"], + static_files = [ + "@ngdeps//node_modules/zone.js:dist/zone.js", + "@ngdeps//node_modules/reflect-metadata:Reflect.js", + ], + deps = [":ng2"], +) diff --git a/modules/benchmarks/src/largetable/ng2/index.html b/modules/benchmarks/src/largetable/ng2/index.html index 3842f86625..f854962b57 100644 --- a/modules/benchmarks/src/largetable/ng2/index.html +++ b/modules/benchmarks/src/largetable/ng2/index.html @@ -1,5 +1,9 @@ + + + +

Params

@@ -24,11 +28,5 @@
Loading...
- - diff --git a/modules/benchmarks/src/largetable/ng2/index.ts b/modules/benchmarks/src/largetable/ng2/index.ts index c7d73eb3f2..b0a0bfec83 100644 --- a/modules/benchmarks/src/largetable/ng2/index.ts +++ b/modules/benchmarks/src/largetable/ng2/index.ts @@ -12,7 +12,5 @@ import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {init} from './init'; import {AppModule} from './table'; -export function main() { - enableProdMode(); - platformBrowserDynamic().bootstrapModule(AppModule).then(init); -} +enableProdMode(); +platformBrowserDynamic().bootstrapModule(AppModule).then(init); diff --git a/modules/benchmarks/src/largetable/ng2_switch/BUILD.bazel b/modules/benchmarks/src/largetable/ng2_switch/BUILD.bazel new file mode 100644 index 0000000000..c1e5ccace5 --- /dev/null +++ b/modules/benchmarks/src/largetable/ng2_switch/BUILD.bazel @@ -0,0 +1,32 @@ +load("//tools:defaults.bzl", "ng_module") +load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver") + +package(default_visibility = ["//modules/benchmarks:__subpackages__"]) + +ng_module( + name = "ng2_switch", + srcs = glob(["*.ts"]), + tsconfig = "//modules/benchmarks:tsconfig-build.json", + # TODO: FW-1004 Type checking is currently not complete. + type_check = False, + deps = [ + "//modules/benchmarks/src:util_lib", + "//modules/benchmarks/src/largetable:util_lib", + "//packages/core", + "//packages/platform-browser", + "//packages/platform-browser-dynamic", + ], +) + +ts_devserver( + name = "devserver", + entry_module = "angular/modules/benchmarks/src/largetable/ng2_switch/index", + index_html = "index.html", + port = 4200, + scripts = ["@ngdeps//node_modules/tslib:tslib.js"], + static_files = [ + "@ngdeps//node_modules/zone.js:dist/zone.js", + "@ngdeps//node_modules/reflect-metadata:Reflect.js", + ], + deps = [":ng2_switch"], +) diff --git a/modules/benchmarks/src/largetable/ng2_switch/index.html b/modules/benchmarks/src/largetable/ng2_switch/index.html index 9cd629ebc2..5db094975b 100644 --- a/modules/benchmarks/src/largetable/ng2_switch/index.html +++ b/modules/benchmarks/src/largetable/ng2_switch/index.html @@ -1,5 +1,9 @@ + + + +

Params

@@ -24,11 +28,5 @@
Loading...
- - diff --git a/modules/benchmarks/src/largetable/ng2_switch/index.ts b/modules/benchmarks/src/largetable/ng2_switch/index.ts index c7d73eb3f2..b0a0bfec83 100644 --- a/modules/benchmarks/src/largetable/ng2_switch/index.ts +++ b/modules/benchmarks/src/largetable/ng2_switch/index.ts @@ -12,7 +12,5 @@ import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {init} from './init'; import {AppModule} from './table'; -export function main() { - enableProdMode(); - platformBrowserDynamic().bootstrapModule(AppModule).then(init); -} +enableProdMode(); +platformBrowserDynamic().bootstrapModule(AppModule).then(init); diff --git a/modules/benchmarks/src/largetable/render3/BUILD.bazel b/modules/benchmarks/src/largetable/render3/BUILD.bazel index df6a24d3a5..ba2aff5a3c 100644 --- a/modules/benchmarks/src/largetable/render3/BUILD.bazel +++ b/modules/benchmarks/src/largetable/render3/BUILD.bazel @@ -32,20 +32,12 @@ ng_rollup_bundle( ], ) -genrule( - name = "favicon", - srcs = ["//modules/benchmarks:favicon"], - outs = ["favicon.ico"], - cmd = "cp $< $@", -) - ts_devserver( name = "devserver", static_files = [ ":bundle.min_debug.js", ":bundle.min.js", "index.html", - ":favicon", ], tags = ["ivy-only"], ) diff --git a/modules/benchmarks/src/largetable/render3/index.html b/modules/benchmarks/src/largetable/render3/index.html index 87de79a691..41684174e7 100644 --- a/modules/benchmarks/src/largetable/render3/index.html +++ b/modules/benchmarks/src/largetable/render3/index.html @@ -1,6 +1,9 @@ - + + + +

Params