From d07ed581a9a3d1ba4e3942b0f8257cb6b467cdc5 Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Tue, 9 Jun 2015 15:00:49 -0700 Subject: [PATCH] refactor(benchmark): add view cache param to largetable benchmarks --- modules/benchmarks/e2e_test/largetable_perf.ts | 14 ++++++++++++++ .../src/largetable/largetable_benchmark.html | 10 ++++++++++ .../src/largetable/largetable_benchmark.ts | 5 ++++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/modules/benchmarks/e2e_test/largetable_perf.ts b/modules/benchmarks/e2e_test/largetable_perf.ts index 6f5b54f2ba..8760987cec 100644 --- a/modules/benchmarks/e2e_test/largetable_perf.ts +++ b/modules/benchmarks/e2e_test/largetable_perf.ts @@ -29,6 +29,20 @@ describe('ng2 largetable benchmark', function() { }); }); + it('should log the stats without viewcache', function(done) { + runClickBenchmark({ + url: URL, + buttons: ['#ng2DestroyDom', '#ng2CreateDom'], + id: 'ng2.largetable.interpolation.plain', + params: [ + {name: 'rows', value: 20, scale: 'sqrt'}, + {name: 'columns', value: 20, scale: 'sqrt'}, + {name: 'benchmarkType', value: 'interpolation'}, + {name: 'viewcache', value: 'false'} + ] + }).then(done, done.fail); + }); + it('should log the baseline stats', function(done) { runClickBenchmark({ diff --git a/modules/benchmarks/src/largetable/largetable_benchmark.html b/modules/benchmarks/src/largetable/largetable_benchmark.html index 85718d1228..1c49130c7f 100644 --- a/modules/benchmarks/src/largetable/largetable_benchmark.html +++ b/modules/benchmarks/src/largetable/largetable_benchmark.html @@ -9,6 +9,16 @@
+
+ Use Viewcache: + + +
+
rows: diff --git a/modules/benchmarks/src/largetable/largetable_benchmark.ts b/modules/benchmarks/src/largetable/largetable_benchmark.ts index 6e08671004..e8a8d22173 100644 --- a/modules/benchmarks/src/largetable/largetable_benchmark.ts +++ b/modules/benchmarks/src/largetable/largetable_benchmark.ts @@ -16,6 +16,7 @@ import { import {NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault} from 'angular2/directives'; import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter'; +import {APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/compiler/view_pool'; import {ListWrapper} from 'angular2/src/facade/collection'; @@ -27,11 +28,13 @@ export const LARGETABLE_ROWS = 'LargetableComponent.rows'; export const LARGETABLE_COLS = 'LargetableComponent.cols'; function _createBindings() { + var viewCacheCapacity = getStringParameter('viewcache') == 'true' ? 10000 : 1; return [ bind(BENCHMARK_TYPE) .toValue(getStringParameter('benchmarkType')), bind(LARGETABLE_ROWS).toValue(getIntParameter('rows')), - bind(LARGETABLE_COLS).toValue(getIntParameter('columns')) + bind(LARGETABLE_COLS).toValue(getIntParameter('columns')), + bind(APP_VIEW_POOL_CAPACITY).toValue(viewCacheCapacity) ]; }