JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<div class="stam" ng-app>
<div ng-controller="StamCtrl">
<button ng-click="testButton()">Test</button>
<div id="results"></div>
<div ng-repeat="a in array">
<input ng-model="a.qqqq">
</div>
</div>
</div>
JavaScript
function StamCtrl($scope) {
$scope.array = [];
$scope.testButton = function() {
// I want to run outside the digest loop,
// so I can measure the digest myself
setTimeout(function() {
$scope.test(1, 10);
$scope.test(10, 10);
$scope.test(30, 10);
}, 0);
};
$scope.test = function(numOfObjects, times) {
// This method measures how much time in average the digest method
// takes when changing the array to have 'numOfObjects' objects in it
var sum = 0;
for (var i = 0; i < times; i++) {
$scope.array = [];
$scope.$digest();
for (var j = 0; j < numOfObjects; j++) {
$scope.array.push({});
}
var t = +new Date();
$scope.$digest();
sum += +new Date() - t;
}
$('#results').prepend(
$("<div>" +
numOfObjects + ' objects test took: ' + sum/times +
"ms</div>"));
};
};