From bc8e517ae2eb3f79e0601207497f7650bde5ee71 Mon Sep 17 00:00:00 2001 From: Jeff Cross Date: Thu, 15 Jan 2015 10:52:48 -0800 Subject: [PATCH] feat(largeTable): add AngularJS 1.x largetable benchmark --- .../e2e_test/largetable_perf.es6 | 38 ++++++ .../e2e_test/largetable_spec.es6 | 25 ++++ modules/benchmarks_external/src/index.html | 3 + .../largetable/largetable-js-template.html | 58 +++++++++ .../src/largetable/largetable_benchmark.es6 | 119 ++++++++++++++++++ .../src/largetable/largetable_benchmark.html | 98 +++++++++++++++ protractor-e2e-dart2js.conf.js | 3 + protractor-perf-dart2js.conf.js | 3 + 8 files changed, 347 insertions(+) create mode 100644 modules/benchmarks_external/e2e_test/largetable_perf.es6 create mode 100644 modules/benchmarks_external/e2e_test/largetable_spec.es6 create mode 100644 modules/benchmarks_external/src/largetable/largetable-js-template.html create mode 100644 modules/benchmarks_external/src/largetable/largetable_benchmark.es6 create mode 100644 modules/benchmarks_external/src/largetable/largetable_benchmark.html diff --git a/modules/benchmarks_external/e2e_test/largetable_perf.es6 b/modules/benchmarks_external/e2e_test/largetable_perf.es6 new file mode 100644 index 0000000000..82d3a22726 --- /dev/null +++ b/modules/benchmarks_external/e2e_test/largetable_perf.es6 @@ -0,0 +1,38 @@ +var perfUtil = require('../../e2e_test_lib/e2e_test/perf_util'); + +describe('ng1.x largetable benchmark', function () { + var URL = 'benchmarks_external/web/largetable/largetable_benchmark.html'; + + afterEach(perfUtil.verifyNoBrowserErrors); + + [ + 'baselineBinding', + 'baselineInterpolation', + 'ngBind', + 'ngBindOnce', + 'interpolation', + 'interpolationAttr', + 'ngBindFn', + 'interpolationFn', + 'ngBindFilter', + 'interpolationFilter' + ].forEach(function(benchmarkType) { + it('should log the stats with: ' + benchmarkType, function() { + perfUtil.runClickBenchmark({ + url: URL, + buttons: ['#destroyDom', '#createDom'], + id: 'ng1.largetable.' + benchmarkType, + params: [{ + name: 'columns', + value: 100 + },{ + name: 'rows', + value: 20 + },{ + name: 'benchmarkType', + value: benchmarkType + }] + }); + }); + }); +}); diff --git a/modules/benchmarks_external/e2e_test/largetable_spec.es6 b/modules/benchmarks_external/e2e_test/largetable_spec.es6 new file mode 100644 index 0000000000..ace3922f4c --- /dev/null +++ b/modules/benchmarks_external/e2e_test/largetable_spec.es6 @@ -0,0 +1,25 @@ +var testUtil = require('../../e2e_test_lib/e2e_test/test_util'); + +describe('ng1.x largetable benchmark', function () { + var URL = 'benchmarks_external/web/largetable/largetable_benchmark.html'; + + afterEach(testUtil.verifyNoBrowserErrors); + + [ + 'baselineBinding', + 'baselineInterpolation', + 'ngBind', + 'ngBindOnce', + 'interpolation', + 'interpolationAttr', + 'ngBindFn', + 'interpolationFn', + 'ngBindFilter', + 'interpolationFilter' + ].forEach(function(benchmarkType) { + it('should log the stats with: ' + benchmarkType, function() { + browser.get(URL + '?benchmarkType='+benchmarkType); + testUtil.clickAll(['#createDom', '#destroyDom']); + }); + }); +}); diff --git a/modules/benchmarks_external/src/index.html b/modules/benchmarks_external/src/index.html index 51a492c9da..86ee472808 100644 --- a/modules/benchmarks_external/src/index.html +++ b/modules/benchmarks_external/src/index.html @@ -8,6 +8,9 @@
  • Tree benchmark
  • +
  • + Largetable benchmark +
  • diff --git a/modules/benchmarks_external/src/largetable/largetable-js-template.html b/modules/benchmarks_external/src/largetable/largetable-js-template.html new file mode 100644 index 0000000000..a21873e65e --- /dev/null +++ b/modules/benchmarks_external/src/largetable/largetable-js-template.html @@ -0,0 +1,58 @@ + + + + + +
    +

    baseline binding

    +
    + + :| + +
    +
    +
    +

    baseline binding once

    +
    + + :| + +
    +
    +
    +

    baseline interpolation

    +
    + {{column.i}}:{{column.j}}| +
    +
    +
    +

    attribute interpolation

    +
    + i,j attrs +
    +
    +
    +

    bindings with functions

    +
    + :| +
    +
    +
    +

    interpolation with functions

    +
    + {{column.iFn()}}:{{column.jFn()}}| +
    +
    +
    +

    bindings with filter

    +
    + :| +
    +
    +
    +

    interpolation with filter

    +
    + {{column.i | noop}}:{{column.j | noop}}| +
    +
    +
    diff --git a/modules/benchmarks_external/src/largetable/largetable_benchmark.es6 b/modules/benchmarks_external/src/largetable/largetable_benchmark.es6 new file mode 100644 index 0000000000..3dabc90736 --- /dev/null +++ b/modules/benchmarks_external/src/largetable/largetable_benchmark.es6 @@ -0,0 +1,119 @@ +import {getIntParameter, getStringParameter, bindAction} from 'e2e_test_lib/benchmark_util'; + +var totalRows = getIntParameter('rows'); +var totalColumns = getIntParameter('columns'); +var benchmarkType = getStringParameter('benchmarkType'); + +export function main() { + angular.bootstrap(document.querySelector('largetable'), ['app']); +} + +angular.module('app', []) +.config(function($compileProvider) { + if ($compileProvider.debugInfoEnabled) { + $compileProvider.debugInfoEnabled(false); + } +}) +.filter('noop', function() { + return function(input) { + return input; + }; +}) +.directive('largetable', function() { + return { + restrict: 'E', + templateUrl: 'largetable-js-template.html', + controller: 'DataController' + }; +}) +.controller('DataController', function($scope) { + bindAction('#destroyDom', destroyDom); + bindAction('#createDom', createDom); + + function destroyDom() { + $scope.$apply(function() { + $scope.benchmarkType = 'none'; + }); + } + + function createDom() { + $scope.$apply(function() { + $scope.benchmarkType = benchmarkType; + }); + } + + var data = $scope.data = []; + + function iGetter() { return this.i; } + function jGetter() { return this.j; } + + for (var i=0; i + + + +

    AngularJS/Dart 1.x largetable benchmark

    +
    +
    + rows: + + columns: + +
    +
    + baseline binding: + +
    +
    + baseline interpolation: + +
    +
    + ngBind: + +
    +
    + ngBindOnce: + +
    +
    + interpolation: + +
    +
    + attribute interpolation: + +
    +
    + ngBind + fnInvocation: + +
    +
    + interpolation + fnInvocation: + +
    +
    + ngBind + filter: + +
    +
    + interpolation + filter: + +
    + +
    + +

    + + +

    + +
    + +
    + +$SCRIPTS$ + + \ No newline at end of file diff --git a/protractor-e2e-dart2js.conf.js b/protractor-e2e-dart2js.conf.js index 06200fb728..d696213861 100644 --- a/protractor-e2e-dart2js.conf.js +++ b/protractor-e2e-dart2js.conf.js @@ -1,3 +1,6 @@ var config = exports.config = require('./protractor-e2e-shared.js').config; config.baseUrl = 'http://localhost:8002/'; +// TODO: remove this line when largetable dart has been added +config.exclude = config.exclude || []; +config.exclude.push('dist/cjs/e2e_test/benchmarks_external/e2e_test/largetable_spec.js'); diff --git a/protractor-perf-dart2js.conf.js b/protractor-perf-dart2js.conf.js index 89176bbbdb..6d580af16a 100644 --- a/protractor-perf-dart2js.conf.js +++ b/protractor-perf-dart2js.conf.js @@ -1,3 +1,6 @@ var config = exports.config = require('./protractor-perf-shared.js').config; config.params.lang = 'dart'; config.baseUrl = 'http://localhost:8002/'; +// TODO: remove this line when largetable dart has been added +config.exclude = config.exclude || []; +config.exclude.push('dist/cjs/e2e_test/benchmarks_external/e2e_test/largetable_perf.js');