refactor(benchmark): add view cache param to largetable benchmarks

This commit is contained in:
Tobias Bosch 2015-06-09 15:00:49 -07:00
parent 5ab92ce844
commit d07ed581a9
3 changed files with 28 additions and 1 deletions

View File

@ -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({

View File

@ -9,6 +9,16 @@
<div>
<form>
<div>
Use Viewcache:
<label>
Yes<input type="radio" name="viewcache" placeholder="use viewcache" value="true" checked="checked">
</label>
<label>
No<input type="radio" name="viewcache" placeholder="use viewcache" value="false">
</label>
</div>
<div>
rows:
<input type="number" name="rows" value="100">

View File

@ -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)
];
}