Others have already answered how to calculate the time, so I will answer your comment: "I sort the array of objects in which I sort, depending on one of the properties of the object, so I cannot use the built-in sorting."
This is not entirely true, you can still use the built-in view:
var arr = [{ text: 'test', id: 2 }, { text: 'abc', id: 6 }, { text: 'xyz', id: 4 }]; arr.sort(function(x,y) { return x.text > y.text ? 1 : x.text < y.text ? -1 : 0 });
David Hedlund
source share