Skip to content

Commit 76a6509

Browse files
committed
Merge pull request #218 from stramel/feature/arrayClearPerf
refactor(array): change `shift` to `pop` for performance
2 parents 73e5659 + 6104b2e commit 76a6509

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/directives/array.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ angular.module('schemaForm').directive('sfArray', ['sfSelect', 'schemaForm', 'sf
170170
// Apparently the fastest way to clear an array, readable too.
171171
// http://jsperf.com/array-destroy/32
172172
while (arr.length > 0) {
173-
arr.shift();
173+
arr.pop();
174174
}
175175

176176
form.titleMap.forEach(function(item, index) {

0 commit comments

Comments
 (0)