Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 423acc2

Browse files
committed
chore(benchmarks): remove no longer applicable tests and literal watching workarounds
1 parent a03b75c commit 423acc2

File tree

2 files changed

+19
-55
lines changed

2 files changed

+19
-55
lines changed

benchmarks/parsed-expressions-bp/app.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,6 @@ app.directive('bmPeWatch', function() {
2929
};
3030
});
3131

32-
//Executes the specified expression as a watcher
33-
//Adds a simple wrapper method to allow use of $watch instead of $watchCollection
34-
app.directive('bmPeWatchLiteral', function($parse) {
35-
function retZero() {
36-
return 0;
37-
}
38-
39-
return {
40-
restrict: 'A',
41-
compile: function($element, $attrs) {
42-
$element.text($attrs.bmPeWatchLiteral);
43-
return function($scope, $element, $attrs) {
44-
$scope.$watch($parse($attrs.bmPeWatchLiteral, retZero));
45-
};
46-
}
47-
};
48-
});
49-
5032
app.controller('DataController', function($scope, $rootScope) {
5133
var totalRows = 10000;
5234

@@ -72,8 +54,7 @@ app.controller('DataController', function($scope, $rootScope) {
7254
date2: new Date(Math.random() * Date.now()),
7355
func: function() { return star; },
7456
obj: data[i - 1],
75-
keys: data[i - 1] && (data[i - 1].keys || Object.keys(data[i - 1])),
76-
constructor: data[i - 1]
57+
keys: data[i - 1] && (data[i - 1].keys || Object.keys(data[i - 1]))
7758
});
7859
}
7960

benchmarks/parsed-expressions-bp/main.html

Lines changed: 18 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@
1616
<label for="complexPath">Complex Paths</label>
1717
</li>
1818

19-
<li>
20-
<input type="radio" ng-model="expressionType" value="constructorPath" id="constructorPath">
21-
<label for="constructorPath">Constructor Paths</label>
22-
($parse special cases "constructor" for security)
23-
</li>
24-
2519
<li>
2620
<input type="radio" ng-model="expressionType" value="fieldAccess" id="fieldAccess">
2721
<label for="fieldAccess">Field Accessors</label>
@@ -88,17 +82,6 @@
8882
<span bm-pe-watch="row.keys"></span>
8983
</li>
9084

91-
<li ng-switch-when="constructorPath" ng-repeat="(rowIdx, row) in ::data">
92-
<span bm-pe-watch="row.index"></span>
93-
<span bm-pe-watch="row.constructor.index"></span>
94-
<span bm-pe-watch="row.constructor.index"></span>
95-
<span bm-pe-watch="row.constructor.index"></span>
96-
<span bm-pe-watch="row.constructor.constructor.index"></span>
97-
<span bm-pe-watch="row.constructor.constructor.index"></span>
98-
<span bm-pe-watch="row.constructor.constructor.constructor.index"></span>
99-
<span bm-pe-watch="row.constructor.constructor.constructor.index"></span>
100-
</li>
101-
10285
<li ng-switch-when="complexPath" ng-repeat="(rowIdx, row) in ::data">
10386
<span bm-pe-watch="row.index"></span>
10487
<span bm-pe-watch="row.num0"></span>
@@ -215,27 +198,27 @@
215198
</li>
216199

217200
<li ng-switch-when="objectLiterals" ng-repeat="(rowIdx, row) in ::data">
218-
<span bm-pe-watch-literal="{foo: rowIdx}"></span>
219-
<span bm-pe-watch-literal="{foo: row, bar: rowIdx}"></span>
220-
<span bm-pe-watch-literal="{0: row, 1: rowIdx, 2: 3}"></span>
221-
<span bm-pe-watch-literal="{str: 'foo', num: rowIdx, b: true}"></span>
222-
<span bm-pe-watch-literal="{a: {b: {c: {d: {e: {f: rowIdx}}}}}}"></span>
223-
<span bm-pe-watch-literal="{a: rowIdx, b: 1, c: 2, d: 3, e: 4, f: 5, g: rowIdx, h: 6, i: 7, j: 8, k: rowIdx}"></span>
201+
<span bm-pe-watch="{foo: rowIdx}"></span>
202+
<span bm-pe-watch="{foo: row, bar: rowIdx}"></span>
203+
<span bm-pe-watch="{0: row, 1: rowIdx, 2: 3}"></span>
204+
<span bm-pe-watch="{str: 'foo', num: rowIdx, b: true}"></span>
205+
<span bm-pe-watch="{a: {b: {c: {d: {e: {f: rowIdx}}}}}}"></span>
206+
<span bm-pe-watch="{a: rowIdx, b: 1, c: 2, d: 3, e: 4, f: 5, g: rowIdx, h: 6, i: 7, j: 8, k: rowIdx}"></span>
224207
</li>
225208

226209
<li ng-switch-when="arrayLiterals" ng-repeat="(rowIdx, row) in ::data">
227-
<span bm-pe-watch-literal="[rowIdx]"></span>
228-
<span bm-pe-watch-literal="[rowIdx, 0]"></span>
229-
<span bm-pe-watch-literal="[rowIdx, 0, 1]"></span>
230-
<span bm-pe-watch-literal="[rowIdx, 0, 1, 2]"></span>
231-
<span bm-pe-watch-literal="[rowIdx, 0, 1, 2, 3]"></span>
232-
<span bm-pe-watch-literal="[[], [rowIdx], [], [], [3], [[[]]]]"></span>
233-
<span bm-pe-watch-literal="[rowIdx, undefined, null, true, false]"></span>
234-
<span bm-pe-watch-literal="[[][0], [0][0], [][rowIdx]]"></span>
235-
<span bm-pe-watch-literal="[0, rowIdx]"></span>
236-
<span bm-pe-watch-literal="[0, 1, rowIdx]"></span>
237-
<span bm-pe-watch-literal="[0, 1, 2, rowIdx]"></span>
238-
<span bm-pe-watch-literal="[0, 1, 2, 3, rowIdx]"></span>
210+
<span bm-pe-watch="[rowIdx]"></span>
211+
<span bm-pe-watch="[rowIdx, 0]"></span>
212+
<span bm-pe-watch="[rowIdx, 0, 1]"></span>
213+
<span bm-pe-watch="[rowIdx, 0, 1, 2]"></span>
214+
<span bm-pe-watch="[rowIdx, 0, 1, 2, 3]"></span>
215+
<span bm-pe-watch="[[], [rowIdx], [], [], [3], [[[]]]]"></span>
216+
<span bm-pe-watch="[rowIdx, undefined, null, true, false]"></span>
217+
<span bm-pe-watch="[[][0], [0][0], [][rowIdx]]"></span>
218+
<span bm-pe-watch="[0, rowIdx]"></span>
219+
<span bm-pe-watch="[0, 1, rowIdx]"></span>
220+
<span bm-pe-watch="[0, 1, 2, rowIdx]"></span>
221+
<span bm-pe-watch="[0, 1, 2, 3, rowIdx]"></span>
239222
</li>
240223
</ul>
241224
</div>

0 commit comments

Comments
 (0)